| 01-08-2007, 03:24 AM | #1 |
Hi: I'm working with a trigger which will be able to detect some specific orders (move, attack, smart) and I want to know the target of those orders, at least it's coordinates. So I've tried with this test code: JASS:function TS_IssuedMoveAttackOrderCond takes nothing returns boolean local boolean b1 = GetIssuedOrderId() == String2OrderIdBJ("move") local boolean b2 = GetIssuedOrderId() == String2OrderIdBJ("attack") local boolean b3 = GetIssuedOrderId() == String2OrderIdBJ("smart") return b1 or b2 or b3 endfunction function TS_IssuedMoveAttackOrderActions takes nothing returns nothing local unit u = GetOrderedUnit() local integer o = GetIssuedOrderId() call TS_ShowDebugMsg(GetUnitName(u) + " will " + OrderId2String(o)) call TS_Ping(GetOrderPointX(), GetOrderPointY()) set u = null endfunction function TS_InitSystem takes nothing returns nothing local trigger t = CreateTrigger() call TS_AddShipsToDatabase() call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER ) call TriggerAddCondition( t, Condition( function TS_IssuedMoveAttackOrderCond ) ) call TriggerAddAction( t, function TS_IssuedMoveAttackOrderActions ) set t = null endfunction The TS_ShowDebugMsg and TS_Ping functions only show a text message and show a ping in the minimap respectively. When the map runs, and the trigger is activated, TS_Ping always show me the (0,0) coordinate. When I tried with the function GetOrderTargetUnit, it doesn't show the unit's name (return null :P) And the worst thing is this trigger only works with computer controlled units, when I order a unit to move, the trigger doesn't activate. Is there something missing??? ![]() |
| 01-08-2007, 03:29 AM | #2 |
It is not rocket surgery... Just use GetWidgetX/Y(GetOrderTarget()) |
| 01-08-2007, 04:51 AM | #3 |
Thanks Vexorian, it works :) +rep. |
