Warcraft III resources & community, 2003–2006 · archived

Slow Units in An AOE

not rated
Submitted by Nantuko_HuskFunctions0 downloads
This slow enemies in an aoe for a percentage of their speed,
e.g

function SlowEnemiesInAoe takes unit EnemiesOfWhom,location where,real aoe,integer duration,real slowing returns nothing

call SlowEnemiesInAoe(X,X,X,X,80) i put x to the other arguments since were not needed here,so you see the 80,that means that will slow units by 80%,50 for 50% etc


EDIT:Requires a global game cache!

Source

function EnemyFiltering takes nothing returns boolean
local integer i=GetStoredIntegerBJ("PlrIndx","sf",udg_GameCache)
return (IsUnitEnemy(GetFilterUnit(),Player((i))))
endfunction
function GAS takes nothing returns nothing
local real s=GetStoredRealBJ("S","sf",udg_GameCache)
local real as=GetUnitMoveSpeed(GetEnumUnit())*(s/100)
call StoreRealBJ(as,"as","sf",udg_GameCache)
call SetUnitMoveSpeed(GetEnumUnit(),GetUnitMoveSpeed(GetEnumUnit())-as)
endfunction
function GAI takes nothing returns nothing
local real as=GetStoredRealBJ("as","sf",udg_GameCache)
call SetUnitMoveSpeed(GetEnumUnit(),GetUnitMoveSpeed(GetEnumUnit())+as)
endfunction
function SlowEnemiesInAoe takes unit EnemiesOfWhom,location where,real aoe,integer duration,real slowing returns nothing
local group g=null
local integer index=(1+GetPlayerId(GetOwningPlayer(EnemiesOfWhom)))
call StoreIntegerBJ(index,"PlrIndx","sf",udg_GameCache)
call StoreRealBJ(slowing,"S","sf",udg_GameCache)
set g=GetUnitsInRangeOfLocMatching(aoe,where,Condition(function EnemyFiltering))
call ForGroupBJ(g,function GAS)
call TriggerSleepAction(R2I(duration))
call ForGroupBJ(g,function GAI)
call FlushStoredMissionBJ("sf",udg_GameCache)
call GroupClear(g)
set g=null
call RemoveLocation(where)
set EnemiesOfWhom=null
endfunction

Comments

0

No comments.