- Joined
- Aug 19, 2015
- Messages
- 68
Alright i have this trigger to move a unit to all waypoints in an array.
The waypoints in the array are filled from 0 to 33.
The code seems to work but:
Since I implemented this, units are getting stuck and cant be moved until you deselect them and use a spell or some kind of messy debug...
Or for example I was about to build something and when my teammate entered the command, the building location selection got canceled.
Help please
map: https://www.dropbox.com/s/8nkfbm5cb38nnpw/Vamp Zero SDK turbo 1.49.w3x?raw=1
The waypoints in the array are filled from 0 to 33.
The code seems to work but:
Since I implemented this, units are getting stuck and cant be moved until you deselect them and use a spell or some kind of messy debug...
Or for example I was about to build something and when my teammate entered the command, the building location selection got canceled.
Help please
JASS:
function Trig_orderwaypoints_Func009C takes nothing returns boolean
if ( not ( GetEventPlayerChatString() == "-wp -" ) ) then
return false
endif
return true
endfunction
function Trig_orderwaypoints_Actions takes nothing returns nothing
local unit u
local integer loopstart
local integer loopend
local group ggg = GetUnitsSelectedAll(GetTriggerPlayer())
set u = GroupPickRandomUnit(ggg)
call DestroyGroup(ggg)
if ( Trig_orderwaypoints_Func009C() ) then
set loopstart = 33
set loopend = 0
loop
exitwhen loopstart < loopend
call IssuePointOrderLocBJ( u, "move", udg_baseloc[loopstart] )
loop
exitwhen ( (GetUnitCurrentOrder(u) == 0) or (GetUnitCurrentOrder(u) == 851971))
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 2))
endloop
if GetUnitCurrentOrder(u) == 851971 then
set loopstart = 0
endif
set loopstart = loopstart - 1
endloop
else
set loopstart = 0
set loopend = 33
loop
exitwhen loopstart > loopend
call IssuePointOrderLocBJ( u, "move", udg_baseloc[loopstart] )
loop
exitwhen ( (GetUnitCurrentOrder(u) == 0) or (GetUnitCurrentOrder(u) == 851971))
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 2))
endloop
if GetUnitCurrentOrder(u) == 851971 then
set loopstart = 33
endif
set loopstart = loopstart + 1
endloop
endif
set ggg = null
set u = null
endfunction
//===========================================================================
function InitTrig_orderwaypoints takes nothing returns nothing
set gg_trg_orderwaypoints = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_orderwaypoints, Player(10), "-wp", true )
call TriggerRegisterPlayerChatEvent( gg_trg_orderwaypoints, Player(10), "-wp -", true )
call TriggerRegisterPlayerChatEvent( gg_trg_orderwaypoints, Player(11), "-wp", true )
call TriggerRegisterPlayerChatEvent( gg_trg_orderwaypoints, Player(11), "-wp -", true )
call TriggerAddAction( gg_trg_orderwaypoints, function Trig_orderwaypoints_Actions )
endfunction
Last edited: