- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
Is it better to have a virtual inventory and equip items through that (assuming units can have inventories but not be allowed to pick up items, so you just add the item via trigger), or is it better just to use the values in the item objects (e.g. level) to determine whether a unit can equip them?
Better yet, would I lose any performance if I created my own representation of an item (e.g. ItemStruct) and then made a table of these. Then when a hero picks up an item, I search for the appropriate ItemStruct entry and check to see if the hero can equip it. If the hero fails the conditions, then the hero obviously drops it.
Or should I be clever and manipulate the fields in the item object (level, type, etc.) to do this?
I'd like to go for the latter approach because it's more robust and easier to modify. I could even use the level of the item to make the look up time in the ItemStruct array constant (its level corresponds to its position in the array).
Is it better to have a virtual inventory and equip items through that (assuming units can have inventories but not be allowed to pick up items, so you just add the item via trigger), or is it better just to use the values in the item objects (e.g. level) to determine whether a unit can equip them?
Better yet, would I lose any performance if I created my own representation of an item (e.g. ItemStruct) and then made a table of these. Then when a hero picks up an item, I search for the appropriate ItemStruct entry and check to see if the hero can equip it. If the hero fails the conditions, then the hero obviously drops it.
Or should I be clever and manipulate the fields in the item object (level, type, etc.) to do this?
I'd like to go for the latter approach because it's more robust and easier to modify. I could even use the level of the item to make the look up time in the ItemStruct array constant (its level corresponds to its position in the array).