globals
integer LAVA_TYPE = 'Dlav' // id for dungeon - lava
real LAVA_DAMAGE = 55.
group LS_GROUP = CreateGroup()
hashtable LS_HASH = InitHashtable()
endglobals
function remove takes nothing returns nothing
local timer t = GetExpiredTimer()
call GroupRemoveUnit(LS_GROUP,LoadUnitHandle(LS_HASH,GetHandleId(t),0))
call DestroyTimer(t)
set t = null
endfunction
function damage takes nothing returns boolean
local unit u = GetFilterUnit()
local timer t = CreateTimer()
if IsUnitInGroup(u,LS_GROUP) == false and GetWidgetLife(u) > 0.405 and GetTerrainType(GetUnitX(u),GetUnitY(u)) == LAVA_TYPE then
call GroupAddUnit(LS_GROUP,u)
call UnitDamageTarget(u,u,LAVA_DAMAGE,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null)
call SaveUnitHandle(LS_HASH,GetHandleId(t),0,u)
call TimerStart(t,1.,false,function remove)
endif
set u = null
set t = null
return false
endfunction
function init takes nothing returns nothing
local group g = CreateGroup()
call GroupEnumUnitsInRect(g,GetWorldBounds(),Condition(function damage))
call DestroyGroup(g)
set g = null
endfunction
function InitTrig_LavaStep takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t,0.1,true)
call TriggerAddAction(t,function init)
set t = null
endfunction