| ID | Effect | ID | Effect | ID | Effect | ID | Effect | ID | Effect |
| 0 | Stun | 1 | Silence | 2 | Disarm (ranged) | 3 | Disarm (meele) | 4 | Disarm (both) |
| 5 | Ensnare | 6 | Supersilence | 7 | Sleep | 8 | Entangle | 9 | Ethereal |
In this example, all Hero units will only be affected for half the duration.
Footmen will be stunned (only stunned) for double the duration.
If a minimum duration has been defined, makes sure it is applied and resets it.
GDS Main Modifier Example

Events

Conditions

Actions


Custom script: local real storeDur = udg_GDS_Duration


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


-------- Declare your preload conditions here --------


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


-------- General Modifications --------


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



If - Conditions




(GDS_Target is A Hero) Equal to True



Then - Actions




Set GDS_Duration = (GDS_Duration / 2.00)




Game - Display to (All players) the text: (String(GDS_Duration))



Else - Actions


-------- Effect Specific Modifications --------


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



If - Conditions




GDS_Type Equal to GDS_cSTUN



Then - Actions




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





If - Conditions






(Unit-type of GDS_Target) Equal to Footman





Then - Actions






Set GDS_Duration = (GDS_Duration x 2.00)





Else - Actions



Else - Actions


-------- Final Modifications --------


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



If - Conditions




GDS_Duration Less than zEXAMPLE_MinDuration



Then - Actions




Set GDS_Duration = zEXAMPLE_MinDuration




Set zEXAMPLE_MinDuration = 0.00




Game - Display to (All players) the text: (String(GDS_Duration))



Else - Actions


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


-------- Run Main after your conditions have been checked --------


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


Trigger - Run GDS Main <gen> (ignoring conditions)


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


-------- Restore duration to old duration (for unit group loops) --------


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


Custom script: set udg_GDS_Duration = storeDur
Set GDS_Type = integer_for_intended_effect
Set GDS_Target = your_unit
Set GDS_Duration = positive_real
Trigger - Run GDS Main Modifier <gen> (ignoring conditions)
Set GDS_Type = your_type
Set GDS_Target = your_unit
Set GDS_Duration = negative_real
Trigger - Run GDS Main <gen> (ignoring conditions)
Set GDS_Type = integer_for_intended_effect
Set GDS_Duration = 0.00
Set GDS Target = your_unit
Trigger - Run GDS Main <gen> (ignoring conditions)
Set GDS_Type = integer_for_intended_effect
Set GDS Target = your_unit
Set GDS_Duration = 0.00
Trigger - Run GDS Main <gen> (ignoring conditions)
Set GDS_Duration = GSS_Remaining + positive_real
Trigger - Run GDS Main Modifier <gen> (ignoring conditions)
'Simply remove the effect buff (GDS_BUFF[your_effect]) from the unit. The timer and hashtable
will be cleaned up when the timer expires. Having a running timer and hashtable data for a unit that is
not affected will not cause any problems for the system. Still, if you want cleanup to be instant, use the
method to the right:'
Set GDS_Type = integer_for_intended_effect
Set GDS_Target = your_unit
Set GDS_Duration = 0.00
Unit - Remove GDS_BUFF[GDS_Type] buff from your_unit
Trigger - Run GDS Main <gen> (ignoring conditions)
Set GDS_Type = integer_for_intended_effect
Set GDS Target = your_unit
Set GDS_Permanent = true
Trigger - Run GDS Main <gen> (ignoring conditions)
Set GDS_RegisterDisable = True
Event Usage

Events


Game - GDS_DebuffEvent becomes Equal to 0.00


Game - GDS_DebuffEvent becomes Equal to 1.00


(...)

Conditions

Actions
Unyielding Resolve

Events


Unit - Tauren Chieftain 0177 <gen> Takes damage

Conditions


(Damage taken) Greater than 0.00


((Triggering unit) has buff GDS_BUFF[GDS_cSTUN]) Equal to True

Actions


Set GDS_Type = GDS_cSTUN


Set GDS_Target = Tauren Chieftain 0177 <gen>


-------- Show time before damage is taken --------


Set GDS_Duration = 0.00


