I'm trying to recreate Naix's ultimae ability Infest. The spell hides caster creates a dummy unit. The player can't access it's hero until the target dies or casts a spell using the dummy, then the Hero gets showed and the target gets killed.
I have created it, it works great and all, but there is 1 rellay big issue with it. You have to cast it twice with the dummy and I don't know why.
Here's the trigger:
gg_rct_Merge is a region where your dummy will be (can't move)
EDIT: Problem solved, wow InitTrig_ really sucks. It causes an initialization to run twice :S
I have created it, it works great and all, but there is 1 rellay big issue with it. You have to cast it twice with the dummy and I don't know why.
Here's the trigger:
JASS:
scope Spell initializer InitTrig_Jump_In
globals
private constant integer JUMP_IN_ID = 039;A006039;
private constant integer JUMP_OUT_ID = 039;A007039;
private constant integer JUMP_DUMMY = 039;h001039;
private constant string JUMP_IN_SFX = "Abilities\\Spells\\Other\\Drain\\ManaDrainCaster.mdl"
private constant string JUMP_IN_ATTACH = "overhead"
private constant string JUMP_OUT_SFX = "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl"
private rect REGION = gg_rct_MergeRegion
endglobals
private struct jump
unit caster
unit target
unit dummy
effect eff
triggeraction trigact
triggeraction trigact_select
trigger t
endstruct
private function Select takes nothing returns nothing
local jump d = GetTriggerStructA( GetTriggeringTrigger() )
call SelectUnitForPlayerSingle(d.dummy, GetOwningPlayer(d.caster))
endfunction
private function Actions_Out takes nothing returns nothing
local jump d = GetTriggerStructA( GetTriggeringTrigger() )
call RemoveUnit(d.dummy)
call DisableTrigger( GetTriggeringTrigger() )
call BJDebugMsg("OK")
call TriggerRemoveAction( GetTriggeringTrigger(), d.trigact)
call DestroyEffect(d.eff)
call ShowUnit(d.caster, true)
call PauseUnit(d.caster, false)
call SetUnitInvulnerable(d.caster, false)
call SetUnitX(d.caster, GetUnitX(d.target))
call SetUnitY(d.caster, GetUnitY(d.target))
if GetSpellAbilityId() == JUMP_OUT_ID then
call UnitDamageTargetBJ(d.caster,d.target, GetWidgetLife(d.target)*2, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_ACID)
endif
call BJDebugMsg("OK - 2")
call SelectUnitForPlayerSingle(d.caster, GetOwningPlayer(d.caster))
call PanCameraToTimedForPlayer(GetOwningPlayer(d.caster), GetUnitX(d.caster), GetUnitY(d.caster), 0)
call TriggerRemoveAction(d.t, d.trigact_select)
call DestroyTrigger(d.t)
call DestroyEffect( AddSpecialEffect(JUMP_OUT_SFX, GetUnitX(d.target), GetUnitY(d.target)))
call d.destroy()
call ClearTriggerStructA( GetTriggeringTrigger() )
call DestroyTrigger( GetTriggeringTrigger() )
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == JUMP_IN_ID
endfunction
private function Actions takes nothing returns nothing
local jump d = jump.create()
local trigger t = CreateTrigger()
set d.t = CreateTrigger()
set d.caster = GetTriggerUnit()
set d.target = GetSpellTargetUnit()
call ShowUnit(d.caster, false)
call PauseUnit(d.caster, true)
call SetUnitInvulnerable(d.caster, true)
set d.dummy = CreateUnit(GetOwningPlayer(d.caster), JUMP_DUMMY,GetRectCenterX(REGION),GetRectCenterY(REGION),0)
set d.eff = AddSpecialEffectTarget(JUMP_IN_SFX,d.target,JUMP_IN_ATTACH)
call SelectUnitForPlayerSingle(d.dummy, GetOwningPlayer(d.caster))
call TriggerRegisterUnitEvent( d.t, d.target, EVENT_UNIT_SELECTED )
call TriggerRegisterUnitEvent( d.t, d.caster, EVENT_UNIT_SELECTED )
call TriggerRegisterUnitEvent( t, d.dummy, EVENT_UNIT_SPELL_EFFECT )
call TriggerRegisterUnitEvent( t, d.target, EVENT_UNIT_DEATH )
set d.trigact = TriggerAddAction( t, function Actions_Out )
set d.trigact_select = TriggerAddAction( d.t, function Select )
call SetTriggerStructA(t,d)
call SetTriggerStructA(d.t,d)
set t = null
endfunction
//===========================================================================
function InitTrig_Jump_In 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 )
set t = null
endfunction
endscope
gg_rct_Merge is a region where your dummy will be (can't move)
EDIT: Problem solved, wow InitTrig_ really sucks. It causes an initialization to run twice :S