- Joined
- Jul 26, 2008
- Messages
- 1,009
Alright, this is my code. Basically what the "Master" unit does the "Slave" unit should do the same order. Unfortunately it infinite loops (without crash) and I'm not sure why.
JASS:
globals
trigger array SimonPoint
trigger array SimonImmediate
trigger array SimonTarget
endglobals
function Trig_SimonPoint_Actions takes nothing returns nothing
if GetTriggerUnit() == Master[GetUnitId(GetTriggerUnit())] then
call IssuePointOrderById( Slave[GetUnitId(GetTriggerUnit())], GetIssuedOrderId(), GetOrderPointX(), GetOrderPointY() )
endif
endfunction
function Trig_SimonImmediate_Actions takes nothing returns nothing
if GetTriggerUnit() == Master[GetUnitId(GetTriggerUnit())] then
call IssueImmediateOrderById( Slave[GetUnitId(GetTriggerUnit())], GetIssuedOrderId() )
endif
endfunction
function Trig_SimonTarget_Actions takes nothing returns nothing
if GetTriggerUnit() == Master[GetUnitId(GetTriggerUnit())] then
call IssueTargetOrderById( Slave[GetUnitId(GetTriggerUnit())], GetIssuedOrderId(), GetOrderTarget() )
endif
endfunction
//===========================================================================
function InitTrig_SimonSays takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 9
set SimonPoint[i] = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent( SimonPoint[i], Player(i), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, null)
call TriggerAddAction( SimonPoint[i], function Trig_SimonPoint_Actions )
set SimonImmediate[i] = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent( SimonImmediate[i], Player(i), EVENT_PLAYER_UNIT_ISSUED_ORDER, null)
call TriggerAddAction( SimonImmediate[i], function Trig_SimonImmediate_Actions )
set SimonTarget[i] = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent( SimonTarget[i], Player(i), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, null)
call TriggerAddAction( SimonTarget[i], function Trig_SimonTarget_Actions )
endloop
endfunction