Trigger - Run GDS Main <gen> (ignoring conditions)


Game - Display to (All players) the text: (String(GDS_Remaining))


-------- Reduce time for stun --------


Set GDS_Duration = -5.00


Trigger - Run GDS Main <gen> (ignoring conditions)


-------- Show time after damage is taken --------


Set GDS_Duration = 0.00


Trigger - Run GDS Main <gen> (ignoring conditions)


Game - Display to (All players) the text: (String(GDS_Remaining))
Unleash Madness

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Unleash Madness

Actions


Custom script: local real storeDur = udg_GDS_Duration


Custom script: local integer storeTyp = udg_GDS_Type


Set GDS_Duration = 5.00


Unit Group - Pick every unit in (Units within 500.00 of (Position of (Triggering unit)) matching ((((Owner of (Matching unit)) is an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is A structure) Equal to False))) and do (Actions)



Loop - Actions




Set GDS_Type = (Random integer number between 0 and 9)




Set GDS_Target = (Picked unit)




Trigger - Run GDS Main Modifier <gen> (ignoring conditions)


Custom script: set udg_GDS_Duration = storeDur


Custom script: set udg_GDS_Type = storeTyp
Minimum Duration Stun

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Holy Retribution

Actions


Set GDS_Type = GDS_cSTUN


Set GDS_Duration = 2.00


Set zEXAMPLE_MinDuration = 2.00


Set GDS_Target = (Target unit of ability being cast)


Trigger - Run GDS Main Modifier Example <gen> (ignoring conditions)
GDS Setup

Events


Map initialization

Conditions

Actions


Hashtable - Create a hashtable


Set GDS_Hashtable = (Last created hashtable)


Custom script: call SaveLocationHandle(udg_GDS_Hashtable, 2 , 99 , GetRectCenter(bj_mapInitialPlayableArea))


Set GDS_cSTUN = 0


Set GDS_cSILENCE = 1


Set GDS_cDISARM_R = 2


Set GDS_cDISARM_M = 3


Set GDS_cDISARM_B = 4


Set GDS_cSNARE = 5


Set GDS_cSUPERSILENCE = 6


Set GDS_cSLEEP = 7


Set GDS_cENTANGLE = 8


Set GDS_cETHEREAL = 9


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


-------- SET THE CORRECT PARAMETERS HERE --------


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


Set GDS_ABIL[GDS_cSTUN] = GDS_STUN


Set GDS_BUFF[GDS_cSTUN] = GDS_STUN (Pause)


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


Set GDS_ABIL[GDS_cSILENCE] = GDS_SILENCE


Set GDS_BUFF[GDS_cSILENCE] = GDS_SILENCE


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


Set GDS_ABIL[GDS_cDISARM_R] = GDS_DISARM_R


Set GDS_BUFF[GDS_cDISARM_R] = GDS_DISARM_R


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


Set GDS_ABIL[GDS_cDISARM_M] = GDS_DISARM_M


Set GDS_BUFF[GDS_cDISARM_M] = GDS_DISARM_M


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


Set GDS_ABIL[GDS_cDISARM_B] = GDS_DISARM_BOTH


Set GDS_BUFF[GDS_cDISARM_B] = GDS_DISARM_BOTH


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


Set GDS_ABIL[GDS_cSNARE] = GDS_SNARE


Set GDS_BUFF[GDS_cSNARE] = GDS_SNARE


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


Set GDS_ABIL[GDS_cSUPERSILENCE] = GDS_SUPERSILENCE


Set GDS_BUFF[GDS_cSUPERSILENCE] = GDS_SUPERSILENCE


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


Set GDS_ABIL[GDS_cSLEEP] = GDS_SLEEP


Set GDS_BUFF[GDS_cSLEEP] = GDS_SLEEP


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


Set GDS_ABIL[GDS_cENTANGLE] = GDS_ENTANGLE


Set GDS_BUFF[GDS_cENTANGLE] = GDS_ENTANGLE


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


Set GDS_ABIL[GDS_cETHEREAL] = GDS_ETHEREAL


Set GDS_BUFF[GDS_cETHEREAL] = GDS_ETHEREAL


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


