A Problem Making Cluster Rockets auto-cast

Status
Not open for further replies.

Syreniac

S

Syreniac

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:

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?
 
This is very inefficient. You need a dummy unit to cast the Cluster Rockets, not the Attacking Unit. The order you give simply overrides the attack order it currently has, resulting a plane idleness of the Attacking unit. Just create a dummy and order it to cluster rocket the Attacked Unit's position. Plus, you need a damage detection system to make this work flawlessly. Finally, if you want multiple missiles coming out of the attacker, use the "Barrage" ability and also give your unit a Bash-based ability with 100% chance to occur.
 
So would it make more sense just to do it through dummy units then?

EDIT: Forget the +rep for helping.

Also, the autocasting works if you pause and then unpause the unit first.
 
Status
Not open for further replies.
Back
Top