Rejuvenation That Heals % Per Second

Blood_Wraith

New Member
Reaction score
2
I need an ability to act like Rejuvenation but restore a % of the Unit's HP per second instead of a set number. Is there ability like that, or do I have to use a trigger?
 

Inflicted

Currently inactive
Reaction score
63
Counld easily be done using hastables or some locals.

---

set the value of the maximum health to a variable, and then gradually increase it my a portion of that every second etc. I'm sure you should be able to work it out, would ofcourse be easier if you knew how to do it in Jass.
 

Blood_Wraith

New Member
Reaction score
2
Well my way of doing it, is a trigger like this:

Trigger:
  • Regen
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Regen
    • Actions
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
      • Wait 1.00 seconds
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
      • Wait 1.00 seconds
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
      • Wait 1.00 seconds
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
      • Wait 1.00 seconds
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
      • Wait 1.00 seconds
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
      • Wait 1.00 seconds
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
      • Wait 1.00 seconds
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
      • Wait 1.00 seconds
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
      • Wait 1.00 seconds
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
      • Wait 1.00 seconds
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
      • Wait 1.00 seconds
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
      • Wait 1.00 seconds
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
      • Wait 1.00 seconds
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
      • Wait 1.00 seconds
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)


My Regen spell only lasts 15 seconds, so the healing part only fires 15 times; once per second. In theory, this should work, but it does not. The healing part ONLY fires 2 times, why? Something to do with the wait function I guess.

ALSO how would I go about doing (Life of (Target unit of ability being cast) + 5%)? Can not find out the percentage part.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
I'm surprised it even runs. Target unit of ability being cast shouldn't return anything after the Wait. Use a local variable to store the unit, like so:
Trigger:
  • Custom script: local unit Target = GetSpellTargetUnit()


Put that line at the top of the trigger. Then, do a For Each Integer Loop:
Trigger:
  • For each (Integer A) from 1 to 15, do (Actions)
    • Loop - Actions
      • Custom script: set udg_YourUnit = Target
      • Unit - Set life of YourUnit to ((Life of (YourUnit)) + 100.00)


As for the 5% increase, do this:
Trigger:
  • Unit - Set life of YourUnit to ((Life of (YourUnit)) x 1.05)

That should increase the life by 5%.

The final trigger should look something like this:
Trigger:
  • Regen
    • Events
      • A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Regen
    • Actions
      • Custom script: local unit Target = GetSpellTargetUnit()
      • For each (Integer A) from 1 to 15, do (Actions)
        • Loop - Actions
          • Custom script: set udg_YourUnit = Target
          • Unit - Set life of YourUnit to ((Life of (YourUnit)) x 1.05)
          • Wait 1.00 seconds
 

Blood_Wraith

New Member
Reaction score
2
Ok I'm sure I know how to do this now, but I need variables correct? Can you list the ones I need, what type they are, and the initial value, if any.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
You just need one. A global unit variable, YourUnit. You can call this anything you like, such as TempUnit or DIEYOUSTUPIDCREEP, but make sure to change the name of the local variable, udg_YourUnit, to reflect this. In udg_YourUnit, the "udg_" part tells the WE that it's a global variable, and the "YourUnit" part is the name of that global variable, which you can change.
 

Blood_Wraith

New Member
Reaction score
2
Okay thanks, you should be more detailed when referencing variables like that. It seems to work, but the heal part only fires ONCE, it does not loop 15 times. Whats the problem?

Here's my trigger:

Trigger:
  • Regen
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Regen
    • Actions
      • Custom script: local unit Target = GetSpellTargetUnit()
      • For each (Integer A) from 1 to 15, do (Actions)
        • Loop - Actions
          • Custom script: set udg_YourUnit = Target
          • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) x 1.05)
          • Wait 1.00 seconds


Also, for the set your unit thing, couldn't the same thing be accomplished with

Trigger:
  • Set YourUnit = (Target unit of ability being cast)
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
You're not getting it. (Target unit of ability being cast) DOES NOT work after a wait. That's why you save it to a local variable, which retains its value until the trigger finishes. Then, after every wait, you set the unit variable to the local variable and use that instead. This makes it MUI.

Here's what mine looks like, and it works great. Also, thanks for the idea :)
Trigger:
  • Regenerate
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Regenerate
    • Actions
      • Custom script: local unit Target = GetSpellTargetUnit()
      • For each (Integer A) from 1 to 15, do (Actions)
        • Loop - Actions
          • Custom script: set udg_TempUnit = Target
          • Unit - Set life of TempUnit to ((Life of TempUnit) x 1.05)
          • Wait 1.00 seconds
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
you also cant use waits in a loop, the trigger wouldnt work either way if it does have waits in a loop
redo it with them out of the loop
create a unit variable and name it whatever you want
use the custom script: set udg_VariableName = Target
then do the other actions
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
GFreak, did you even read what I posted? I said that it works great my way. Waits work in For Each Integer loops. They only fail in Pick Every Destructible/Item/Unit loops.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
oh... sorry, never knew that...
just read the triggers that were up and a couple posts, not the full thread :/
 

Inflicted

Currently inactive
Reaction score
63
lol tbh i was about to say the exact same thing :/
nice i learnt something too. :p
--
note that the trigger posted abit above will continiously restore 5% of current hp. If you want it to be a set amount after cast, you'd want to set the initital health points to a local or something like that.
 

