- Joined
- Apr 6, 2008
- Messages
- 760
JASS:
globals
private constant integer WHEATFARM_ID = 'halt'
private constant integer STOP = 851972
private constant real GRANARY_MAXRANGE = 800.
private boolexpr GRANARY_BOOL
private group TempGroup = CreateGroup()
private unit TempUnit
endglobals
private function WHEATFARM_CHECK takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer id = GetIssuedOrderId()
local real x = GetOrderPointX()
local real y = GetOrderPointY()
if id == WHEATFARM_ID then
call GroupEnumUnitsInRange(TempGroup,x,y,GRANARY_MAXRANGE,GRANARY_BOOL)
set TempUnit = FirstOfGroup(TempGroup)
if TempUnit == null then
call IssueImmediateOrderById(u,STOP) //Why wont this stop the unit? the order is correct
call DisplayTimedTextToPlayer(GetOwningPlayer(u),0,0,10,"Must build a Wheat farm within 800 yd of a grannary")
endif
endif
set u = null
endfunction
private function Init_Trig takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER)
call TriggerAddAction(trig,function WHEATFARM_CHECK)
set GRANARY_BOOL = Filter(function WEATHFARM_FILTER)
endfunction
It will display the text msg by it wont stop the builder, whys that?
I'v tried the order id in an other trigger and it worked..
So what is the problem here?