Need Help Multi-instancing an item effect

MorbazanRhot

New Member
Reaction score
7
Alright, my question is pretty simple (I hope). I have an item that when consumed gives the user +50 hp regen per second but after 20 seconds the regen is removed and the user takes 1000 damage. I just use item health regen and made it a unit ability and give it to the user. The problem is that the only way I can think of for the trigger to remember the user is with a variable, but if a new unit uses the item before the old one expires, the old one would never lose the buff or take the damage. I figure there's some way I can do this using arrays, but I can't put my finger on it. So what I want to know is how you would make something like this multi-instanceable, ie that many different heroes (or even the same hero multiple times) could use the item and get the buff and still have it be removed and deal damage properly. If the solution involves triggering the healing in place of making it a unit ability given to the hero that is fine with me too, just whatever will make it work. Thanks in advance and as always +rep to anyone that can help.

Anyone? I believe it's got to be possible because I think something similar must be done with potions in The Black Road given that they give health regeneration over time. Maybe something involving a countdown timer? I really have no idea, I keep going over it and getting nothing which is why I'm looking for help, please.
 

the Lumpy

►►►
Reaction score
53
Well, if each player is limited to having 1 hero, then you make an array for each thing (e.g. buffs) and index it with the player's number.

If players aren't limited to 1 hero, you can set each hero's custom value (via triggers) when it's created, and use that custom value to index the arrays.

This doesn't cover the situation where a hero can have more than one, though.
 
D

Down

Guest
you can add the unit to a unit group
and when a unit in that unit group is attacked and doesnt have the regen buff deal 1000 damage to him and remove him from the group
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
I think it would be really easy to do in JASS, since you can use local variables. I could probably do it if I knew the Order ID string of the item being used. (Upload the map if possible.)
 

MorbazanRhot

New Member
Reaction score
7
To TheDamien: This is being done in GUI.

To Down: The problem with that is if the unit doesn't get attacked after the 20 seconds are up he could abuse it, but more importantly there is no buff that goes along with this effect, just an item ability converted into a unit ability and given to the user.

To Ghan: For the record, I love you... you've helped me out a ton already, but... I'm afraid the map is too big to upload, if you want to send me a private message with your email address I can probably email it to you or else I can give it to you via bnet. Thanks again to everyone that has helped out so far, +rep given :).
 

the Lumpy

►►►
Reaction score
53
I think this does basically what you want: (I haven't tested it, though.)
Code:
Start effect of item
    Events
        Unit - A unit Uses an item
    Conditions
        (Item-type of (Item being manipulated)) Equal to [item]
    Actions
        -------- Override global variable technique from http://www.elilz.com/searchres.php?searchq=local+variable --------
        Custom script:   local unit udg_local_unit
        Unit - Add [ability] to local_unit
        Wait 20.00 seconds
        Unit - Remove [ability] from local_unit
        Unit - Set life of local_unit to ((Life of local_unit) - 1000.00)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top