scope Tests initializer Init
globals
endglobals
private function P2S takes player p returns string //I used only p1, p7, and np/nh in these tests...
// I also tried it with pink and gray and it worked, so it should probably work with everything else
if p == Player(0) then
return "Player 1 (Red)"
elseif p == Player(7) then
return "Player 7 (Green)"
elseif p == Player(15) then
return "Neutral Passive"
endif
return "Unknown Player"
endfunction
private function B2S takes boolean b returns string
if b then
return "true"
endif
return "false"
endfunction
private function Act takes nothing returns nothing
local group g = CreateGroup()
call GroupAddUnit(g,gg_unit_opeo_0002) //peon 1
call GroupAddUnit(g,gg_unit_opeo_0003) //peon 2
call GroupAddUnit(g,gg_unit_opeo_0004) //peon 3
call BJDebugMsg("Final: "+B2S(OwnerOfGroup(g)))
call BJDebugMsg("Final: "+P2S(GetOwnerOfGroup(g)))
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t,2,false)
call TriggerAddAction(t,function Act)
set t = null
endfunction
endscope