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.
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()) == 039;H001039; ) and ( UnitHasBuffBJ(GetSpellAbilityUnit(), 039;B000039;) == true )
endfunction
private function Actions takes nothing returns nothing
local unit Unit = CreateUnitAtLoc( GetOwningPlayer(GetSpellAbilityUnit()), 039;n008039;, GetUnitLoc(GetSpellAbilityUnit()), bj_UNIT_FACING )
call UnitRemoveBuffBJ( 039;B000039;, GetSpellAbilityUnit() )
call UnitApplyTimedLife(Unit, 039;BTLF039;, 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