function H2I takes handle h returns integer
return h
return 0
endfunction
function Cache takes nothing returns gamecache
if udg_Cache == null then
set udg_Cache = InitGameCache("Cache.w3v")
return udg_Cache
endif
return udg_Cache
endfunction
function StoreHandleInHandle takes handle stored,handle storer,string category returns nothing
call StoreInteger(Cache() , I2S(H2I(storer)) , category , H2I(stored))
endfunction
function StoreBooleanInHandle takes boolean stored,handle storer,string category returns nothing
call StoreBoolean(Cache() , I2S(H2I(storer)) , category , stored)
endfunction
function GetUnit takes handle storer,string category returns unit
return GetStoredInteger(Cache() , I2S(H2I(storer)) , category)
return null
endfunction
function GetTrigger takes handle storer,string category returns trigger
return GetStoredInteger(Cache() , I2S(H2I(storer)) , category)
return null
endfunction
function GetBoolean takes handle storer,string category returns boolean
return GetStoredBoolean(Cache() , I2S(H2I(storer)) , category)
endfunction
function Flush takes handle storer returns nothing
call FlushStoredMission(Cache() , I2S(H2I(storer)))
endfunction
//===========Storing stuff===========
function CinematicFilterGenericForPlayer takes player whichPlayer,real duration,blendmode bmode,string tex,real red0,real green0,real blue0,real trans0,real red1,real green1,real blue1,real trans1 returns nothing
if ( GetLocalPlayer() == whichPlayer ) then
call SetCineFilterTexture(tex)
call SetCineFilterBlendMode(bmode)
call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
call SetCineFilterStartUV(0 , 0 , 1 , 1)
call SetCineFilterEndUV(0 , 0 , 1 , 1)
call SetCineFilterStartColor(PercentTo255(red0) , PercentTo255(green0) , PercentTo255(blue0) , PercentTo255(100 - trans0))
call SetCineFilterEndColor(PercentTo255(red1) , PercentTo255(green1) , PercentTo255(blue1) , PercentTo255(100 - trans1))
call SetCineFilterDuration(duration)
call DisplayCineFilter(true)
endif
endfunction
function Remove_child takes nothing returns nothing
local timer t= GetExpiredTimer()
local unit u= GetUnit(t , "u")
call RemoveUnit(u)
set u = null
call Flush(t)
call PauseTimer(t)
call DestroyTimer(t)
endfunction
function RemoveUnitTimed takes unit u,real time returns nothing
local timer t= CreateTimer()
call StoreHandleInHandle(u , t , "u")
call TimerStart(t , time , false , function Remove_child)
set t = null
endfunction
function Headshot takes nothing returns nothing
local sound s= gg_snd_Headshot
call StartSound(s)
set s = null
endfunction
//===========Movement stuff===========
function Movement_Conditions takes nothing returns boolean
local integer oid= GetIssuedOrderId()
local unit u= GetTriggerUnit()
local boolean b= GetBoolean(u , "m")
if b == true then
set u = null
return ( oid == 851971 or oid == 851986 or oid == 851983 or oid == 851990 )
endif
set u = null
return false
endfunction
function Stop_Movement_Child takes nothing returns nothing
local timer t= GetExpiredTimer()
local unit u= GetUnit(t , "u")
call IssueImmediateOrder(u , "stop")
call Flush(t)
call DestroyTimer(t)
set u = null
endfunction
function Stop_Movement takes nothing returns nothing
local unit u= GetTriggerUnit()
local timer t= CreateTimer()
call StoreHandleInHandle(u , t , "u")
call TimerStart(t , 0. , false , function Stop_Movement_Child)
set u = null
set t = null
endfunction
function Enable_Movement takes unit u returns nothing
local trigger t= GetTrigger(u , "mt")
if t == null then
else
call StoreBooleanInHandle(false , u , "m")
endif
set t = null
endfunction
function Disable_Movement takes unit u returns nothing
local trigger t= GetTrigger(u , "mt")
if t == null then
else
call StoreBooleanInHandle(true , u , "m")
endif
set t = null
endfunction
function Toogle_Movement takes unit u returns nothing
local trigger t= CreateTrigger()
call TriggerAddCondition(t , Condition(function Movement_Conditions))
call TriggerAddAction(t , function Stop_Movement)
call TriggerRegisterUnitEvent(t , u , EVENT_UNIT_ISSUED_POINT_ORDER)
call StoreHandleInHandle(t , u , "mt")
set t = null
endfunction