JASS:
scope Purge initializer onInit
globals
private constant integer MY_SPELL = 'Csp0'
private constant real CAST_TIME = 2.0
endglobals
private function actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local real time = 2.0
local real i = 0.0
local real acc = 0.0
local boolean end = false
debug call BJDebugMsg("actions work") //good and working
call SetUnitAcquireRange(caster, acc) //making the unit not to attack
loop //checking unit's current order every 0.01 second
call SetUnitAnimation(caster, "channel")//chances unit's animation
call IssueImmediateOrder(caster, "holdposition")//making the unit to stand still
set i = i + 0.01
if GetUnitCurrentOrder(caster) != String2OrderIdBJ("holdposition") then //stops the loop when the unit's current order changes
debug call BJDebugMsg(OrderId2String(GetUnitCurrentOrder(caster)))//this noob says (null), but it should be "holdposition" coz i issued an order before the IF
set i = time//makes the loop exit
set end = true //boolean for actionsABC to work
debug call BJDebugMsg("loop stop")//tells if the loop is stopped
endif
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// for no reason the DebugMsg says the unit's current order is (null) when the loop is On making the actionsABC not to follow //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
call TriggerSleepAction(0.01)
exitwhen i == time
endloop
if end == false then //<--- i call this actionsABC for no reason
//actions should be done here
debug call BJDebugMsg("actions good")
endif
endfunction
private function conditions takes nothing returns boolean
debug call BJDebugMsg("conditions good") //good and working
return GetSpellAbilityId() == MY_SPELL
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerAddAction(t, function actions)
call TriggerAddCondition(t, Condition(function conditions))
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CAST)
debug call BJDebugMsg("initialize good") //good and working
endfunction
endscope
problems:
1.) it says (in-game) that the current order of caster is null
JASS:
debug call BJDebugMsg(OrderId2String(GetUnitCurrentOrder(caster)))
3.) cant find solutions for problem 1