For each (Integer A) from 0 to 9, do (Actions)



Loop - Actions




Unit - Create 1 GDS_Dummy for Neutral Passive at (Load 99 of 2 in GDS_Hashtable) facing Default building facing degrees




Unit - Add GDS_ABIL[(Integer A)] to (Last created unit)




Set GDS_DUMMY[(Integer A)] = (Last created unit)


Custom script: call RemoveLocation(LoadLocationHandle(udg_GDS_Hashtable, 2, 99))


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


-------- YOU SHOULDN'T TOUCH ANYTHING BELOW THIS --------


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


-------- Order Strings --------


Set GDS_ORDERS[0] = thunderbolt


Set GDS_ORDERS[1] = soulburn


Set GDS_ORDERS[2] = drunkenhaze


Set GDS_ORDERS[3] = drunkenhaze


Set GDS_ORDERS[4] = drunkenhaze


Set GDS_ORDERS[5] = ensnare


Set GDS_ORDERS[6] = doom


Set GDS_ORDERS[7] = sleep


Set GDS_ORDERS[8] = entanglingroots


Set GDS_ORDERS[9] = banish


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


Player Group - Make (All players) treat (Player group((Owner of GDS_DUMMY[0]))) as an Neutral with shared vision


Set GDS_DebuffEvent = 0.40


Custom script: set udg_GDS_zMIN = 0.006


Skip remaining actions


Set GDS_Duration = 0.00


Set GDS_Remaining = 0.00


Set GDS_Target = No unit


Set GDS_Type = 0


Set GDS_zMIN = 0.00


Set GDS_Permanent = False


