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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top