• 🏆 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 block all hpregen

Status
Not open for further replies.
Level 14
Joined
Mar 30, 2009
Messages
971
id like to know how to make it so, that if i call the script, then the unit will stop hp regen. that includes normal hp regen (obj editor), item bonuses to regen, unholy aura.
that does not include heal abilities (but if possible, then im interested in that too) like: heal spray, chain heal, heal. also is it possible to block healing potions?
 
You need to check the health of the unit, and then in a periodic event contantly set it to that hp.
  • Trigger0
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Hashtable - Create a hashtable
    • Set Hashtable = (Last created hashtable)
  • Trigger
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Pause Regeneration
  • Actions
    • Hashtable - Save (Life of (Target unit of ability being cast)) as (Key(health)) of (Key(Target unit of ability being cast)) in Hashtable
    • Unit - Add (Target unit of ability being cast) to (UnitGroup)
    • Trigger - Turn on (Trigger 2 <gen>)
  • Trigger2
  • Events
    • Time - Every 0.05 seconds of game time
  • Conditions
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (UnitGroup) is empty Equal to False
      • Then - Actions
        • Unit Group - Pick every unit in (UnitGroup) and do (Actions)
          • Loop - Actions
            • Unit - Set life of (Picked unit) to (Load (Key(health)) of (Key(Picked unit)) from Hashtable)
      • Else - Actions
        • Trigger - Turn off (This trigger)
 
Level 7
Joined
Oct 14, 2008
Messages
340
Yeah you'd have to check if it's health was GREATER than the original amount. otherwise it wont take damage, as Jefferey said.
 
Level 4
Joined
Dec 30, 2009
Messages
60
Notice though, unit won't get damage, as they will heal back to their health.

This will fix that.

  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (UnitGroup) is empty Equal to False
      • Then - Actions
        • Unit Group - Pick every unit in (UnitGroup) and do (Actions)
          • Loop - Actions
            • If (All conditions are true) then do (Actions) else do (Actions)
              • If - Conditions
                • (Picked Unit) Life > (Load (Key(health)))
              • Then - Actions
                • Unit - Set life of (Picked unit) to (Load (Key(health)) of (Key(Picked unit)) from Hashtable)
              • Else - Actions
                • Do nothing
        • Else - Actions
          • Trigger - Turn off (This trigger)
 
Level 9
Joined
Sep 28, 2004
Messages
365
Yap that will work but. But if the health is lower than the saved health, it will regen once again. The best way is to code your regen manually and disable the regen in the unit editor for all units. Then check if the unit has the regen aura, remove it from the regen group. So it will stop regen.
 
Status
Not open for further replies.
Top