Blood_Wraith

New Member
Reaction score
2
I don't get it, I did it exactly like yours, and it only loops once, what the hell...

Trigger:
  • Regen
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Regen
    • Actions
      • Custom script: local unit Target = GetSpellTargetUnit()
      • For each (Integer A) from 1 to 15, do (Actions)
        • Loop - Actions
          • Custom script: set udg_TempUnit = Target
          • Unit - Set life of TempUnit to ((Life of TempUnit) x 1.05)
          • Wait 1.00 seconds


TempUnit is a Unit type variable, just fyi. Also could you post a sample map of it? I can't see what the hell I got wrong. Could be the type of variable, since you didn't tell me what type of variable it has to be.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Here. Mine has levels, but the general idea is the same.
 

Attachments

  • Regeneration.w3x
    21.1 KB · Views: 230

Blood_Wraith

New Member
Reaction score
2
Okay now I'm sure I got it working right, I even edited your trigger in your map first to see if it works there, and it does.

Then I import THE SAME trigger that I modified in your map, and I made sure everything matches, and it does. I even made a new ability to match yours, a cripple ability with the negative attributes put to zero.

And I test it, it works, but it only loops ONCE. Once again, the looping is my problem, what's the problem? Here's my trigger:

Trigger:
  • Regenerate
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Regen
    • Actions
      • Custom script: local unit Target = GetSpellTargetUnit()
      • For each (Integer A) from 1 to 15, do (Actions)
        • Loop - Actions
          • Custom script: set udg_TempUnit = Target
          • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))
          • Wait 1.00 seconds


The only way I see this not working is another trigger interfering, gonna try to see if there is a trigger that might be interfering.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Right. Integer A loops wipe each other out. I knew I was forgetting something after GFreak posted.

Maybe you should just copy those actions 15 times. The local shouldn't be leaking, so set udg_TempUnit = Target should be enough after every wait. The "Integer A" in the for loop does work after waits, but it isn't compatible with other Integer A loops at the same time, as they overwrite each other.

Curse my stupidity. Can I -rep myself?
 

Blood_Wraith

New Member
Reaction score
2
That was the problem the whole time? It figures its the SECOND most obvious thing that's the problem, and it wasn't very obvious to me, I just suspected it might of had something to do with the Integer A part as well, but I didn't bother deleting it at first. It works now, my trigger looks like this now:

Trigger:
  • Regenerate
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Regen
    • Actions
      • Custom script: local unit Target = GetSpellTargetUnit()
      • Custom script: set udg_TempUnit = Target
      • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))
      • Wait 1.00 seconds
      • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))
      • Wait 1.00 seconds
      • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))
      • Wait 1.00 seconds
      • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))
      • Wait 1.00 seconds
      • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))
      • Wait 1.00 seconds
      • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))
      • Wait 1.00 seconds
      • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))
      • Wait 1.00 seconds
      • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))
      • Wait 1.00 seconds
      • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))
      • Wait 1.00 seconds
      • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))
      • Wait 1.00 seconds
      • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))
      • Wait 1.00 seconds
      • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))
      • Wait 1.00 seconds
      • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))
      • Wait 1.00 seconds
      • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))
      • Wait 1.00 seconds
      • Unit - Set life of TempUnit to ((Life of TempUnit) + ((Max life of TempUnit) x 0.05))


Here's your rep, KaerfNomekop, you've earned it.

Edit: "You must spread some Reputation around before giving it to KaerfNomekop again." Oh well, thank you anyway.
 

XeRo13g

New Member
Reaction score
3
I need an ability to act like Rejuvenation but restore a % of the Unit's HP per second instead of a set number. Is there ability like that, or do I have to use a trigger?

1. Create a custom ability based on life regeneration aura.
a. Change the area of effect to cover the whole map or at least an area that cover your needs(eg. 25000).
b. Change the Stats - Targets Allowed to Invulnerable, Vulnerable, Player Units.
(That will heal every unit you have on the map but not your allies. You may add or remove classification to restrict or expand the targets)
c. Change the Data - Amount of Hit Point Regenerated to whatever you like.

2. Create a custom unit based on your Dummy unit(eg. Dummy Healer) and add the custom ability you just made.

3. Create a custom ability based on Item Ursa Warrior Summon
a. Change Data - Summon 1 - Unit Type to Dummy Healer
b. Change Duration Hero/Normal to whatever time you wish for the units to be healed.
c. Make it a Hero ability and add it to your hero.

Pros:
-Easy to implement
-Extremely customizable
-Smooth regeneration
-Regeneration special effect when unit is not at full health
-No trigger is required

Cons:
-An extra ability for regeneration and maybe an extra unit.
-Restricting the healing aura only to the casting unit, can be a nuisance in some cases.

Note: You can avoid using the extra dummy unit, by using a normal dummy and a trigger to catch the event "Unit - A unit Spawns a summoned unit"…Then add the ability manually.

Hope that helps.-
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
1. it was already solved
2. thats way more complex and way less efficient than the current solution
3. all this would do is an aoe version of what the current solution is that would be much less accurate
4. he requested that it work on a targeted unit
5. dont make me quote you
 
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

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top