• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How to make Hero HP regen = 0

Status
Not open for further replies.
- Make a global group and a looping trigger of 0.05 per second...
- When cast to hero/unit, save the life of the hero (target) to a hashtable, add the target to the group...
- In the looping trigger, put a condition if the life of hero is greater than the saved value, then load the saved hashtable (in this case, the life)...
- When life of hero is less than the saved life, save again the life into the hashtable, this will overwrite the previous saved life of the hero...

The above method cannot be affected by healing...

EDIT: Something like this...

  • Event
    • Unit - Starts the effect of ability
  • Conditions
    • Ability - Ability being cast equals to blahhh
  • Actions
    • Custom script: set udg_uID = GetHandleId(GetSpellTargetUnit())
    • Custom script: call SaveReal(udg_HASH, udg_uID, 1, GetWidgetLife(GetSpellTargetUnit())
    • Unit - Add TargetUnitofSpellbeingcast to GROUP
    • Set - index = index + 1
    • Custom script: if udg_index==1 then
    • Trigger - Turn on Looper
    • Custom script: endif
  • Event
    • Time - Every 0.05 of game time
  • Conditions
  • Actions
    • Unit - Pick every unit in GROUP
      • Custom script: set udg_uID = GetHandleId(GetEnumUnit())
      • Set Hero - PickedUnit
      • Custom script: set udg_Life = LoadReal(udg_HASH, udg_uID, 1)
      • Custom script: if not IsUnitType(udg_Hero, UNIT_TYPE_DEAD) then
      • Custom script: if GetWidgetLife(udg_Hero) > udg_Life then
      • Unit - Life of Hero to Life
      • Custom script: else
      • Custom script; call SaveReal(udg_HASH, udg_uID, 1, GetWidgetLife(udg_Hero))
      • Custom script: endif
      • Custom script: else
      • Set - index = index - 1
      • Unit - Remove Hero from GROUP
      • Custom script: if udg_index==0 then
      • Trigger - Turn Off this trigger
      • Custom script: endif
      • Custom script: endif
 
Last edited:
Level 16
Joined
Jun 24, 2009
Messages
1,409
- Make a global group and a looping trigger of 0.05 per second...
- When cast to hero/unit, save the life of the hero (target) to a hashtable, add the target to the group...
- In the looping trigger, put a condition if the life of hero is greater than the saved value, then load the saved hashtable (in this case, the life)...
- When life of hero is less than the saved life, save again the life into the hashtable, this will overwrite the previous saved life of the hero...

The above method cannot be affected by healing...

EDIT: Something like this...

  • Event
    • Unit - Starts the effect of ability
  • Conditions
    • Ability - Ability being cast equals to blahhh
  • Actions
    • Custom script: set udg_uID = GetHandleId(GetSpellTargetUnit())
    • Custom script: call SaveReal(udg_HASH, udg_uID, 1, GetWidgetLife(GetSpellTargetUnit())
    • Unit - Add TargetUnitofSpellbeingcast to GROUP
    • Set - index = index + 1
    • Custom script: if udg_index==1 then
    • Trigger - Turn on Looper
    • Custom script: endif
  • Event
    • Time - Every 0.05 of game time
  • Conditions
  • Actions
    • Unit - Pick every unit in GROUP
      • Custom script: set udg_uID = GetHandleId(GetEnumUnit())
      • Set Hero - PickedUnit
      • Custom script: set udg_Life = LoadReal(udg_HASH, udg_uID, 1)
      • Custom script: if not IsUnitType(udg_Hero, UNIT_TYPE_DEAD) then
      • Custom script: if GetWidgetLife(udg_Hero) > udg_Life then
      • Unit - Life of Hero to Life
      • Custom script: else
      • Custom script; call SaveReal(udg_HASH, udg_uID, 1, GetWidgetLife(udg_Hero))
      • Custom script: endif
      • Custom script: else
      • Set - index = index - 1
      • Unit - Remove Hero from GROUP
      • Custom script: if udg_index==0 then
      • Trigger - Turn Off this trigger
      • Custom script: endif
      • Custom script: endif

Exactly what I said but a bit more complicated....
 
Status
Not open for further replies.
Top