Crusher
You can change this now in User CP.
- Reaction score
- 121
Okay, so I have a problem with my spell. Well, basically, when you throw it, it should swap the positions between you and the triggered unit. But, it triggers on corpses as well! Is there any way to prevent it to trigger on corpses by adding any line function or something?
JASS:
scope Swap initializer init
globals
private constant integer SPELL_ID = 039;A098039;
endglobals
private function missileMaxSpeed takes integer level returns real
return 500.00 + 150.00*level
endfunction
private struct greenMissile extends xecollider
unit owner
method onUnitHit takes unit target returns nothing
local real x
local real y
if (this.owner != target) and IsUnitType(target, UNIT_TYPE_STRUCTURE) == false then
if (this.owner != target) and IsUnitType(target, UNIT_TYPE_MECHANICAL) == false then
if (this.owner != target) and IsUnitType(target, UNIT_TYPE_ANCIENT) == false then
//if (this.owner != target) and IsUnitAliveBJ(GetTriggerUnit()) == true then
set x = GetUnitX(this.owner)
set y = GetUnitY(this.owner)
call SetUnitX(this.owner, GetLocationX(GetUnitLoc(target)) )
call SetUnitY(this.owner, GetLocationY(GetUnitLoc(target)) )
call SetUnitX(target, x)
call SetUnitY(target, y)
call Lightning_UnitUnit(GetAbilityEffectById(SPELL_ID, EFFECT_TYPE_LIGHTNING, 1), this.owner, target, 0.5, true )
call this.terminate()
endif
endif
endif
// endif
endmethod
endstruct
private function onSpellCast takes nothing returns nothing
local unit u = GetTriggerUnit()
local location loc = GetSpellTargetLoc()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real ang = Atan2( GetLocationY(loc) - y, GetLocationX(loc) - x)
local integer l = GetUnitAbilityLevel(u, SPELL_ID)
local greenMissile xc
call TriggerSleepAction(0.0)
set xc = greenMissile.create(x, y , ang)
set xc.fxpath = "ArcaneMissile.mdl"
call xc.flash( "ArcaneMissile.mdl" )
set xc.acceleration = 1900.0
set xc.maxSpeed = missileMaxSpeed(l)
set xc.expirationTime = 2.0
set xc.z = 50.0
set xc.owner = u
call RemoveLocation(loc)
set u=null
set loc=null
endfunction
private function spellIdMatch takes nothing returns boolean
return (SPELL_ID==GetSpellAbilityId())
endfunction
private function init takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerAddCondition(t, Condition( function spellIdMatch) )
call TriggerAddAction(t, function onSpellCast)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
set t=null
endfunction
endscope