[Trigger] modify spell damage with formula

Status
Not open for further replies.
Level 6
Joined
Jan 2, 2015
Messages
171
i was making war stomp spell with formula that increase damage base on current life of caster. but when i use triggers, it also damage air unit which i dont want to. How do i fix this problem? I also making earthshaker dota fissure spell based on impale..how to increase damage of it with current life of unit with triggers? i succeed increase damage of 1 target spell but never succeed on modify spell damage like shockwave,impale, war stomp (ground), thunder clap (ground)

  • spell aoe
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • DamageEventType Equal to 0
      • (Ability being cast) Equal to War Stomp
    • Actions
      • Set DamageEventAmount = (450.00 x (1.00 + (1.20 x (1.00 - ((Life of DamageEventTarget) / (Max life of DamageEventTarget))))))
      • Unit - Cause (Triggering Unit) to damage circular area after 0.00 seconds of radius 400.00 at (Position of (Triggering Unit)), dealing DamageEventAmount damage of attack type Normal and damage type Normal
  • spell single target
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • DamageEventType Equal to 0
      • (Ability being cast) Equal to Storm Bolt
    • Actions
      • Set DamageEventAmount = (900.00 x (1.00 + (5.00 x (1.00 - ((Life of DamageEventTarget) / (Max life of DamageEventTarget))))))
      • Unit - Cause Triggering Unit to damage (Target unit of ability being cast), dealing DamageEventAmount damage of attack type Normal and damage type Normal
 
Level 2
Joined
Sep 16, 2014
Messages
17
Just instead of circular damage(damage area) use:pick every unit from unit group(units in region of 400 around caster) matching that unit is alive,its enemy and is ground,and damage target all those units.

  • Set tempPoint = (Position of (Casting unit))
  • Set tempGrp = (Units within 400.00 of udg_tempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Owner of (Matching unit)) is an ally of (Owner of (Casting unit))) Equal to False) and (((Matching unit) is A ground unit) Equal to True))))
  • Unit Group - Pick every unit in tempGrp and do (Actions)
    • Loop - Actions
      • Set DamageEventAmount = (900.00 x (1.00 + (5.00 x (1.00 - ((Life of (Picked unit)) / (Max life of (Picked unit)))))))
      • Unit - Cause (Casting unit) to damage (Picked unit), dealing udg_DamageEventAmmount damage of attack type Normal and damage type Normal
  • Unit Group - Remove all units from tempGrp
  • Custom script: call RemoveLocation(udg_tempPoint)


Also having 2 Events means it will trigger when unit takes damage and spell is cast independantly,starts effect of the ability Event should be enough.
Q:Is this the right way to clear Unit group memory leak?
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Dont use matching, but use an If/Then/Else inside the loop itself.
Thank me later.

@kreda
No that is simply emptying the group, the group itself still exists.
To remove it completely, you either do the same as you did to the location by calling "call DestroyGroup(udg_tempGrp)" or by using the wantDestroyGroup method.
This method allows you to just pick the units in 400 range of a point (without group variable) by making a custom script containing "set bj_wantDestroyGroup = true" just above the "Unit Group - Pick every unit in <group> ad do (Actions)"
 
Level 6
Joined
Jan 2, 2015
Messages
171
Dont use double event here.
Just use the damage modifier or start of the effect. (second should work best)

Also dont use circular damage.
Just pick every unit in range and make an If/Then/Else to filter out allied, dead, structure and flying units.

how about shockwave spell,impale.. how to damage unit with trigger other than damage area?
 
Level 6
Joined
Jan 2, 2015
Messages
171
Dont use matching, but use an If/Then/Else inside the loop itself.
Thank me later.

@kreda
No that is simply emptying the group, the group itself still exists.
To remove it completely, you either do the same as you did to the location by calling "call DestroyGroup(udg_tempGrp)" or by using the wantDestroyGroup method.
This method allows you to just pick the units in 400 range of a point (without group variable) by making a custom script containing "set bj_wantDestroyGroup = true" just above the "Unit Group - Pick every unit in <group> ad do (Actions)"

