Dummy not casting. How do I get it to cast the same spell that is being casted?

MasterRofl

New Member
Reaction score
8
I'm trying to make a trigger that does the following:

When hero H001 casts a spell and has buff B000, create a dummy unit.
Then, add a skill to the dummy unit. The skill is the same skill that was casted by hero H001. The dummy unit is then given the order to cast the spell on the same target as the hero casted the spell on.

Right now, everything except ordering the unit works. I don't know what's wrong.

JASS:
scope DoubleCast initializer Init

private function Conditions takes nothing returns boolean
    return ( GetUnitTypeId(GetSpellAbilityUnit()) == 'H001' ) and ( UnitHasBuffBJ(GetSpellAbilityUnit(), 'B000') == true )
endfunction

private function Actions takes nothing returns nothing
    local unit Unit = CreateUnitAtLoc( GetOwningPlayer(GetSpellAbilityUnit()), 'n008', GetUnitLoc(GetSpellAbilityUnit()), bj_UNIT_FACING )
    call UnitRemoveBuffBJ( 'B000', GetSpellAbilityUnit() )
    call UnitApplyTimedLife(Unit, 'BTLF', 3.00)
    call UnitAddAbility( Unit, GetSpellAbilityId() )
    call SetUnitAbilityLevel( Unit, GetSpellAbilityId(), GetUnitAbilityLevel(GetSpellAbilityUnit(), GetSpellAbilityId()) )
    call TriggerSleepAction( 1.00 )
    call IssueTargetOrderById( Unit, GetSpellAbilityId(), GetSpellTargetUnit() )
    set Unit = null
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Conditions ) )
    call TriggerAddAction( t, function Actions )
endfunction

endscope
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top