[trigger=Init]DP Config
Events
Map initialization
Conditions
Actions
Custom script: set udg_DP_Hash = InitHashtable()
-------- CONFIGURATION --------
-------- Determines the base radius --------
Set DP_BaseRadius = 500.00
-------- Determines the growth speed of the radius --------
Set DP_BaseSpeed = 50.00
Set DP_Speed = (DP_BaseSpeed x 0.04)
-------- Determines the damage --------
Set DP_Damage[1] = 15.00
Set DP_Damage[2] = 20.00
Set DP_Damage[3] = 25.00
-------- Determines the mana regen --------
Set DP_Mana[1] = 10.00
Set DP_Mana[2] = 15.00
Set DP_Mana[3] = 20.00
-------- Determines the duration of the orb --------
Set DP_Duration[1] = 5.00
Set DP_Duration[2] = 7.50
Set DP_Duration[3] = 10.00
-------- Determines how many lightnings in the radius --------
Set DP_Sides = 12
-------- Determines the distance between each lightning(by degrees) --------
Set DP_Degrees = 30.00
-------- SFX --------
-------- Determines the lightning for the radius --------
Set DP_RadiusLModel = HWSB
-------- Determines the lightning for the possessions --------
Set DP_UnitLModel = CLSB
-------- Determines the height of the lightnings (from the orb) --------
Set DP_Height = 75.00
-------- Determines the height of the lightning (from the possessed unit) --------
Set DP_Height_2 = 75.00
-------- Determines the coloration of radius lightning --------
-------- Red --------
Set DP_RadiusColor[1] = 1.00
-------- Green --------
Set DP_RadiusColor[2] = 0.00
-------- Blue --------
Set DP_RadiusColor[3] = 1.00
-------- Determines the color of the possessed ally --------
-------- Red --------
Set DP_AllyColor[1] = 0.00
-------- Green --------
Set DP_AllyColor[2] = 0.00
-------- Blue --------
Set DP_AllyColor[3] = 1.00
-------- Determines the color of the possessed enemy --------
-------- Red --------
Set DP_EnemyColor[1] = 1.00
-------- Green --------
Set DP_EnemyColor[2] = 1.00
-------- Blue --------
Set DP_EnemyColor[3] = 0.00
-------- SFX --------
Set DP_OrbSFX = Abilities\Spells\Human\Feedback\ArcaneTowerAttack.mdl
[/trigger][trigger=Cast]DP Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Dark Possession
Actions
-------- VARIABLES --------
Set DP_Caster = (Triggering unit)
Set DP_TargetLoc = (Target point of ability being cast)
Set DP_Levels = (Level of Dark Possession for DP_Caster)
Set DP_CurrentRadius = DP_BaseRadius
-------- Creating Orb --------
Unit - Create 1 DP Dummy for (Owner of DP_Caster) at DP_TargetLoc facing Default building facing degrees
Set DP_Orb = (Last created unit)
Custom script: set udg_DP_OrbKey = GetHandleId(udg_DP_Orb)
-------- Adding Duration --------
Unit - Add a DP_Duration[DP_Levels] second Generic expiration timer to (Last created unit)
-------- Creating Lightning radius --------
For each (Integer A) from 1 to DP_Sides, do (Actions)
Loop - Actions
-------- Variables --------
Set DP_TotalSides = (Integer A)
-------- Offset of Lightning --------
Set DP_Offset = (DP_TargetLoc offset by DP_BaseRadius towards ((Real(DP_TotalSides)) x DP_Degrees) degrees)
-------- Creating Lightning --------
-------- From Orb --------
Custom script: set udg_DP_OrbX = GetUnitX(udg_DP_Orb)
Custom script: set udg_DP_OrbY = GetUnitY(udg_DP_Orb)
Custom script: set udg_DP_OrbZ = GetUnitFlyHeight(udg_DP_Orb) + udg_DP_Height
-------- To the Offset --------
Custom script: set udg_DP_OffsetX = GetLocationX(udg_DP_Offset)
Custom script: set udg_DP_OffsetY = GetLocationY(udg_DP_Offset)
Custom script: set udg_DP_OffsetZ = GetLocationZ(udg_DP_Offset) + udg_DP_Height
-------- Creating Lightning --------
Custom script: set udg_DP_LightningRadius[udg_DP_TotalSides] = AddLightningEx(udg_DP_RadiusLModel,true,udg_DP_OrbX,udg_DP_OrbY,udg_DP_OrbZ,udg_DP_OffsetX,udg_DP_OffsetY,udg_DP_OffsetZ)
-------- Changing Color --------
Lightning - Change color of DP_LightningRadius[DP_TotalSides] to (DP_RadiusColor[1] DP_RadiusColor[2] DP_RadiusColor[3]) with 1.00 alpha
-------- Saving Lightning --------
Hashtable - Save Handle OfDP_LightningRadius[DP_TotalSides] as DP_TotalSides of DP_OrbKey in DP_Hash
-------- Clean up leak --------
Custom script: call RemoveLocation(udg_DP_Offset)
-------- Saving Variables --------
Hashtable - Save DP_Levels as (Key level) of DP_OrbKey in DP_Hash
Hashtable - Save DP_CurrentRadius as (Key radius) of DP_OrbKey in DP_Hash
-------- Starts Loop --------
Unit Group - Add DP_Orb to DP_Orbs
Trigger - Turn on DP Loop <gen>
-------- Clean Up --------
Custom script: call RemoveLocation(udg_DP_TargetLoc)
[/trigger][trigger=Loop]DP Loop
Events
Time - Every 0.04 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in DP_Orbs and do (Actions)
Loop - Actions
Set DP_Picked = (Picked unit)
Custom script: set udg_DP_PickedKey = GetHandleId(udg_DP_Picked)
-------- Load --------
Set DP_CurrentRadius = (Load (Key radius) of DP_PickedKey from DP_Hash)
Set DP_Levels = (Load (Key level) of DP_PickedKey from DP_Hash)
-------- Checking --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(DP_Picked is alive) Equal to True
Then - Actions
-------- Variables --------
Set DP_OrbLoc = (Position of DP_Picked)
-------- Variables for Lightnings --------
-------- From Orb --------
Custom script: set udg_DP_TempX = GetUnitX(udg_DP_Picked)
Custom script: set udg_DP_TempY = GetUnitY(udg_DP_Picked)
Custom script: set udg_DP_TempZ = GetUnitFlyHeight(udg_DP_Picked) + udg_DP_Height
-------- Moving Lightnings --------
For each (Integer A) from 1 to DP_Sides, do (Actions)
Loop - Actions
Set DP_TotalSides = (Integer A)
Set DP_TempOffset = (DP_OrbLoc offset by DP_CurrentRadius towards ((Real(DP_TotalSides)) x DP_Degrees) degrees)
-------- Destroying Lightnings --------
Lightning - Destroy (Load DP_TotalSides of DP_PickedKey in DP_Hash)
-------- Variables for Lightnings --------
Custom script: set udg_DP_LTempX = GetLocationX(udg_DP_TempOffset)
Custom script: set udg_DP_LTempY = GetLocationY(udg_DP_TempOffset)
Custom script: set udg_DP_LTempZ = GetLocationZ(udg_DP_TempOffset) + udg_DP_Height
-------- Moving Lightnings --------
Custom script: set udg_DP_LightningRadius[udg_DP_TotalSides] = AddLightningEx(udg_DP_RadiusLModel,true,udg_DP_TempX,udg_DP_TempY,udg_DP_TempZ,udg_DP_LTempX,udg_DP_LTempY,udg_DP_LTempZ)
-------- SFX --------
Special Effect - Create a special effect at DP_TempOffset using DP_OrbSFX
Special Effect - Destroy (Last created special effect)
-------- Changing Color --------
Lightning - Change color of DP_LightningRadius[DP_TotalSides] to (DP_RadiusColor[1] DP_RadiusColor[2] DP_RadiusColor[3]) with 1.00 alpha
-------- Saving Lightning --------
Hashtable - Save Handle OfDP_LightningRadius[DP_TotalSides] as DP_TotalSides of DP_PickedKey in DP_Hash
-------- Clean Leak --------
Custom script: call RemoveLocation(udg_DP_TempOffset)
-------- Starts Picking Units --------
-------- But First Let's Destroy All Lightnings Before(except Radius) --------
For each (Integer DP_Count) from 13 to (Load (Key count) of DP_PickedKey from DP_Hash), do (Actions)
Loop - Actions
Lightning - Destroy (Load DP_Count of DP_PickedKey in DP_Hash)
-------- Reseting Counter --------
Set DP_Count = 12
-------- Why 12?because we have already have a file of it --------
-------- Starts Picking Units --------
Set DP_TempGroup[1] = (Units within DP_CurrentRadius of DP_OrbLoc)
Unit Group - Pick every unit in DP_TempGroup[1] and do (Actions)
Loop - Actions
Set DP_U = (Picked unit)
-------- Checking --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
((Matching unit) is A structure) Not equal to True
(DP_U is Magic Immune) Not equal to True
(DP_U is alive) Equal to True
Then - Actions
-------- Counting Units --------
Set DP_Count = (DP_Count + 1)
-------- Variables for Lightnings --------
Custom script: set udg_DP_UX = GetUnitX(udg_DP_U)
Custom script: set udg_DP_UY = GetUnitY(udg_DP_U)
Custom script: set udg_DP_UZ = GetUnitFlyHeight(udg_DP_U) + udg_DP_Height_2
-------- Creating Lightings --------
Custom script: set udg_DP_ULightning = AddLightningEx(udg_DP_UnitLModel,true,udg_DP_TempX,udg_DP_TempY,udg_DP_TempZ,udg_DP_UX,udg_DP_UY,udg_DP_UZ)
-------- Checking --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(DP_U belongs to an enemy of (Owner of DP_Picked)) Equal to True
Then - Actions
-------- Changing Color --------
Lightning - Change color of DP_ULightning to (DP_EnemyColor[1] DP_EnemyColor[2] DP_EnemyColor[3]) with 1.00 alpha
-------- Damaging Unit --------
Set DP_TempGroup[2] = (Units within DP_CurrentRadius of DP_OrbLoc matching (((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is Magic Immune) Not equal to True)) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of
Set DP_DamageLoop = ((DP_Damage[DP_Levels] x (Real((Number of units in DP_TempGroup[2])))) x 0.04)
Unit - Cause DP_Picked to damage DP_U, dealing DP_DamageLoop damage of attack type Spells and damage type Normal
-------- Clean Leak --------
Custom script: call DestroyGroup(udg_DP_TempGroup[2])
Else - Actions
-------- Changing Color --------
Lightning - Change color of DP_ULightning to (DP_AllyColor[2] DP_AllyColor[2] DP_AllyColor[3]) with 1.00 alpha
-------- Regaining Mana --------
Set DP_TempGroup[3] = (Units within DP_CurrentRadius of DP_OrbLoc matching (((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is Magic Immune) Not equal to True)) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of
Set DP_ManaCurrent = (Mana of DP_U)
Set DP_ManaRegen = (((Real((Number of units in DP_TempGroup[3]))) x DP_Mana[DP_Levels]) x 0.04)
Unit - Set mana of DP_U to ((Max mana of DP_U) + DP_ManaRegen)
-------- Clean Leak --------
Custom script: call DestroyGroup(udg_DP_TempGroup[3])
-------- Saving Lightnings --------
Hashtable - Save Handle OfDP_ULightning as DP_Count of DP_PickedKey in DP_Hash
Else - Actions
-------- Saving Variable --------
Hashtable - Save (DP_CurrentRadius + DP_Speed) as (Key radius) of DP_PickedKey in DP_Hash
Hashtable - Save DP_Count as (Key count) of DP_PickedKey in DP_Hash
-------- Cleaning Leaks --------
Custom script: call RemoveLocation(udg_DP_OrbLoc)
Custom script: call DestroyGroup(udg_DP_TempGroup[1])
Else - Actions
-------- CLEAN UP --------
-------- Destroying All Lightnings --------
For each (Integer DP_Count) from 13 to (Load (Key count) of DP_PickedKey from DP_Hash), do (Actions)
Loop - Actions
Lightning - Destroy (Load DP_Count of DP_PickedKey in DP_Hash)
For each (Integer A) from 1 to DP_Sides, do (Actions)
Loop - Actions
Lightning - Destroy (Load (Integer A) of DP_PickedKey in DP_Hash)
Hashtable - Clear all child hashtables of child DP_PickedKey in DP_Hash
Unit Group - Remove DP_Picked from DP_Orbs
Unit - Remove DP_Picked from the game
-------- Checking --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(DP_Orbs is empty) Equal to True
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
[/trigger]