i still cant get it to work
  • War Stomp
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to War Stomp
    • Actions
      • Set DamageEventAmount = (450.00 x (1.00 + (1.20 x (1.00 - ((Life of (Triggering unit)) / (Max life of (Triggering unit)))))))
      • Set Temp_Group = (Units within 300.00 of Temp_Location matching (((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is A flying unit) Equal to False)) and ((((Matching unit) is alive) Equal to True) and (((Matching uni
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in Temp_Group and do (Unit - Cause (Triggering unit) to damage (Picked unit), dealing DamageEventAmount damage of attack type Normal and damage type Normal)
i cant get it to work
 
I made two triggers for War Stomp. It may look more complex like this, but I designed it to avoid bugs.

  • War Stomp 1
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to War Stomp
    • Actions
      • Set WarStompDamage[(Custom Value of (Triggering unit))] = (450.00 x (1.00 + (1.20 x (1.00 - ((Life of (Triggering unit)) / (Max life of (Triggering unit)))))))
      • Set War Stomp Count = War Stomp Count + 1
      • If (WarStompCount Equal to 1) then (Trigger - Turn on War Stomp 2)
  • War Stomp 2
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • IsDamageSpell Equal to True
      • WarStompDamage[(Custom value of DamageEventSource)] Not equal to 0.00
      • DamageEventTarget has buff Stun(pause) // this should be whatever buff you're using with your triggered War Stomp
    • Actions
      • -------- Decrease the number of active War Stomps
      • Set WarStompCount = (WarStompCount - 1)
      • -------- Store the war stomp damage for efficiency in the loop
      • Set WarStompReal = WarStompDamage[(Custom value of DamageEventSource)]
      • -------- Reset the damage back to 0 so it doesn't mess with any other War Stomp triggers
      • Set WarStompDamage[(Custom value of DamageEventSource)] = 0.00
      • -------- Save DamageEventSource as a different variable since the damage source could potentially change within the loop.
      • Set WarStompCaster = DamageEventSource
      • -------- Disable this trigger for efficiency in the loop
      • Trigger - Turn off (this trigger)
      • -------- I prefer this method, you don't have to
      • Custom script: set bj_wantDestroyGroup = true
      • -------- I'm not sure what your other conditions were
      • Unit Group - Pick every unit in (Units within 300.00 of Temp_Location matching (((((Matching unit) belongs to an enemy of (Owner of (DamageEventSource))) Equal to True) and (((Matching unit) is A flying unit) Equal to False)) and ((((Matching unit) is alive) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Cause WarStompCaster to damage (Picked unit), dealing WarStompReal damage of attack type Spells and damage type Normal)
      • -------- In case one of the previous damages didn't fire, yet, clear damage event to reset the values
      • Trigger - Run ClearDamageEvent (Checking conditions)
      • -------- Only turn on the trigger again if there are more war stomp units --------
      • If (WarStompCount Greater than 0) then (Trigger - Turn on (This trigger))
      • -------- Block the initial damage of this spell so that this one unit doesn't get damaged for too much --------
      • Set DamageEventAmount = 0.00
 
Level 6
Joined
Jan 2, 2015
Messages
171
I made two triggers for War Stomp. It may look more complex like this, but I designed it to avoid bugs.

  • War Stomp 1
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to War Stomp
    • Actions
      • Set WarStompDamage[(Custom Value of (Triggering unit))] = (450.00 x (1.00 + (1.20 x (1.00 - ((Life of (Triggering unit)) / (Max life of (Triggering unit)))))))
      • Set War Stomp Count = War Stomp Count + 1
      • If (WarStompCount Equal to 1) then (Trigger - Turn on War Stomp 2)
  • War Stomp 2
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • IsDamageSpell Equal to True
      • WarStompDamage[(Custom value of DamageEventSource)] Not equal to 0.00
      • DamageEventTarget has buff Stun(pause) // this should be whatever buff you're using with your triggered War Stomp
    • Actions
      • -------- Decrease the number of active War Stomps
      • Set WarStompCount = (WarStompCount - 1)
      • -------- Store the war stomp damage for efficiency in the loop
      • Set WarStompReal = WarStompDamage[(Custom value of DamageEventSource)]
      • -------- Reset the damage back to 0 so it doesn't mess with any other War Stomp triggers
      • Set WarStompDamage[(Custom value of DamageEventSource)] = 0.00
      • -------- Save DamageEventSource as a different variable since the damage source could potentially change within the loop.
      • Set WarStompCaster = DamageEventSource
      • -------- Disable this trigger for efficiency in the loop
      • Trigger - Turn off (this trigger)
      • -------- I prefer this method, you don't have to
      • Custom script: set bj_wantDestroyGroup = true
      • -------- I'm not sure what your other conditions were
      • Unit Group - Pick every unit in (Units within 300.00 of Temp_Location matching (((((Matching unit) belongs to an enemy of (Owner of (DamageEventSource))) Equal to True) and (((Matching unit) is A flying unit) Equal to False)) and ((((Matching unit) is alive) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Cause WarStompCaster to damage (Picked unit), dealing WarStompReal damage of attack type Spells and damage type Normal)
      • -------- In case one of the previous damages didn't fire, yet, clear damage event to reset the values
      • Trigger - Run ClearDamageEvent (Checking conditions)
      • -------- Only turn on the trigger again if there are more war stomp units --------
      • If (WarStompCount Greater than 0) then (Trigger - Turn on (This trigger))
      • -------- Block the initial damage of this spell so that this one unit doesn't get damaged for too much --------
      • Set DamageEventAmount = 0.00

thanks ill try it. do u have idea how to damage unit with modified shockwave damage or impale or fissure from dota spell?

i use this trigger for fissure dota

  • Spells Var
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Set this variable to the base spell "Fissure" --------
      • Set FiAbilityMain = Fissure
  • Fissure
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to FiAbilityMain
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FiCustomValue Less than 100
        • Then - Actions
          • Set FiCustomValue = (FiCustomValue + 1)
        • Else - Actions
          • Set FiCustomValue = 1
      • Set TempPoint = (Position of (Triggering unit))
      • Set FiTargetPoint = (Target point of ability being cast)
      • Set FiRealDistance = 0.00
      • Set TempReal = (Angle from TempPoint to FiTargetPoint)
      • For each (Integer A) from 1 to 19, do (Actions)
        • Loop - Actions
          • Set FiRealDistance = (FiRealDistance + 64.00)
          • Set TempOffset = (TempPoint offset by FiRealDistance towards TempReal degrees)
          • Special Effect - Create a special effect at TempOffset using Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect at TempOffset using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect at TempOffset using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect at TempOffset using Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
          • Special Effect - Destroy (Last created special effect)
          • Destructible - Create a FissureDestructible at TempOffset facing (Random angle) with scale 0.50 and variation (Integer(TempReal))
          • Set FiDestructible[((FiCustomValue x 20) + (Integer A))] = (Last created destructible)
          • Custom script: call RemoveLocation(udg_TempOffset)
      • Unit - Create 1 HiddenDummy for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
      • Unit - Set the custom value of (Last created unit) to FiCustomValue
      • Unit - Add a 4.00 second Generic expiration timer to (Last created unit)
      • Unit Group - Add (Last created unit) to FiDummyGroup
      • Custom script: call RemoveLocation(udg_FiTargetPoint)
      • Custom script: call RemoveLocation(udg_TempPoint)
  • Fissure Periodic
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in FiDummyGroup) Equal to True
    • Actions
      • Set TempInt = (Custom value of (Triggering unit))
      • For each (Integer A) from 1 to 19, do (Actions)
        • Loop - Actions
          • Destructible - Remove FiDestructible[((TempInt x 20) + (Integer A))]
      • Unit - Remove (Picked unit) from the game
Make unit cast fissure
  • Fissure Target
    • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Location = (Position of Boss)
      • Set Temp_Group = (Units within 300.00 of Temp_Location matching (((((Matching unit) belongs to an enemy of (Owner of Boss)) Equal to True) and (((Matching unit) is A flying unit) Equal to False)) and ((((Matching unit) is alive) Equal to True) and (((Matchi
      • Unit Group - Pick every unit in (Random 1 units from Temp_Group) and do (Actions)
        • Loop - Actions
          • Custom script: call RemoveLocation(udg_Temp_Location)
          • Set Temp_Location = (Position of (Picked unit))
          • Unit - Order Boss to Undead Crypt Lord - Impale Temp_Location
      • Custom script: call DestroyGroup(udg_Temp_Group)
      • Custom script: call RemoveLocation(udg_Temp_Location)
Fissure is based on impale. how do i modify damage of fissure based on hp? i set fissure damage to 0 on object editor
 
Level 6
Joined
Jan 2, 2015
Messages
171
Well if the object editor damage is 0, you'll need to use the DamageEvent equal to 2.00 event to catch the damage moment, and then have the DamageEventSource damage the target.

i follow your instruction but there some trigger i dont understand:
1. IsDamageSpell equal to True ???
2. Is RunClearDamageEvent a trigger?

here is my trigger i created based on ur instruction:

  • War Stomp 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to War Stomp
    • Actions
      • Set WarStompDamage = (450.00 x (1.00 + (1.50 x (1.00 - ((Life of DamageEventTarget) / (Max life of DamageEventTarget))))))
      • Set WarStompCount = (WarStompCount + 1)
      • If (WarStompCount Equal to 1) then do (Trigger - Turn on Trigger War Stomp 2) else do (Do nothing)
  • War Stomp 2
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (Ability being cast) Equal to Mountain Buster Primal
      • WarStompDamage Not equal to 0.00
      • (DamageEventTarget has buff Stunned (Pause)) Equal to True
    • Actions
      • Set WarStompCount = (WarStompCount - 1)
      • Set WarStompReal = WarStompDamage
      • Set WarStompDamage = 0.00
      • Set WarStompCaster = DamageEventSource
      • Trigger - Turn off (This trigger)
      • Custom script: set bj_wantDestroyGroup = true
      • Set Temp_Location = (Position of DamageEventSource)
      • Set Temp_Group = (Units within 300.00 of Temp_Location matching (((((Matching unit) belongs to an enemy of (Owner of DamageEventSource)) Equal to True) and (((Matching unit) is A flying unit) Equal to False)) and ((((Matching unit) is alive) Equal to True) and (((Matching uni
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit - Cause WarStompCaster to damage (Picked unit), dealing WarStompReal damage of attack type Normal and damage type Normal
 
i follow your instruction but there some trigger i dont understand:
1. IsDamageSpell equal to True ???
2. Is RunClearDamageEvent a trigger?

here is my trigger i created based on ur instruction:

  • War Stomp 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to War Stomp
    • Actions
      • Set WarStompDamage = (450.00 x (1.00 + (1.50 x (1.00 - ((Life of DamageEventTarget) / (Max life of DamageEventTarget))))))
      • Set WarStompCount = (WarStompCount + 1)
      • If (WarStompCount Equal to 1) then do (Trigger - Turn on Trigger War Stomp 2) else do (Do nothing)
  • War Stomp 2
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • -------- There is no ability being cast with this event
      • IsDamageSpell Equal to True //this way it doesn't trigger on physical damage
      • WarStompDamage[Custom Value of DamageEventSource)] Not equal to 0.00
      • (DamageEventTarget has buff Stunned (Pause)) Equal to True
    • Actions
      • Set WarStompCount = (WarStompCount - 1)
      • -------- WarStompDamage must be a real array so this can be MUI
      • Set WarStompReal = WarStompDamage
      • Set WarStompDamage = 0.00
      • Set WarStompCaster = DamageEventSource
      • Trigger - Turn off (This trigger)
      • Custom script: set bj_wantDestroyGroup = true
      • Set Temp_Location = (Position of DamageEventSource)
      • Set Temp_Group = (Units within 300.00 of Temp_Location matching (((((Matching unit) belongs to an enemy of (Owner of DamageEventSource)) Equal to True) and (((Matching unit) is A flying unit) Equal to False)) and ((((Matching unit) is alive) Equal to True) and (((Matching uni
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit - Cause WarStompCaster to damage (Picked unit), dealing WarStompReal damage of attack type Normal and damage type Normal

Clear Damage Event is a trigger.

This should all be in your map if you are using the latest DamageEngine (3.5.3)
 
Level 6
Joined
Jan 2, 2015
Messages
171
Clear Damage Event is a trigger.

This should all be in your map if you are using the latest DamageEngine (3.5.3)

  • War Stomp 2
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • WarStompDamage Not equal to 0.00
      • (DamageEventTarget has buff Stunned (Pause)) Equal to True
    • Actions
      • Set WarStompCount = (WarStompCount - 1)
      • Set WarStompReal = WarStompDamage
      • Set WarStompDamage = 0.00
      • Set WarStompCaster = DamageEventSource
      • Trigger - Turn off (This trigger)
      • Custom script: set bj_wantDestroyGroup = true
      • Set Temp_Location = (Position of DamageEventSource)
      • Set Temp_Group = (Units within 300.00 of Temp_Location matching (((((Matching unit) belongs to an enemy of (Owner of DamageEventSource)) Equal to True) and (((Matching unit) is A flying unit) Equal to False)) and ((((Matching unit) is alive) Equal to True) and (((Matching uni
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit - Cause WarStompCaster to damage (Picked unit), dealing WarStompReal damage of attack type Normal and damage type Normal
      • Trigger - Run ClearDamageEvent (checking conditions)
      • If (WarStompCount Greater than 0) then do (Trigger - Turn on (This trigger)) else do (Do nothing)
      • Set DamageEventAmount = 0.00
 
Level 6
Joined
Jan 2, 2015
Messages
171
Use "boolean" condition and select IsSpellDamage from the list of variables.

War Stomp 2
Events
Game - DamageModifierEvent becomes Equal to 1.00
Conditions
IsDamageSpell Equal to True
WarStompDamage Not equal to 0.00
(DamageEventTarget has buff Stunned (Pause)) Equal to True
Actions
Set WarStompCount = (WarStompCount - 1)
Set WarStompReal = WarStompDamage
Set WarStompDamage = 0.00
Set WarStompCaster = DamageEventSource
Trigger - Turn off (This trigger)
Custom script: set bj_wantDestroyGroup = true
Set Temp_Location = (Position of DamageEventSource)
Set Temp_Group = (Units within 300.00 of Temp_Location matching (((((Matching unit) belongs to an enemy of (Owner of DamageEventSource)) Equal to True) and (((Matching unit) is A flying unit) Equal to False)) and ((((Matching unit) is alive) Equal to True) and (((Matching uni
Unit Group - Pick every unit in Temp_Group and do (Actions)
Loop - Actions
Unit - Cause WarStompCaster to damage (Picked unit), dealing WarStompReal damage of attack type Normal and damage type Normal
Trigger - Run ClearDamageEvent (checking conditions)
If (WarStompCount Greater than 0) then do (Trigger - Turn on (This trigger)) else do (Do nothing)
Set DamageEventAmount = 0.00

i wanna test map but wc3 stays loading. could it have something to do with new damage engine i just copy from ur new maps?
 
Level 6
Joined
Jan 2, 2015
Messages
171
wc3 says loading? What does that mean? Did you copy the two abilities and set the variables correctly?

it just stays in loading screen and never start the game. It started when i copy ur damage engine triggers to my map. I already copied new Detect Spell Damage and set the variable. When i tried use damage engine v3.0.0.0 my map did not stays in loading screen and start the game.

This is damage engine that i use in my map before i use new damage engine v3.5.3.1.

  • Unit Event
    • Events
      • Game - UnitIndexEvent becomes Equal to 1.00
      • Game - UnitIndexEvent becomes Equal to 2.00
    • Conditions
    • Actions
      • -------- --------
      • -------- Functionality credits go to Nestharus (for vJass UnitEvent) and grim001 (for AutoEvents) --------
      • -------- --------
      • Custom script: if udg_DEvAbility == 0 then
      • -------- --------
      • -------- Copy Death Event Ability from Object Editor, then set DEvAbility to it as follows --------
      • -------- --------
      • Set DEvAbility = Death Event Ability (Undefend Detect)
      • -------- --------
      • Custom script: call ExecuteFunc("InitDeathEvent")
      • Custom script: endif
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnitIndexEvent Equal to 1.00
        • Then - Actions
          • Unit - Add DEvAbility to UDexUnits[UDex]
          • Custom script: call UnitMakeAbilityPermanent(udg_UDexUnits[udg_UDex], true, udg_DEvAbility)
          • Set DEvBlock[UDex] = True
          • Set IsUnitAlive[UDex] = True
          • Custom script: call ExecuteFunc("DEvCheckDeathProxy")
        • Else - Actions
          • Set IsUnitAlive[UDex] = False
          • Set IsUnitReincarnating[UDex] = False
          • Set DEvRemoved[UDex] = False
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CargoTransportUnit[UDex] Not equal to No unit
            • Then - Actions
              • Custom script: call ExecuteFunc("CEvFireUnload")
            • Else - Actions
          • Custom script: if udg_CargoTransportGroup[udg_UDex] != null then
          • Custom script: call DestroyGroup(udg_CargoTransportGroup[udg_UDex])
          • Custom script: set udg_CargoTransportGroup[udg_UDex] = null
          • Custom script: endif
      • Custom script: endfunction
      • Custom script:
      • Custom script: function CEvFireUnload takes nothing returns nothing
      • Unit Group - Remove UDexUnits[UDex] from CargoTransportGroup[(Custom value of CargoTransportUnit[UDex])]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CEvSpecial[UDex] Equal to True
        • Then - Actions
          • Set CEvSpecial[UDex] = False
          • Set CEvNext[CEvPrev[UDex]] = CEvNext[UDex]
          • Set CEvPrev[CEvNext[UDex]] = CEvPrev[UDex]
          • Set CEvPrev[UDex] = 0
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CEvNext[0] Equal to 0
            • Then - Actions
              • Countdown Timer - Pause CEvUnloadTimer
            • Else - Actions
        • Else - Actions
      • Set CEvBlock[UDex] = True
      • Set CargoEvent = 0.00
      • Set CargoEvent = 2.00
      • Set CargoEvent = 0.00
      • Set CEvBlock[UDex] = False
      • Custom script: if not IsUnitLoaded(udg_UDexUnits[udg_UDex]) or IsUnitType(udg_CargoTransportUnit[udg_UDex], UNIT_TYPE_DEAD) or GetUnitTypeId(udg_CargoTransportUnit[udg_UDex]) == 0 then
      • Set CargoTransportUnit[UDex] = No unit
      • Custom script: endif
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DEvOnDeath takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
      • Set UDex = (Custom value of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UDex Not equal to 0
        • Then - Actions
          • Set IsUnitAlive[UDex] = False
          • Set DeathEvent = 0.00
          • Set DeathEvent = 1.00
          • Set DeathEvent = 0.00
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CargoTransportUnit[UDex] Not equal to No unit
            • Then - Actions
              • Custom script: call CEvFireUnload()
            • Else - Actions
        • Else - Actions
      • Custom script: set udg_UDex = pdex
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DEvCheckDeath takes nothing returns nothing
      • Set UDex = DEvList[0]
      • Set DEvList[0] = 0
      • Custom script: loop
      • Custom script: exitwhen udg_UDex == 0
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DEvBlock[UDex] Equal to True
        • Then - Actions
          • Set DEvBlock[UDex] = False
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IsUnitAlive[UDex] Equal to True
            • Then - Actions
              • Set IsUnitAlive[UDex] = False
              • Set IsUnitReincarnating[UDex] = True
              • Set DeathEvent = 0.50
              • Set DeathEvent = 0.00
            • Else - Actions
      • Set UDex = DEvList[UDex]
      • Custom script: endloop
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DEvCheckDeathProxy takes nothing returns nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DEvList[0] Equal to 0
        • Then - Actions
          • Custom script: call TimerStart(udg_DEvTimer, 0, false, function DEvCheckDeath)
        • Else - Actions
      • Set DEvList[UDex] = DEvList[0]
      • Set DEvList[0] = UDex
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DEvOnOrder takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
      • Set UDex = (Custom value of (Matching unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UDex Not equal to 0
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of DEvAbility for UDexUnits[UDex]) Equal to 0
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DEvRemoved[UDex] Equal to False
                • Then - Actions
                  • Set DEvRemoved[UDex] = True
                  • Set DeathEvent = 0.00
                  • Set DeathEvent = 3.00
                  • Set DeathEvent = 0.00
                • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IsUnitAlive[UDex] Equal to False
                • Then - Actions
                  • Set IsUnitAlive[UDex] = True
                  • Set DeathEvent = 0.00
                  • Set DeathEvent = 2.00
                  • Set DeathEvent = 0.00
                  • Set IsUnitReincarnating[UDex] = False
                • Else - Actions
                  • Custom script: if IsUnitType(udg_UDexUnits[udg_UDex], UNIT_TYPE_DEAD) then
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DEvBlock[UDex] Equal to True
                    • Then - Actions
                      • Set IsUnitAlive[UDex] = False
                      • Set DeathEvent = 0.00
                      • Set DeathEvent = 1.00
                      • Set DeathEvent = 0.00
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • CEvSpecial[UDex] Equal to True
                          • (UDexUnits[UDex] is A Hero) Equal to True
                        • Then - Actions
                        • Else - Actions
                          • Custom script: call DEvCheckDeathProxy()
                  • Custom script: endif
          • Custom script: if udg_CargoTransportUnit[udg_UDex] != null and not udg_CEvBlock[udg_UDex] and not IsUnitLoaded(udg_UDexUnits[udg_UDex]) or IsUnitType(udg_UDexUnits[udg_UDex], UNIT_TYPE_DEAD) then
          • Custom script: call CEvFireUnload()
          • Custom script: endif
        • Else - Actions
      • Custom script: set udg_UDex = pdex
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function CEvUnloadChecker takes nothing returns nothing
      • Set UDex = CEvNext[0]
      • Custom script: loop
      • Custom script: exitwhen udg_UDex == 0
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (UDexUnits[UDex] is being transported) Equal to False
        • Then - Actions
          • Custom script: call CEvFireUnload()
        • Else - Actions
      • Set UDex = CEvNext[UDex]
      • Custom script: endloop
      • Custom script: endfunction
      • Custom script:
      • Custom script: function CEvStartChecker takes nothing returns nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CEvNext[0] Equal to 0
        • Then - Actions
          • Custom script: call TimerStart(udg_CEvUnloadTimer, 0.03125, true, function CEvUnloadChecker)
        • Else - Actions
      • Set CEvSpecial[UDex] = True
      • Set CEvPrev[CEvNext[0]] = UDex
      • Set CEvNext[UDex] = CEvNext[0]
      • Set CEvNext[0] = UDex
      • Custom script: endfunction
      • Custom script:
      • Custom script: function CEvOnLoad takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
      • Custom script: local integer udg_TempInteger
      • Set UDex = (Custom value of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UDex Not equal to 0
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CargoTransportUnit[UDex] Not equal to No unit
            • Then - Actions
              • Custom script: call CEvFireUnload()
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IsUnitAlive[UDex] Equal to False
            • Then - Actions
              • Custom script: call CEvStartChecker()
            • Else - Actions
          • Set CargoTransportUnit[UDex] = (Transporting unit)
          • Set TempInteger = (Custom value of CargoTransportUnit[UDex])
          • Custom script: if udg_CargoTransportGroup[udg_TempInteger] == null then
          • Custom script: set udg_CargoTransportGroup[udg_TempInteger] = CreateGroup()
          • Custom script: endif
          • Unit Group - Add UDexUnits[UDex] to CargoTransportGroup[TempInteger]
          • Set CargoEvent = 0.00
          • Set CargoEvent = 1.00
          • Set CargoEvent = 0.00
        • Else - Actions
      • Custom script: set udg_UDex = pdex
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function CEvOnPause takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
      • Set UDex = (Custom value of (Matching unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (UDexUnits[UDex] is paused) Equal to True
          • CargoTransportUnit[UDex] Not equal to No unit
          • CEvSpecial[UDex] Equal to False
        • Then - Actions
          • Custom script: call CEvStartChecker()
        • Else - Actions
      • Custom script: set udg_UDex = pdex
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function InitDeathEvent takes nothing returns nothing
      • Custom script: local integer i = 15
      • Custom script: local player p
      • Custom script: local trigger d = CreateTrigger()
      • Custom script: local trigger l = CreateTrigger()
      • Custom script: local trigger t = GetTriggeringTrigger()
      • Custom script: local boolexpr o = Filter(function DEvOnOrder)
      • Custom script: local boolexpr u = Filter(function CEvOnPause)
      • Custom script: call TriggerAddCondition(d, Filter(function DEvOnDeath))
      • Custom script: call TriggerAddCondition(l, Filter(function CEvOnLoad))
      • Custom script: loop
      • Custom script: set p = Player(i)
      • Custom script: call SetPlayerAbilityAvailable(p, udg_DEvAbility, false)
      • Custom script: call TriggerRegisterPlayerUnitEvent(t, p, EVENT_PLAYER_UNIT_ISSUED_ORDER, o)
      • Custom script: call TriggerRegisterPlayerUnitEvent(t, p, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, u)
      • Custom script: call TriggerRegisterPlayerUnitEvent(d, p, EVENT_PLAYER_UNIT_DEATH, null)
      • Custom script: call TriggerRegisterPlayerUnitEvent(l, p, EVENT_PLAYER_UNIT_LOADED, null)
      • Custom script: exitwhen i == 0
      • Custom script: set i = i - 1
      • Custom script: endloop
      • Custom script: set d = null
      • Custom script: set l = null
      • Custom script: set o = null
      • Custom script: set p = null
      • Custom script: set t = null
      • Custom script: set u = null
      • Custom script: set udg_CargoTransportGroup[0] = null
      • Custom script: call DestroyGroup(udg_CargoTransportGroup[0])
      • Countdown Timer - Pause DEvTimer
  • Unit Indexer
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: call ExecuteFunc("InitializeUnitIndexer")
      • Custom script: endfunction
      • Custom script:
      • Custom script: function ClearUnitIndex takes nothing returns nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Custom value of UDexUnits[UDex]) Equal to 0
        • Then - Actions
          • Set UnitIndexLock[UDex] = (UnitIndexLock[UDex] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UnitIndexLock[UDex] Equal to 0
            • Then - Actions
              • Set UDexNext[UDexPrev[UDex]] = UDexNext[UDex]
              • Set UDexPrev[UDexNext[UDex]] = UDexPrev[UDex]
              • Set UDexPrev[UDex] = 0
              • Set UnitIndexEvent = 0.00
              • Set UnitIndexEvent = 2.00
              • Set UnitIndexEvent = 0.00
              • Set UDexUnits[UDex] = No unit
              • Set UDexNext[UDex] = UDexRecycle
              • Set UDexRecycle = UDex
            • Else - Actions
        • Else - Actions
      • Custom script: endfunction
      • Custom script:
      • Custom script: function IndexUnit takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
      • Custom script: local integer ndex
      • -------- - --------
      • -------- You can customize the following block - if conditions are false the (Matching unit) won't be indexed. --------
      • -------- - --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnitIndexerEnabled Equal to True
          • (Custom value of (Matching unit)) Equal to 0
        • Then - Actions
          • Set UDexWasted = (UDexWasted + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UDexWasted Equal to 15
            • Then - Actions
              • Set UDexWasted = 0
              • Set UDex = UDexNext[0]
              • Custom script: loop
              • Custom script: exitwhen udg_UDex == 0
              • Custom script: set ndex = udg_UDexNext[udg_UDex]
              • Custom script: call ClearUnitIndex()
              • Custom script: set udg_UDex = ndex
              • Custom script: endloop
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UDexRecycle Equal to 0
            • Then - Actions
              • Set UDex = (UDexGen + 1)
              • Set UDexGen = UDex
            • Else - Actions
              • Set UDex = UDexRecycle
              • Set UDexRecycle = UDexNext[UDex]
          • Set UDexUnits[UDex] = (Matching unit)
          • Unit - Set the custom value of UDexUnits[UDex] to UDex
          • Set UDexPrev[UDexNext[0]] = UDex
          • Set UDexNext[UDex] = UDexNext[0]
          • Set UDexNext[0] = UDex
          • Set UnitIndexLock[UDex] = 1
          • Set UnitIndexEvent = 0.00
          • Set UnitIndexEvent = 1.00
          • Set UnitIndexEvent = 0.00
          • Custom script: set udg_UDex = pdex
        • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function InitializeUnitIndexer takes nothing returns nothing
      • Custom script: local integer i = 16
      • Custom script: local boolexpr b = Filter(function IndexUnit)
      • Custom script: local region re = CreateRegion()
      • Custom script: local trigger t = GetTriggeringTrigger()
      • Custom script: local rect r = GetWorldBounds()
      • Custom script: call RegionAddRect(re, r)
      • Custom script: call TriggerRegisterEnterRegion(t, re, b)
      • Custom script: call TriggerClearActions(t)
      • Custom script: call TriggerAddAction(t, function ClearUnitIndex)
      • Set UnitIndexerEnabled = True
      • Custom script: loop
      • Custom script: set i = i - 1
      • Custom script: call GroupEnumUnitsOfPlayer(bj_lastCreatedGroup, Player(i), b)
      • Custom script: exitwhen i == 0
      • Custom script: endloop
      • Custom script: call RemoveRect(r)
      • Custom script: set re = null
      • Custom script: set r = null
      • Custom script: set t = null
      • Custom script: set b = null
      • Set UnitIndexEvent = 3.00
      • Set UnitIndexEvent = 0.00
  • Damage Engine
    • Events
      • Game - UnitIndexEvent becomes Equal to 1.00
      • Game - UnitIndexEvent becomes Equal to 2.00
    • Conditions
    • Actions
      • -------- Copy the Cheat Death Ability from Object Editor into your map and set the following variable respectively: --------
      • Set DamageBlockingAbility = Cheat Death Ability (+500,000)
      • -------- - --------
      • Set DamageTypeSpell = 1
      • Set DamageTypeDOT = 2
      • Set DamageTypeRanged = 3
      • -------- - --------
      • Custom script: call ExecuteFunc("InitDamageEvent")
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DmgEvFilter takes nothing returns boolean
      • -------- - --------
      • -------- The next conditions let you filter out unwanted units. By default, units with Locust will not pass the check. --------
      • -------- - --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventFilterUnit is A structure) Equal to False
        • Then - Actions
          • Custom script: return true
        • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DmgEvRemoveAbilities takes nothing returns nothing
      • Custom script: local real r
      • Custom script: loop
      • Set DmgEvN = (DmgEvN - 1)
      • Custom script: set r = GetWidgetLife(udg_DmgEvStack[udg_DmgEvN])
      • Unit - Remove DamageBlockingAbility from DmgEvStack[DmgEvN]
      • Custom script: call SetWidgetLife(udg_DmgEvStack[udg_DmgEvN], r)
      • Set DmgEvStack[DmgEvN] = No unit
      • Custom script: exitwhen udg_DmgEvN == 0
      • Custom script: endloop
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DmgEvSetVars takes nothing returns nothing
      • Set DamageEventAmount = (Damage taken)
      • Set DamageEventSource = (Damage source)
      • Set DamageEventTarget = (Triggering unit)
      • Custom script: endfunction
      • Custom script:
      • Custom script: function FireDmgEv takes nothing returns nothing
      • Custom script: local boolean b = GetUnitAbilityLevel(udg_DamageEventTarget, udg_DamageBlockingAbility) > 0
      • Custom script: local real life = 0
      • Custom script: local real pain = 0
      • Custom script: if b then
      • Custom script: set life = GetWidgetLife(udg_DamageEventTarget)
      • Unit - Remove DamageBlockingAbility from DamageEventTarget
      • Custom script: call SetWidgetLife(udg_DamageEventTarget, life)
      • Custom script: set pain = GetWidgetLife(udg_DamageEventTarget)
      • Custom script: endif
      • Set DamageEventPrevAmt = DamageEventAmount
      • Set DamageEventExplodesUnit = False
      • Set DamageEventOverride = False
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventAmount Equal to 0.00
        • Then - Actions
          • Set DamageEvent = 2.00
        • Else - Actions
          • Set DamageModifierEvent = 1.00
          • Set DamageEvent = 1.00
      • Custom script: if b then
      • Unit - Add DamageBlockingAbility to DamageEventTarget
      • Custom script: call SetWidgetLife(udg_DamageEventTarget, life + GetWidgetLife(udg_DamageEventTarget) - pain)
      • Custom script: endif
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventAmount Not equal to DamageEventPrevAmt
        • Then - Actions
          • Set DmgEvLife = ((Life of DamageEventTarget) + (DamageEventPrevAmt - DamageEventAmount))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DamageEventAmount Greater than DamageEventPrevAmt
            • Then - Actions
              • Unit - Set life of DamageEventTarget to (Max(0.41, DmgEvLife))
              • Custom script: if udg_DmgEvLife <= .405 then
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DamageEventExplodesUnit Equal to True
                • Then - Actions
                  • Unit - Make DamageEventTarget Explode on death
                • Else - Actions
              • Trigger - Turn off DamageEventTrigger
              • Custom script: call UnitDamageTarget(udg_DamageEventSource, udg_DamageEventTarget, 999, false, false, null, null, null)
              • Trigger - Turn on DamageEventTrigger
              • Custom script: endif
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Max life of DamageEventTarget) Less than DmgEvLife
                • Then - Actions
                  • Unit - Add DamageBlockingAbility to DamageEventTarget
                  • Set DmgEvStack[DmgEvN] = DamageEventTarget
                  • Set DmgEvN = (DmgEvN + 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DmgEvN Equal to 1
                    • Then - Actions
                      • Custom script: call TimerStart(udg_DmgEvTimer, 0, false, function DmgEvRemoveAbilities)
                    • Else - Actions
                • Else - Actions
              • Unit - Set life of DamageEventTarget to DmgEvLife
        • Else - Actions
      • Custom script: endfunction
      • Custom script:
      • Custom script: function FireRecursiveDmgEv takes nothing returns nothing
      • Custom script: local real d = udg_DamageEventAmount
      • Custom script: local unit s = udg_DamageEventSource
      • Custom script: local unit t = udg_DamageEventTarget
      • Custom script: local integer ptype = udg_DmgTypPrev
      • Custom script: local boolean explode = udg_DamageEventExplodesUnit
      • Custom script: local boolean override = udg_DamageEventOverride
      • Custom script: local real prev = udg_DamageEventPrevAmt
      • Custom script: call DmgEvSetVars()
      • Custom script: if udg_DamageEventTarget != t or udg_DamageEventSource != s or udg_DamageEventAmount != d or udg_DamageEventType != ptype then
      • Set DamageEvent = 0.00
      • Set DamageModifierEvent = 0.00
      • Custom script: call FireDmgEv()
      • -------- - --------
      • -------- Delete the next three lines to disable the in-game recursion crash warnings --------
      • -------- - --------
      • Custom script: else
      • Cinematic - Clear the screen of text messages for (All players)
      • Game - Display to (All players) for 999.00 seconds the text: WARNING: Recursion ...
      • -------- - --------
      • Custom script: endif
      • Custom script: set udg_DamageEventOverride = override
      • Custom script: set udg_DamageEventExplodesUnit = explode
      • Custom script: set udg_DamageEventPrevAmt = prev
      • Custom script: set udg_DmgTypPrev = ptype
      • Custom script: set udg_DamageEventAmount = d
      • Custom script: set udg_DamageEventSource = s
      • Custom script: set udg_DamageEventTarget = t
      • Custom script: set s = null
      • Custom script: set t = null
      • Custom script: endfunction
      • Custom script:
      • Custom script: function OnDmgEv takes nothing returns boolean
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEvent Equal to 0.00
        • Then - Actions
          • Set DmgTypPrev = DamageEventType
          • Custom script: call DmgEvSetVars()
          • Custom script: call FireDmgEv()
          • Set DamageModifierEvent = 0.00
          • Set DamageEvent = 0.00
          • Set DamageEventType = 0
        • Else - Actions
          • Custom script: call FireRecursiveDmgEv()
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function CreateDmgEv takes nothing returns nothing
      • Custom script: set udg_DamageEventTrigger = CreateTrigger()
      • Custom script: call TriggerAddCondition(udg_DamageEventTrigger, Filter(function OnDmgEv))
      • Custom script: endfunction
      • Custom script:
      • Custom script: function SetupDmgEv takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnitIndexEvent Equal to 1.00
        • Then - Actions
          • Set DamageEventFilterUnit = UDexUnits[UDex]
          • Custom script: if GetUnitAbilityLevel(udg_DamageEventFilterUnit, 'Aloc') == 0 and DmgEvFilter() then
          • Set UnitDamageRegistered[UDex] = True
          • Trigger - Add to DamageEventTrigger the event (Unit - DamageEventFilterUnit Takes damage)
          • Custom script: endif
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UnitDamageRegistered[UDex] Equal to True
            • Then - Actions
              • Set UnitDamageRegistered[UDex] = False
              • Set DamageEventsWasted = (DamageEventsWasted + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DamageEventsWasted Equal to 15
                • Then - Actions
                  • Set DamageEventsWasted = 0
                  • Custom script: call DestroyTrigger(udg_DamageEventTrigger)
                  • Custom script: call CreateDmgEv()
                  • Set UDex = UDexNext[0]
                  • Custom script: loop
                  • Custom script: exitwhen udg_UDex == 0
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • UnitDamageRegistered[UDex] Equal to True
                    • Then - Actions
                      • Trigger - Add to DamageEventTrigger the event (Unit - UDexUnits[UDex] Takes damage)
                    • Else - Actions
                  • Set UDex = UDexNext[UDex]
                  • Custom script: endloop
                  • Custom script: set udg_UDex = pdex
                • Else - Actions
            • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function InitDamageEvent takes nothing returns nothing
      • Custom script: call CreateDmgEv()
      • Custom script: call TriggerAddCondition(GetTriggeringTrigger(), Filter(function SetupDmgEv))
      • Set UnitIndexerEnabled = False
      • Custom script: set udg_DamageEventFilterUnit = CreateUnit(Player(15), 'uloc', 0, 0, 0)
      • Set UnitIndexerEnabled = True
      • Unit - Add DamageBlockingAbility to DamageEventFilterUnit
      • Unit - Remove DamageEventFilterUnit from the game
      • Countdown Timer - Start DmgEvTimer as a One-shot timer that will expire in 0.00 seconds
      • Trigger - Run (This trigger) (checking conditions)
and then i replace damage engine 3.0.0 to 3.5.3 like this

  • Damage Engine
    • Events
      • Game - UnitIndexEvent becomes Equal to 1.00
      • Game - UnitIndexEvent becomes Equal to 2.00
    • Conditions
    • Actions
      • -------- Copy the Cheat Death Ability from Object Editor into your map and set the following variable respectively: --------
      • Set DamageBlockingAbility = Cheat Death Ability (+500,000)
      • -------- Copy the Detect Spell Damage Ability from Object Editor into your map and set the following variable respectively: --------
      • Set SpellDamageAbility = Detect Spell Damage
      • -------- - --------
      • -------- You can add extra classifications here if you want to differentiate between your triggered damage --------
      • -------- Use DamageTypeExplosive (or any negative value damage type) if you want a unit killed by that damage to explode --------
      • Set DamageTypeExplosive = -1
      • Set DamageTypeCriticalStrike = 1
      • Set DamageTypeHeal = 2
      • Set DamageTypeReduced = 3
      • Set DamageTypeBlocked = 4
      • -------- - --------
      • Custom script: call ExecuteFunc("InitDamageEvent")
      • Custom script: endfunction
      • Custom script: function DmgEvAmplifyCheck takes nothing returns nothing
      • -------- The next if/else blocks handles magic damage modification --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventTarget is Ethereal) Equal to True
          • (DamageEventTarget is A Hero) Equal to False
        • Then - Actions
          • Set DamageEventAmount = (DamageEventAmount x 1.67)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Elune's Grace for DamageEventTarget) Greater than 0
        • Then - Actions
          • Set DamageEventAmount = (DamageEventAmount x 0.80)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventTarget is A Hero) Equal to True
          • (DamageEventTarget has an item of type Runed Bracers) Equal to True
        • Then - Actions
          • Set DamageEventAmount = (DamageEventAmount x 0.67)
        • Else - Actions
      • Custom script: endfunction
      • -------- - --------
      • -------- The next conditions let you filter out units you don't want detection for. By default, units with Locust will not pass the check. --------
      • -------- - --------
      • Custom script: function DmgEvFilter takes nothing returns boolean
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DmgEvUnit is A structure) Equal to False
        • Then - Actions
          • Custom script: return GetUnitAbilityLevel(udg_DmgEvUnit, 'Aloc') == 0
        • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • Custom script: function DmgEvResetVars takes nothing returns nothing
      • Set DmgEvRecursionN = (DmgEvRecursionN - 1)
      • Set DamageEventPrevAmt = LastDmgPrevAmount[DmgEvRecursionN]
      • Set DamageEventAmount = LastDmgValue[DmgEvRecursionN]
      • Set DamageEventSource = LastDmgSource[DmgEvRecursionN]
      • Set DamageEventTarget = LastDmgTarget[DmgEvRecursionN]
      • Set IsDamageSpell = LastDmgWasSpell[DmgEvRecursionN]
      • Set DamageEventType = LastDmgPrevType[DmgEvRecursionN]
      • Custom script: endfunction
      • Custom script: function CheckDamagedLifeEvent takes nothing returns nothing
      • Custom script: if udg_DmgEvTrig != null then
      • Custom script: call DestroyTrigger(udg_DmgEvTrig)
      • Custom script: set udg_DmgEvTrig = null
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IsDamageSpell Equal to True
        • Then - Actions
          • Unit - Set life of DamageEventTarget to (Max(LastDamageHP, 0.41))
          • Custom script: if udg_LastDamageHP <= 0.405 then
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DamageEventType Less than 0
            • Then - Actions
              • Unit - Make DamageEventTarget Explode on death
            • Else - Actions
          • Trigger - Turn off DamageEventTrigger
          • -------- Kill the unit --------
          • Custom script: call UnitDamageTarget(udg_DamageEventSource, udg_DamageEventTarget, -999, false, false, null, DAMAGE_TYPE_UNIVERSAL, null)
          • Trigger - Turn on DamageEventTrigger
          • Custom script: endif
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of DamageBlockingAbility for DamageEventTarget) Greater than 0
            • Then - Actions
              • Unit - Remove DamageBlockingAbility from DamageEventTarget
              • Unit - Set life of DamageEventTarget to LastDamageHP
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventAmount Not equal to 0.00
        • Then - Actions
          • Set AfterDamageEvent = 0.00
          • Set AfterDamageEvent = 1.00
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DmgEvRecursionN Greater than 0
        • Then - Actions
          • Custom script: call DmgEvResetVars()
        • Else - Actions
      • Custom script: endif
      • Custom script: endfunction
      • Custom script: function DmgEvOnExpire takes nothing returns nothing
      • Set DmgEvStarted = False
      • Custom script: call CheckDamagedLifeEvent()
      • Custom script: endfunction
      • Custom script: function OnDmgEv takes nothing returns nothing
      • Custom script: local boolean clear = false
      • Custom script: local boolean override = udg_DamageEventOverride
      • Custom script: local code c = function CheckDamagedLifeEvent
      • Custom script: call CheckDamagedLifeEvent() //in case the unit state event failed and the 0.00 second timer hasn't yet expired
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DmgEvRunning Equal to True
        • Then - Actions
          • Set DmgEvRecursionLevel = (DmgEvRecursionLevel + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DmgEvRecursionLevel Less than 16
            • Then - Actions
              • Set LastDmgPrevAmount[DmgEvRecursionN] = DamageEventPrevAmt
              • Set LastDmgValue[DmgEvRecursionN] = DamageEventAmount
              • Set LastDmgSource[DmgEvRecursionN] = DamageEventSource
              • Set LastDmgTarget[DmgEvRecursionN] = DamageEventTarget
              • Set LastDmgWasSpell[DmgEvRecursionN] = IsDamageSpell
              • Set LastDmgPrevType[DmgEvRecursionN] = DamageEventType
              • Set DmgEvRecursionN = (DmgEvRecursionN + 1)
            • Else - Actions
              • -------- Delete the next couple of lines to disable the in-game recursion crash warnings --------
              • Cinematic - Clear the screen of text messages for (All players)
              • Game - Display to (All players) for 999.00 seconds the text: WARNING: Recursion ...
              • Skip remaining actions
        • Else - Actions
          • Set DmgEvRunning = True
          • Custom script: set clear = true
      • Set DamageEventAmount = (Damage taken)
      • Set DamageEventSource = (Damage source)
      • Set DamageEventTarget = (Triggering unit)
      • Set DamageEventPrevAmt = (Abs(DamageEventAmount))
      • Set DamageEventType = NextDamageType
      • Set NextDamageType = 0
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventAmount Equal to 0.00
        • Then - Actions
          • Set DamageEvent = 0.00
          • Set DamageEvent = 2.00
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DmgEvStarted Equal to False
            • Then - Actions
              • Set DmgEvStarted = True
              • Custom script: call TimerStart(udg_DmgEvTimer, 0.00, false, function DmgEvOnExpire)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DamageEventAmount Less than 0.00
            • Then - Actions
              • Set DamageEventAmount = (0.00 - DamageEventAmount)
              • Set IsDamageSpell = True
              • Custom script: call DmgEvAmplifyCheck()
            • Else - Actions
              • Set IsDamageSpell = False
          • Set DamageEventOverride = False
          • Set DamageModifierEvent = 0.00
          • Set DamageModifierEvent = 1.00
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DamageEventOverride Equal to False
            • Then - Actions
              • Set DamageModifierEvent = 2.00
              • Set DamageModifierEvent = 3.00
            • Else - Actions
          • Custom script: set udg_DamageEventOverride = override
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DamageEventAmount Greater than 0.01
            • Then - Actions
              • Set DamageModifierEvent = 4.00
            • Else - Actions
          • Set DamageEvent = 0.00
          • Set DamageEvent = 1.00
          • Custom script: call CheckDamagedLifeEvent() //in case the unit state event failed from a recursive damage event
          • -------- Process damage modification --------
          • Set DmgEvLife = (Life of DamageEventTarget)
          • Custom script: set udg_DmgEvTrig = CreateTrigger()
          • Custom script: call TriggerAddCondition(udg_DmgEvTrig, Filter(c))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IsDamageSpell Equal to False
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DamageEventAmount Not equal to DamageEventPrevAmt
                • Then - Actions
                  • Set DmgEvLife = ((DmgEvLife + DamageEventPrevAmt) - DamageEventAmount)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Max life of DamageEventTarget) Less than DmgEvLife
                    • Then - Actions
                      • Set LastDamageHP = (DmgEvLife - DamageEventPrevAmt)
                      • Unit - Add DamageBlockingAbility to DamageEventTarget
                    • Else - Actions
                  • Unit - Set life of DamageEventTarget to (Max(DmgEvLife, 0.42))
                • Else - Actions
              • Trigger - Add to DmgEvTrig the event (Unit - DamageEventTarget's life becomes Less than (Max(0.41, (DmgEvLife - (DamageEventPrevAmt / 2.00)))))
            • Else - Actions
              • Set LastDamageHP = (Max life of DamageEventTarget)
              • Set DmgEvPrevLife = DmgEvLife
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (DmgEvLife + (DamageEventPrevAmt x 0.75)) Greater than LastDamageHP
                • Then - Actions
                  • Set DmgEvLife = (Max((LastDamageHP - (DamageEventPrevAmt / 2.00)), 1.00))
                  • Unit - Set life of DamageEventTarget to DmgEvLife
                  • Set DmgEvLife = ((DmgEvLife + LastDamageHP) / 2.00)
                • Else - Actions
                  • Set DmgEvLife = (DmgEvLife + (DamageEventPrevAmt x 0.50))
              • Set LastDamageHP = (DmgEvPrevLife - (DamageEventPrevAmt - (DamageEventPrevAmt - DamageEventAmount)))
              • Trigger - Add to DmgEvTrig the event (Unit - DamageEventTarget's life becomes Greater than DmgEvLife)
      • Custom script: if clear then
      • Set DmgEvRunning = False
      • Set DmgEvRecursionLevel = 0
      • Custom script: elseif udg_DamageEventPrevAmt == 0.00 then
      • Custom script: call DmgEvResetVars()
      • Custom script: endif
      • Custom script: endfunction
      • Custom script: function CreateDmgEv takes nothing returns nothing
      • Custom script: local code c = function OnDmgEv
      • Custom script: set udg_DamageEventTrigger = CreateTrigger()
      • Custom script: call TriggerAddCondition(udg_DamageEventTrigger, Filter(c))
      • Custom script: endfunction
      • Custom script: function SetupDmgEv takes nothing returns nothing
      • Custom script: local integer pdex = udg_UDex
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnitIndexEvent Equal to 1.00
        • Then - Actions
          • Set DmgEvUnit = UDexUnits[UDex]
          • Custom script: if DmgEvFilter() then
          • Set UnitDamageRegistered[UDex] = True
          • Trigger - Add to DamageEventTrigger the event (Unit - DmgEvUnit Takes damage)
          • Unit - Add SpellDamageAbility to DmgEvUnit
          • Custom script: call UnitMakeAbilityPermanent(udg_DmgEvUnit, true, udg_SpellDamageAbility)
          • Custom script: endif
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UnitDamageRegistered[UDex] Equal to True
            • Then - Actions
              • Set UnitDamageRegistered[UDex] = False
              • Set DamageEventsWasted = (DamageEventsWasted + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DamageEventsWasted Equal to 32
                • Then - Actions
                  • Set DamageEventsWasted = 0
                  • Custom script: call DestroyTrigger(udg_DamageEventTrigger)
                  • Custom script: call CreateDmgEv()
                  • Set UDex = UDexNext[0]
                  • Custom script: loop
                  • Custom script: exitwhen udg_UDex == 0
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • UnitDamageRegistered[UDex] Equal to True
                    • Then - Actions
                      • Trigger - Add to DamageEventTrigger the event (Unit - UDexUnits[UDex] Takes damage)
                    • Else - Actions
                  • Set UDex = UDexNext[UDex]
                  • Custom script: endloop
                  • Custom script: set udg_UDex = pdex
                • Else - Actions
            • Else - Actions
      • Custom script: endfunction
      • Custom script: function InitDamageEvent takes nothing returns nothing
      • Custom script: local code c = function CheckDamagedLifeEvent
      • Custom script: set udg_ClearDamageEvent = CreateTrigger()
      • Custom script: call TriggerAddCondition(udg_ClearDamageEvent, Filter(c))
      • For each (Integer A) from 1 to 16, do (Actions)
        • Loop - Actions
          • Player - Disable SpellDamageAbility for (Player((Integer A)))
      • Custom script: call CreateDmgEv()
      • Custom script: set c = function SetupDmgEv
      • Set UnitIndexerEnabled = False
      • Custom script: set udg_DmgEvUnit = CreateUnit(Player(15), 'uloc', 0, 0, 0)
      • Set UnitIndexerEnabled = True
      • Unit - Add DamageBlockingAbility to DmgEvUnit
      • Unit - Add SpellDamageAbility to DmgEvUnit
      • Unit - Remove DmgEvUnit from the game
      • Custom script: call TriggerAddCondition(GetTriggeringTrigger(), Filter(c))
      • Trigger - Run (This trigger) (checking conditions)
      • Countdown Timer - Start DmgEvTimer as a One-shot timer that will expire in 0.00 seconds
      • Trigger - Turn off ClearDamageEvent
how do i correct this? should i delete unit event trigger?
 
Status
Not open for further replies.
Top