• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Trigger to give Item ability to Hero

Status
Not open for further replies.
Level 2
Joined
Feb 17, 2017
Messages
26
Hi,

So I was planning to create a system which allows heroes to carry around traveling bags, giving them extra inventory space, and this is how far I got:


1) Create 2 custom items ("Open Bag" and "Close Bag")

2.1) Create a trigger that would activate when a hero acquires an "Open Bag", creating 2 invisible dummy units with 6 inventory slots, with one of them acquiring a "Close Bag" item.

2.2) Create a trigger that prevents a Hero from carrying more than one Bag (Optional)

3) Create yet another trigger that will activate whenever a Hero uses an "Open Bag" and another when a hero uses a "Close Bag". With these triggers, and with help of arrays of type "Item" of size 6, I can switch the items between the triggering Hero and the 2 created dummy units.

One would carry the Hero's basic inventory items, when the Hero uses the "Open Bag", and the other the items supposedly carried by the bag when the Hero uses the "Close Bag" item, successfully switching the items between the 3 units.


But here is the problem I now face and don't know how to solve:
Whenever a Hero activates his bag's power to switch the inventory between the dummy units, he technically "loses" his items, as well as all their powers. And I want a system that saves all the item's powers.

When a Hero carries an item giving an aura, I can easily imagine a dummy hero unit at the exact position of the Hero carrying the bag, effectively simulating the aura coming from the Hero.
For items with hero stats I can also imagine doing something like save the Hero's stats and give them to him as basic stats to simulate the maintaining (same for bonus damage items)

But what about items that increase the Hero's HP, mana, attack speed, armor etc...?

I was imagining to achieve this maybe with a trigger that would temporarily copy the abilities of the Hero's items, and give them to the Hero himself (also sparing me the work of saving all the Hero's stats to give him), but I have no idea how to do this. More specifically I have no idea how to do this without giving them abilities that will appear on the hero's abilities.
Maybe there is another way around?

Sorry if my text is a bit too long, I love to get into details :p

Thanks in advance
 
Last edited:
Level 2
Joined
Feb 17, 2017
Messages
26
Okay, sorry to double-post, just to inform that I got a bit further into solving my problem:

I just figured out I could create a trigger that would temporarily give item abilities to the triggering hero using the bag.
I could fix this by creating an array of type "ability" that would copy all 6 item abilities of the hero and give those to him once the items are given to the dummy unit. And because the abilities given are item abilities, they won't show into the Hero's abilities. That's how my triggers could work in theory.

Only one problem: While I do know how to identify items to create an array of type "Item", I have no idea how to identify the item's abilities themselves to save them into the "ability" array.

Any ideas?
 
Level 2
Joined
Feb 17, 2017
Messages
26
Hashtables?
I have used the warcraft 3 editor for quite a while now and never had to use them, so I won't hide that in hashtables I'm quite a noob about what they can do.
Is it something that would allow me to look into the concerned item's abilities, identify them, give their values to an array of type "ability" and use it to give them to the triggering hero?

If so, how would you do it?
And thanks for your reply
 
Status
Not open for further replies.
Top