- Joined
- Sep 26, 2009
- Messages
- 9,547
Before I release this to the public, I would like it if someone can please help me test it. As far as I can tell, the only things that will act up are the standard disclaimers to using physical damage detection: life drain and locust swarm have to be reconfigured and item-based damage reduction has to be triggered.
Full credits to looking_for_help for discovering the physical/spell damage trick and to Nestharus for Damage Event & Adv Damage Event.
Full credits to looking_for_help for discovering the physical/spell damage trick and to Nestharus for Damage Event & Adv Damage Event.
-
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 if you want to differentiate between your triggered damage --------
-


-------- If the DamageEventType is 0, that means it's either regular WC3 damage or you didn't set it before triggering damage --------
-


-------- - --------
-


Set DamageTypeCode = 1
-


-------- - --------
-


Custom script: call ExecuteFunc("InitDamageEvent")
-


Custom script: endfunction
-


-------- The next conditions let you filter out unwanted units. 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
-




(TempUnit is A structure) Equal to False
-
-



Then - Actions
-




Custom script: return true
-
-



Else - Actions
-
-


Custom script: return false
-


Custom script: endfunction
-


-------- This function Amplifies damage as-needed --------
-


Custom script: function DmgEvAmplifyDamage takes nothing returns nothing
-


Custom script: local boolean b = udg_DmgEvLife <= 0.405
-


Custom script: if b then
-


Set DmgEvLife = 0.41
-


Custom script: endif
-


Unit - Set life of DamageEventTarget to DmgEvLife
-


Custom script: if b and udg_IsDamageSpell then
-


Custom script: call SetUnitExploded(udg_DamageEventTarget, udg_DamageEventExplodesUnit)
-


Trigger - Turn off DamageEventTrigger
-


Custom script: call UnitDamageTarget(udg_DamageEventSource, udg_DamageEventTarget, 999, false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, null)
-


Trigger - Turn on DamageEventTrigger
-


Custom script: endif
-


Custom script: endfunction
-


-------- This function handles any max-life related issues that happened in the original damage trigger --------
-


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 + udg_DmgEvR[udg_DmgEvN])
-


Set DmgEvStack[DmgEvN] = No unit
-


Custom script: exitwhen udg_DmgEvN == 0
-


Custom script: endloop
-


Custom script: endfunction
-


-------- Next function sets the damage variables --------
-


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
-


Set DmgEvPreExplodes = DamageEventExplodesUnit
-


Set DmgTypPrev = DamageEventType
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




DamageEventAmount Equal to 0.00
-
-



Then - Actions
-




-------- Fire 0 damage event --------
-




Set DamageEvent = 2.00
-
-



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
-






Set DmgTypPrev = DamageEventType
-
-





Else - Actions
-
-




Set DamageEventPrevAmt = DamageEventAmount
-




Set DamageEventOverride = False
-




-------- Fire damage modifier event, then damage event --------
-




Set DamageModifierEvent = 1.00
-




Set DamageEvent = 1.00
-




Set DmgEvLife = (Life of DamageEventTarget)
-




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
-










DamageEventAmount Greater than DamageEventPrevAmt
-
-









Then - Actions
-










Custom script: call DmgEvAmplifyDamage()
-
-









Else - Actions
-










Unit - Set life of DamageEventTarget to DmgEvLife
-










Set DmgEvMax = (Life of DamageEventTarget)
-










If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-











If - Conditions
-












DmgEvMax Not equal to DmgEvLife
-
-











Then - Actions
-












Set DmgEvMax = (DmgEvMax - DmgEvLife)
-












Custom script: if udg_DmgEvMax <= 0.405 then
-












If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-













If - Conditions
-














(Level of DamageBlockingAbility for DamageEventTarget) Equal to 0
-
-













Then - Actions
-














Unit - Add DamageBlockingAbility to DamageEventTarget
-
-













Else - Actions
-
-












Unit - Set life of DamageEventTarget to DmgEvLife
-












Set DmgEvR[DmgEvN] = 0.00
-












Custom script: else
-












Set DmgEvR[DmgEvN] = (DmgEvLife - DmgEvMax)
-












Custom script: endif
-












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.00, false, function DmgEvRemoveAbilities)
-
-













Else - Actions
-
-
-











Else - Actions
-
-
-
-
-







Else - Actions
-
-
-





Else - Actions
-






Set DmgEvLife = ((DmgEvLife - DamageEventPrevAmt) - DamageEventAmount)
-






Custom script: call DmgEvAmplifyDamage()
-






Set IsDamageSpell = False
-
-
-
-
-


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_DmgEvPreExplodes
-


Custom script: local boolean override = udg_DamageEventOverride
-


Custom script: local boolean spell = udg_IsDamageSpell
-


Custom script: local real prev = udg_DamageEventPrevAmt
-


Set IsDamageSpell = False
-


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_DmgEvPreExplodes = explode
-


Custom script: set udg_DamageEventPrevAmt = prev
-


Custom script: set udg_DmgTypPrev = ptype
-


Custom script: set udg_DamageEventType = ptype
-


Custom script: set udg_DamageEventAmount = d
-


Custom script: set udg_DamageEventSource = s
-


Custom script: set udg_DamageEventTarget = t
-


Custom script: set udg_IsDamageSpell = spell
-


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
-




DamageModifierEvent Equal to 0.00
-
-



Then - Actions
-




Set DmgTypPrev = DamageEventType
-




Custom script: call DmgEvSetVars()
-




Custom script: call FireDmgEv()
-




-------- Reset things --------
-




Set DamageModifierEvent = 0.00
-




Set DamageEvent = 0.00
-




Set DamageEventType = 0
-




Set DamageEventExplodesUnit = False
-
-



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 TempUnit = UDexUnits[UDex]
-




Custom script: if GetUnitAbilityLevel(udg_TempUnit, 'Aloc') == 0 and DmgEvFilter() then
-




Set UnitDamageRegistered[UDex] = True
-




Trigger - Add to DamageEventTrigger the event (Unit - TempUnit Takes damage)
-




Unit - Add SpellDamageAbility to UDexUnits[UDex]
-




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
-


Set DmgEvN = 16
-


Custom script: loop
-


Player - Disable SpellDamageAbility for (Player(DmgEvN))
-


Set DmgEvN = (DmgEvN - 1)
-


Custom script: exitwhen udg_DmgEvN == 0
-


Custom script: endloop
-


Custom script: call CreateDmgEv()
-


Custom script: call TriggerAddCondition(GetTriggeringTrigger(), Filter(function SetupDmgEv))
-


Set UnitIndexerEnabled = False
-


Custom script: set udg_TempUnit = CreateUnit(Player(15), 'uloc', 0, 0, 0)
-


Set UnitIndexerEnabled = True
-


Unit - Add DamageBlockingAbility to TempUnit
-


Unit - Add SpellDamageAbility to TempUnit
-


Unit - Remove TempUnit 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)
-
-
Attachments
Last edited:






