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
612
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
612
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
612
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
612
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
612
Here. Mine has levels, but the general idea is the same.
 

Attachments

  • Regeneration.w3x
    21.1 KB · Views: 219

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
612
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.

      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