//TESH.scrollpos=0
//TESH.alwaysfold=0
Name | Type | is_array | initial_value |
DEMO_GROUP | group | No | |
DEMO_POINT | location | No | |
DEMO_UNIT | unit | No | |
STE_ADD_STUN | boolean | No | |
STE_CASTER | unit | No | |
STE_DURATION | real | No | |
STE_MAX | integer | No | |
STE_STACK_TIME | boolean | No | |
STE_TARGET | unit | No | |
STE_TIMER | timer | No | |
STE_TRACK | real | Yes | |
STE_TRIGGER | trigger | No | |
STE_UNIT | unit | Yes | |
UDex | integer | No | |
UDexGen | integer | No | |
UDexNext | integer | Yes | |
UDexPrev | integer | Yes | |
UDexRecycle | integer | No | |
UDexUnits | unit | Yes | |
UDexWasted | integer | No | |
UnitIndexerEnabled | boolean | No | |
UnitIndexEvent | real | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
/*************************************************************************************
*
* Stun Engine FAQ
*
**************************************************************************************
*
* Stun Engine requires any Unit Indexer.
*
* Do not change the trigger name "Stun Engine" in any case.
*
**************************************************************************************
*
* Import instructions:
*
* 1. Make sure File --> Preferences --> "Automatically create unknow variables while pasting trigger data" is check marked.
* 2. Copy the unit DummyCaster, the spell Stun(Stun Engine) and the buff Stunned(Stun Engine) into your map.
* 3. Copy the Stun Engine trigger into your map.
* 4. Go throught the settings in the GUI Stun Engine.
*
StunEngineAccuracy:
*
* Represents the looping interval of the timer. Smaller values result in better precision.
* Using a custom script will allow you
* to set the value to 0.03125 instead of just 0.03
* 1/0.03125 = 32 while 1/0.03 = 33.33333
* With an interval of 0.03125 you can track full seconds, which is a big advantage in terms of stun accuracy.
*
*************************************************************************************
*
* How to use:
*
* 1. set STE_TARGET to the unit, which should be stunned
* 2. set STE_DURATION to the desired stun duration.
* 3. set STE_STACK to true or false
* 4. set STE_ADD_STUN to false to remove the stun
* 4. start the stun with: call TriggerEvaluate(udg_STE_TRIGGER) or (slower) call ExecuteFunc("EvaluateStunEngine")
*
* AllowStack:
*
* true: A unit is stunned by the stun engine for 2 seconds. A second stun is applied for 1 second --> The unit is stunned for 3 seconds.
*
* false: A unit is stunned by the stun engine for 2 seconds. A second stun is applied for 1 second --> The unit is still stunned for 2 seconds.
* false: A unit is stunned by the stun engine for 1 seconds. A second stun is applied for 2 second --> The unit is now stunned for 2 seconds.
*
**************************************************************************************************************************
//TESH.scrollpos=70
//TESH.alwaysfold=0
//Stun Engine v.1.1
//******************************************************************************************************
//*
//* Apply or remove stuns to units. GUI friendly.
//*
//* This systme only works if the Trigger has the excact name: Stun Engine
//* --> Information: The intializer function InitTrig_Stun_Engine doesn't work for a different trigger name.
//*
//******************************************************************************************************
//*
//* API
//*
//* STE_DURATION --> desired stun duration
//* STE_TARGET --> will get stunned.
//* STE_ADD_STUN --> set this to false to remove a stun
//* STE_STACK --> set this to true to stack stun times.
//*
//* Execute the stun with
//*
//* call TriggerEvaluate(udg_STE_TRIGGER)
//*
//******************************************************************************************************
//*
//* SETTINGS
//*
constant function StunEngineDummyId takes nothing returns integer
return 'n000'
endfunction
constant function StunEngineAbility takes nothing returns integer
return 'A000'
endfunction
constant function StunEngineBuff takes nothing returns integer
return 'B000'
endfunction
constant function StunEngineAccuracy takes nothing returns real
return 0.031250000
endfunction
//OrderId used for "stomp"
constant function StunEngineAbilityOrder takes nothing returns integer
return 852127
endfunction
//*
//* END OF SETTINGS
//*
//*******************************************************************************************************
function StunEnginePeriodic takes nothing returns nothing
local integer i = 0
local integer index
loop
exitwhen i == udg_STE_MAX
set index = GetUnitUserData(udg_STE_UNIT[i])
if (0.00 < udg_STE_TRACK[index]) and (0 < GetUnitAbilityLevel(udg_STE_UNIT[i], StunEngineBuff())) then
set udg_STE_TRACK[index] = udg_STE_TRACK[index] - StunEngineAccuracy()
else
call UnitRemoveAbility(udg_STE_UNIT[i], StunEngineBuff())
set udg_STE_TRACK[index] = 0.00
set udg_STE_MAX = udg_STE_MAX - 1
set udg_STE_UNIT[i] = udg_STE_UNIT[udg_STE_MAX]
set udg_STE_UNIT[udg_STE_MAX] = null
set i = i - 1
if (0 == udg_STE_MAX) then
call PauseTimer(udg_STE_TIMER)
endif
endif
set i = i + 1
endloop
endfunction
function EvaluateStunEngine takes nothing returns boolean
local integer index = GetUnitUserData(udg_STE_TARGET)
if (udg_STE_ADD_STUN) then
if (0.00 < udg_STE_DURATION) then
if udg_STE_STACK_TIME then
set udg_STE_TRACK[index] = udg_STE_TRACK[index] + udg_STE_DURATION
elseif (udg_STE_TRACK[index] < udg_STE_DURATION) then
set udg_STE_TRACK[index] = udg_STE_DURATION
endif
if (0 == GetUnitAbilityLevel(udg_STE_TARGET, StunEngineBuff())) then
call SetUnitX(udg_STE_CASTER, GetUnitX(udg_STE_TARGET))
call SetUnitY(udg_STE_CASTER, GetUnitY(udg_STE_TARGET))
call IssueImmediateOrderById(udg_STE_CASTER, StunEngineAbilityOrder())
call SetUnitPosition(udg_STE_CASTER ,2147483647,2147483647)
if (0 == udg_STE_MAX) then
call TimerStart(udg_STE_TIMER, StunEngineAccuracy(), true, function StunEnginePeriodic)
endif
set udg_STE_UNIT[udg_STE_MAX] = udg_STE_TARGET
set udg_STE_MAX = udg_STE_MAX + 1
endif
endif
else
call UnitRemoveAbility(udg_STE_TARGET, StunEngineBuff())
set udg_STE_TRACK[index] = 0.00
endif
set udg_STE_TARGET = null
set udg_STE_DURATION = 0.00
return false
endfunction
function InitTrig_Stun_Engine takes nothing returns nothing
set udg_STE_TRIGGER = CreateTrigger()
call TriggerAddCondition(udg_STE_TRIGGER, Condition(function EvaluateStunEngine))
set udg_STE_CASTER = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), StunEngineDummyId(), 0.,0.,0.)
call UnitAddAbility(udg_STE_CASTER, StunEngineAbility())
call UnitAddAbility(udg_STE_CASTER, 'Aloc')
call SetUnitPosition(udg_STE_CASTER ,2147483647,2147483647)
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
//===========================================================================
function InitTrig_Hello_Message takes nothing returns nothing
local player p = GetLocalPlayer()
call DisplayTimedTextToPlayer(p,0,0,20, "Press |cffdaa520ESC|r to stun the Paladin for 1.2 seconds (stacks)" )
call DisplayTimedTextToPlayer(p,0,0,20, "|cffdaa520Select|r the Paladin to stun all unit around him in an aoe of 250 (doesn't stack)" )
call DisplayTimedTextToPlayer(p,0,0,20, "|cffdaa520Select|r a non hero unit to remove the stun")
set p = null
endfunction