Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

how to block all hpregen

Discussion in 'Triggers & Scripts' started by karland90, Feb 21, 2010.

  1. karland90

    karland90

    Joined:
    Mar 30, 2009
    Messages:
    960
    Resources:
    3
    Models:
    3
    Resources:
    3
    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?
     
  2. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    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)
     
  3. tjordell

    tjordell

    Joined:
    Jan 25, 2009
    Messages:
    554
    Resources:
    5
    Icons:
    1
    Spells:
    4
    Resources:
    5
    Haha Pharaoh_ i did just figure that out when i look at another one cuz i was in this thread and as always, you'r before me in helping peoples! :p Damn u :p I'm not geting any +rep cuz of you :p Hehe ;)
     
  4. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    Well I gave you the rep, are we good? :)
     
  5. karland90

    karland90

    Joined:
    Mar 30, 2009
    Messages:
    960
    Resources:
    3
    Models:
    3
    Resources:
    3
    OFC!!!

    /facepalm
    how didnt i think of that :D
     
  6. JeffreyQ

    JeffreyQ

    Joined:
    Sep 28, 2004
    Messages:
    363
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Notice though, unit won't get damage, as they will heal back to their health.
     
  7. Maximilianx

    Maximilianx

    Joined:
    Oct 14, 2008
    Messages:
    334
    Resources:
    0
    Resources:
    0
    Yeah you'd have to check if it's health was GREATER than the original amount. otherwise it wont take damage, as Jefferey said.
     
  8. Drenferalis

    Drenferalis

    Joined:
    Dec 30, 2009
    Messages:
    59
    Resources:
    0
    Resources:
    0
    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)
     
  9. JeffreyQ

    JeffreyQ

    Joined:
    Sep 28, 2004
    Messages:
    363
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    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.
     
  10. Viikuna

    Viikuna

    Joined:
    Aug 6, 2008
    Messages:
    430
    Resources:
    0
    Resources:
    0
    Just use system like UnitProperties or BonusMod.