| 06-13-2003, 04:59 AM | #1 |
I was wondering what the most efficcient method for vreating an item class system was. The system I am thinking about allows only one 'weapon' class item to be carried, one 'clothing/armor' class to be carried etc. For those of you who have played Between The Worlds that is the type of system Im looking for, and if you havnt played it you should! So what I need is an efficient method of detedting the items "type" and allowing only one of these types to be carried. Anyways, thank you in advance for your help. |
| 06-13-2003, 05:09 AM | #2 |
I'd just guess and say that you calculate it on level of item. If you have 2 level 3 items, you drop one of them auto. |
| 06-13-2003, 06:51 AM | #3 |
I have a class system in my Diablo2 mod. I use the HP of the item to know the class. Just make the item invulnerable to avoid class shifting. |
| 06-13-2003, 10:39 AM | #4 |
Better make items disappear when being attacked. |
| 06-13-2003, 03:15 PM | #5 |
Some time ago I made this engine, not unlike the one you describe. It does the job but it's kind of advanced and not that understandable. Please tell me how you liked it. If there is something you don't understand don't hesitate to reply. Instead of not letting a unit keep an item it replaces it with a dummy item without effect. It uses custom SLKs for the items and it has some imported icon buttons (based off Blizzards icons and modified by me and others.) These can of course be replaced by other items. If you feel like implementing it somewhere (it takes time and isn't very easy to do), don't forget to give me credit :). |
| 06-13-2003, 08:47 PM | #6 |
What condition is there to check if a hero has an item with a certain health/level in their inventory (for checking if they already have an item of that type)? |
| 06-13-2003, 09:17 PM | #7 |
real comparison, item-item life to check item's hp for item level, use item type, choose whatever hero, then choose random item type, and choose the level of the item |
| 06-14-2003, 01:36 AM | #8 | |
Quote:
For the first part can I make it check the health of an item in the heroes inventory? If not than your other way should work. |
| 06-14-2003, 03:37 AM | #9 |
i think u'll only be able to check the hp of it if its the last picked up item, or a variable, maybe u can based on slot, but i would say that using level might be a better idea(seems to be much more simple), and, i would put the extra items into a stash area, or maybe use weaadar's bag demo (stash area would be much simpler if u dont want to go thru the hassle) |
| 06-14-2003, 05:03 AM | #10 |
cool idea, thanks all |
| 06-14-2003, 02:44 PM | #11 |
Why don't you guys just place the common groups in their own set of arrays? weapons[0] = Axe of Indulgment weapons[1] = Wand of Negation It's a long process.. But all the real comparisons will be in it.. And then you only need to use a for loop to figue everything out. |
| 06-14-2003, 04:55 PM | #12 |
That's how my map does it, creates arrays and whatnot, and then loops through them checking for validity. |
| 06-15-2003, 07:40 AM | #13 |
Yes, but when you have 350+ items this is a long long process. Checking the HP is very easy you do it at the time the hero picks the item. (Heros acquires an item) and you then use a boolean or an integer saying that the Hero has an item of that type. Every time a Heros acquires an item you check the type and you check if the Heros has an item of this type by checking the boolean variable. It is not necessary to loop thru the slots. |
| 06-15-2003, 01:44 PM | #14 |
Even if you have a lot of items the loop would not interfer with normal gaming as the process is hardly noticed anyways. But you are right, it is alot easier doing it by using the HP to detect the unit class, although I prefer my method because I believe that it offers greater managability. You are free to choose ^^. |
| 06-15-2003, 04:51 PM | #15 |
Just so you guysknow... I am using the level of the item, because this can be checked on items in the heroes inventory, and when they pick up an item. Thus it does not require variables and such. |
