• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to regenerate life and mana on a region

Status
Not open for further replies.
Level 6
Joined
Nov 14, 2007
Messages
155
how can i create a trigger that would let specific units recover health and mana at a certain region??

for example:

Region A only regenerates Allies of Player 1 (Red)..
I tried these triggers

  • Regenerate
    • Events
      • Unit - A unit enters Region A<gen>
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Entering unit) belongs to an ally of Player 1 (Red)) Equal to True
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Entering unit)) Equal to Player 2 (Blue)
              • (Owner of (Entering unit)) Equal to Player 3 (Teal)
              • (Owner of (Entering unit)) Equal to Player 4 (Purple)
              • (Owner of (Entering unit)) Equal to Player 5 (Yellow)
              • (Owner of (Entering unit)) Equal to Player 6 (Orange)
    • Actions
      • Unit Group - Pick every unit in (Units in Hero Spawn Point West <gen>) and do (Actions)
        • Loop - Actions
          • Unit - Add Life Regeneration Aura (Neutral) to (Entering unit)
          • Unit - Add Mana Regeneration (Neutral) to (Entering unit)
And
  • DeRegenerate
    • Events
      • Unit - A unit leaves Region A <gen>
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Leaving unit) belongs to an ally of Player 1 (Red)) Equal to True
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Leaving unit)) Equal to Player 2 (Blue)
              • (Owner of (Leaving unit)) Equal to Player 3 (Teal)
              • (Owner of (Leaving unit)) Equal to Player 4 (Purple)
              • (Owner of (Leaving unit)) Equal to Player 5 (Yellow)
              • (Owner of (Leaving unit)) Equal to Player 6 (Orange)
    • Actions
      • Unit Group - Pick every unit in (Units in Hero Spawn Point West <gen>) and do (Actions)
        • Loop - Actions
          • Unit - Remove Life Regeneration Aura (Neutral) from (Leaving unit)
          • Unit - Remove Mana Regeneration (Neutral) from (Leaving unit)
The first trigger works but when the unit leaves; the abilities are still there..

Life and Mana Regeneration:
target units are self

and i tried summoning a unit like the feral spirit; it can't gain the ability; and i tried replacing inside the region, the unit replaced;

and after the unit re-enters the ability can't be gained

+Rep to those who can help!
 
Last edited:
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

Look at this trigger I created. It isn't an answer to your question but this one makes things easier ;)

  • Restore Mana and Health
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in Created TestRegion <gen>) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an ally of Player 1 (Red)) Equal to True
            • Then - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (((Life of (Picked unit)) / 100.00) x 1.00))
              • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + (((Mana of (Picked unit)) / 100.00) x 1.00))
            • Else - Actions
Event: Ofc you can use other time as 0.01 seconds.
Action: This trigger belongs now to 1% (x 1.00) you can add something other if you want.
 
Level 6
Joined
Nov 14, 2007
Messages
155
Thanks but I changed something:

Unit - Set life of (Picked unit) to (((Life of (Picked unit)) x 1.00) x 1.50)
instead of (((Life of (Picked unit)) / 100.00) x 1.00)

because if i set it to (((Life of (Picked unit)) / 100.00) x 1.00) - the unit dies instantly so i changed it or is the 100 just merely 1.00?
 
Level 3
Joined
Aug 4, 2009
Messages
54
Did you miss the "Life of Picked Unit +" part? Because without it you're just dividing the unit's HP by 100 every .01 seconds. Also, the "x 1.00" at the end is completely unnecessary.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

@ Ham Ham: No this to uncool :p triggering = best :)

@ Loyal2NES: No I put in this x1.00 - because this 1% if he want 2% he need to change the x1.00. So he can change it directly.

@ Maker: Ok, we need to know what maptype it is. If this "regenpoint" is in a base, where directly no fight is possible you can take maxlife. But if you still can fight in this area, maxlife is to high I think.
 
Level 11
Joined
Jun 28, 2008
Messages
2,362
Maybe use fountain of health and mana, add it to a dummy unit, and place it on a region.
Then you just have to limit who's healed with triggers.

I didn't read all posts, so sorry if someone already said this. Idk if it will work.
 
Level 9
Joined
Apr 28, 2009
Messages
538
If the problem isn't solved yet:
Create two triggers.

Trigger 1: Events: When a unit enters...etc
Conditions: ...whatever
Actions: Triggger Add Event to trigger (<Trigger 2 gen>) Every x seconds of the game.
Trigger 2: Events: NONE
Conditions: your conditions here
Actions: the hp regen stuff for units.
 
Status
Not open for further replies.
Top