- Joined
- Jun 16, 2008
- Messages
- 333
I have this jass code that I got from a program to kill when someone touches player 12 for a maze and the it keeps saying there is an error can some one help me with this?
JASS:
function Trig_Collision_UnitCheck takes nothing returns boolean
if GetOwningPlayer(GetFilterUnit()) == Player(11) then
return true
endif
return false
endfunctionfunction Trig_Collision_Actions takes nothing returns nothing
local location p
local unit u
local group g1
local group g2
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 9
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if GetPlayerSlotState(ConvertedPlayer(GetForLoopIndexA())) == PLAYER_SLOT_STATE_PLAYING then
set g1 = GetUnitsOfPlayerAndTypeId(ConvertedPlayer(GetForLoopIndexA()), 'E000')
set u = GroupPickRandomUnit(g1)
set p = GetUnitLoc(u)
set g2 = GetUnitsInRangeOfLocMatching(60.00, p, Condition(function Trig_Collision_UnitCheck))
if GetBooleanAnd(CountUnitsInGroup(g2) > 0, IsUnitAliveBJ(u) ) then
call KillUnit( u)
endif
call RemoveLocation(p)
call DestroyGroup(g1)
call DestroyGroup(g2)
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
function InitTrig_Collision takes nothing returns nothing
set gg_trg_Collision = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Collision, 0.02 )
call TriggerAddAction( gg_trg_Collision, function Trig_Collision_Actions )
endfunction