Set GDS_RegisterDisable = False
function GDSDebuffApplied takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer tHandle = GetHandleId(t)
local integer stunType = LoadInteger(udg_GDS_Hashtable, tHandle , 1)
local unit u = LoadUnitHandle(udg_GDS_Hashtable, tHandle , 0)
if GetUnitAbilityLevel( u , udg_GDS_BUFF[stunType]) != 0 then
call FlushChildHashtable(udg_GDS_Hashtable, GetHandleId(t))
call PauseTimer(t)
call DestroyTimer(t)
set udg_GDS_DebuffEvent = stunType
set udg_GDS_Target = u
set udg_GDS_DebuffEvent = 0.5
else
call TimerStart(t, udg_GDS_zMIN, false, function GDSDebuffApplied)
endif
set u = null
set t = null
endfunction
function GDSDebuffEnd takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer tHandle = GetHandleId(t)
local integer stunType = LoadInteger(udg_GDS_Hashtable, tHandle , 2)
local unit u = LoadUnitHandle(udg_GDS_Hashtable, tHandle , 0)
local integer uHandle = LoadInteger(udg_GDS_Hashtable, tHandle , 1)
call UnitRemoveAbility(u, udg_GDS_BUFF[stunType])
call FlushChildHashtable(udg_GDS_Hashtable, GetHandleId(t))
call PauseTimer(t)
call DestroyTimer(t)
call RemoveSavedHandle(udg_GDS_Hashtable, uHandle , stunType)
set u = null
set t = null
endfunction
function GDSMain takes nothing returns nothing
local timer t
local timer timerOld = LoadTimerHandle(udg_GDS_Hashtable, GetHandleId(udg_GDS_Target) , udg_GDS_Type )
local real duration = udg_GDS_Duration
local boolean hadTimer = timerOld != null
set udg_GDS_Remaining = TimerGetRemaining(timerOld)
//Check if user wants a permanent debuff
if udg_GDS_Permanent then
set udg_GDS_Permanent = false
if hadTimer then
call FlushChildHashtable(udg_GDS_Hashtable, GetHandleId(timerOld))
call PauseTimer(timerOld)
call DestroyTimer(timerOld)
call RemoveSavedHandle(udg_GDS_Hashtable, GetHandleId(udg_GDS_Target) , udg_GDS_Type)
set timerOld = null
else
if IssueTargetOrder( udg_GDS_DUMMY[udg_GDS_Type], udg_GDS_ORDERS[udg_GDS_Type], udg_GDS_Target ) or GetUnitAbilityLevel(udg_GDS_Target , udg_GDS_BUFF[udg_GDS_Type]) != 0 then
set udg_GDS_Remaining = -1 //-1 for infinite duration
else
set udg_GDS_Remaining = 0
endif
endif
if udg_GDS_RegisterDisable then
set t = CreateTimer()
call SaveUnitHandle(udg_GDS_Hashtable, GetHandleId(t) , 0 , udg_GDS_Target)
call SaveInteger(udg_GDS_Hashtable , GetHandleId(t) , 1 , udg_GDS_Type)
call TimerStart(t, udg_GDS_zMIN, false, function GDSDebuffApplied)
set t = null
endif
return
endif
//Check if user wants to reduce duration of stun (check for negative duration)
if duration < -udg_GDS_zMIN and udg_GDS_Remaining > udg_GDS_zMIN then //Check for reduction
if -duration > udg_GDS_Remaining then //Check if reduction goes below 0
call UnitRemoveAbility(udg_GDS_Target , udg_GDS_BUFF[udg_GDS_Type])
set duration = 0
else
set duration = udg_GDS_Remaining - duration //Change duration so it passes the checks
endif
endif
//Check if the desired duration is higher than remaining time
if udg_GDS_Remaining < duration and duration > udg_GDS_zMIN and hadTimer then
if hadTimer then
set t = timerOld
else
set t = CreateTimer()
set timerOld = null
endif
else
//Check if unit has buff, clean hashtable, destroy timer and set remaining time to 0
if GetUnitAbilityLevel(udg_GDS_Target, udg_GDS_BUFF[udg_GDS_Type]) == 0 then
call FlushChildHashtable(udg_GDS_Hashtable, GetHandleId(timerOld))
call PauseTimer(timerOld)
call DestroyTimer(timerOld)
call RemoveSavedHandle(udg_GDS_Hashtable, GetHandleId(udg_GDS_Target) , udg_GDS_Type)
set timerOld = null
if duration < udg_GDS_zMIN then
set udg_GDS_Remaining = 0
return
endif
set t = CreateTimer()
else
if hadTimer then
set timerOld = null
else
set udg_GDS_Remaining = -1
endif
return
endif
endif
//Check was successful, proceed to attempt to stun
if not IssueTargetOrder( udg_GDS_DUMMY[udg_GDS_Type], udg_GDS_ORDERS[udg_GDS_Type], udg_GDS_Target ) and GetUnitAbilityLevel(udg_GDS_Target , udg_GDS_BUFF[udg_GDS_Type]) == 0 then
set timerOld = null
set udg_GDS_Remaining = 0
return //unable to stun, do nothing
endif
//Check again for duration reduction (negative duration)
if udg_GDS_Duration < 0 then
set duration = duration + 2*udg_GDS_Duration //Change duration to reduced duration
endif
//Save Hashtable values only if a new timer has been created
if not hadTimer then
call SaveUnitHandle(udg_GDS_Hashtable, GetHandleId(t) , 0 , udg_GDS_Target)
call SaveInteger(udg_GDS_Hashtable , GetHandleId(t) , 1 , GetHandleId(udg_GDS_Target))
call SaveInteger(udg_GDS_Hashtable , GetHandleId(t) , 2 , udg_GDS_Type)
call SaveTimerHandle(udg_GDS_Hashtable, GetHandleId(udg_GDS_Target) , udg_GDS_Type , t)
endif
call TimerStart(t, duration , false, function GDSDebuffEnd)
set udg_GDS_Remaining = duration
if udg_GDS_RegisterDisable then
set t = CreateTimer()
call SaveUnitHandle(udg_GDS_Hashtable, GetHandleId(t) , 0 , udg_GDS_Target)
call SaveInteger(udg_GDS_Hashtable , GetHandleId(t) , 1 , udg_GDS_Type)
call TimerStart(t, 2*udg_GDS_zMIN, false, function GDSDebuffApplied)
endif
set timerOld = null
set t = null
endfunction
//===========================================================================
function InitTrig_GDS_Main takes nothing returns nothing
set gg_trg_GDS_Main = CreateTrigger( )
call TriggerAddAction( gg_trg_GDS_Main, function GDSMain )
endfunction