- Joined
- Jul 26, 2008
- Messages
- 1,009
I have created a Double Cast passive. What it does is when the unit casts any spell whatsoever, the spell will be cast a second time by a dummy unit. Simple enough.
So I give the dummy unit the ability cast. This works out just fine. When it comes to ordering the unit to cast the spell what I tried didn't work. Any help or ideas?
So I give the dummy unit the ability cast. This works out just fine. When it comes to ordering the unit to cast the spell what I tried didn't work. Any help or ideas?
JASS:
function Trig_DoubleCast_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(), 'DblC') > 0
endfunction
function Trig_DoubleCast_Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetSpellTargetUnit()
local unit d
local real tX = GetSpellTargetX()
local real tY = GetSpellTargetY()
local real x = GetUnitX(c)
local real y = GetUnitY(c)
local integer SPELLID = GetSpellAbilityId()
local string id = AbilityId2String(GetSpellAbilityId())
set d = CreateUnit(GetOwningPlayer(c), 'hsor', x, y, AngleBetweenPoints(Location(x, y), Location(tX,tY)))
call SetUnitState(d, UNIT_STATE_MANA, 9999)
call UnitAddAbility(d, SPELLID)
call UnitApplyTimedLife(d, 'BTLF', 2.)
call IssueImmediateOrder(d, id)
call IssueTargetOrder(d, id, t)
call IssuePointOrder(d, id, tX, tY)
endfunction
//===========================================================================
function InitTrig_DoubleCast takes nothing returns nothing
set gg_trg_DoubleCast = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_DoubleCast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_DoubleCast, Condition( function Trig_DoubleCast_Conditions ) )
call TriggerAddAction( gg_trg_DoubleCast, function Trig_DoubleCast_Actions )
endfunction