• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

GUI Multiboard Inventory

Status
Not open for further replies.
Level 22
Joined
Jul 25, 2009
Messages
3,091
I'm making a Multiboard Inventory system in mainly GUI, and I need some input on some things. I'm using Arrow Keys to determine which item is highlighted and a dummy unit for actions such as dropping or equipping it. Please provide some snippets of code if suitable. Here are my questions as of now.

1. How can I best handle the items effects when it's equipped?

2. How can I connect the item with it's struct of charges and name and description? etc.
 
Level 22
Joined
Jul 25, 2009
Messages
3,091
1. Effects as in special effect or stat bonuses?
2. You can store them into a hashtable, using the item's handle id. http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/hashtables-mui-133407/

I know how to use hashtables, and they will be very useful for what I'm doing. But how am I going to connect the item with it's struct, and by effect I meant damage increases, armor, etc.

When I say connect them with my struct I mean, a player acquires an item, you have to check what item right? But having a trigger for every item you can pick up is impractical, and in my opinion using if/then triggers is also impractical, any ideas?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
But how am I going to connect the item with it's struct, and by effect I meant damage increases, armor, etc.

Use a bonus system. Create you own or use an existing one.

What I do in my map is that I save the number of bonuses into a hashtable. Then, each different bonus is represented by an integer.

When I equip an item, I load the number of bonuses. I loop through them, and call a function that adds the correct bonus, and the correct amount.

So for each item, you must save number of bonuses, bonus amount and what type each bonus is. You can use item type there actually, if items have base stats based on their item type.

When I say connect them with my struct I mean, a player acquires an item, you have to check what item right? But having a trigger for every item you can pick up is impractical, and in my opinion using if/then triggers is also impractical, any ideas?

GetHandleId() tells which item it is. You only need one trigger, and no IF/THEN/ELSE.
 
Level 22
Joined
Jul 25, 2009
Messages
3,091
Use a bonus system. Create you own or use an existing one.

What I do in my map is that I save the number of bonuses into a hashtable. Then, each different bonus is represented by an integer.

When I equip an item, I load the number of bonuses. I loop through them, and call a function that adds the correct bonus, and the correct amount.

So for each item, you must save number of bonuses, bonus amount and what type each bonus is. You can use item type there actually, if items have base stats based on their item type.



GetHandleId() tells which item it is. You only need one trigger, and no IF/THEN/ELSE.

Okay, I may sound very nooby, with this repetitive questioning, but I'm not 100% how it works.

How exactly does GetHandleId() function, like a point value? I assign it with custom script then can check it with that snippet? Once I've checked it and I move to Actions, how do I trigger the events? The only thing I can think of is If/Then,

Events: A unit acquires item
Conditions:
Actions: GetHandleId() ??????? Idk ????????
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Each object has a unique handle id. With that function, you know what item you're dealing with. You can use handle id as a key for storing values into hashtables.

Now let's say you have 6 slots in your multiboard. You can save the handle of the item as <item slot> of <parent key> in <hash>.

When you access the slot, you can load the item handle with <item slot> <parent key> <hash>

When you have the item's handle, you can load data attached to it. Or if the data is item type spesific, use item type as a key.
 
Level 22
Joined
Jul 25, 2009
Messages
3,091
Each object has a unique handle id. With that function, you know what item you're dealing with. You can use handle id as a key for storing values into hashtables.

Now let's say you have 6 slots in your multiboard. You can save the handle of the item as <item slot> of <parent key> in <hash>.

When you access the slot, you can load the item handle with <item slot> <parent key> <hash>

When you have the item's handle, you can load data attached to it. Or if the data is item type spesific, use item type as a key.

That's awesome, thank you very much for the help.
 
Status
Not open for further replies.
Top