Basically, I'm trying to make cluster rockets be automatically cast when a unit attacks. However, there is a slight problem.
After the trigger runs about four times for a unit, the unit seems to 'jam'. By this, I mean that it gets given the order, the icon of Cluster Rockets lights up, but it never casts the ability, and just stays like this until it is given another order. After it is given an order, it works normally again for a little while, but the same thing happens again...
From the testing I've done, it seems to be a problem in common with other AOE abilities, so I'm wondering whether it is something to do with the trigger or just something hardcoded into the game.
Here is the code I'm using:
Is there any solution to this problem?
After the trigger runs about four times for a unit, the unit seems to 'jam'. By this, I mean that it gets given the order, the icon of Cluster Rockets lights up, but it never casts the ability, and just stays like this until it is given another order. After it is given an order, it works normally again for a little while, but the same thing happens again...
From the testing I've done, it seems to be a problem in common with other AOE abilities, so I'm wondering whether it is something to do with the trigger or just something hardcoded into the game.
Here is the code I'm using:
Code:
function MissileUnitCheck takes nothing returns boolean
return ( GetUnitTypeId(GetAttacker()) == 'h003' )
endfunction
function MissileActions takes nothing returns nothing
local location position = GetUnitLoc(GetTriggerUnit())
call IssuePointOrderLocBJ( GetAttacker(), "clusterrockets", position )
call RemoveLocation(position)
endfunction
//===========================================================================
function InitTrig_Missiles takes nothing returns nothing
set gg_trg_Missiles = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Missiles, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Missiles, Condition( function MissileUnitCheck ) )
call TriggerAddAction( gg_trg_Missiles, function MissileActions )
endfunction
Is there any solution to this problem?