- Joined
- Mar 21, 2011
- Messages
- 1,611
Hi, i'm using BPower's Missile System / Stun Engine and i'm stuck with a problem.
Ability: Charges towards the target, stunning it on impact.
Now, because the Stun System uses hoofstomp, and the missiles' "OnFinish" will execute as soon as the missile is at the exact same spot as the target, both units get stunned. I want the missile to have a collision radius, so that it just needs to get in close rage of the target, however missile.collision does not change anything. I could check "OnPeriodic" and null the missile as soon as it gets close i guess, but is there a "natural way" that the system provides?
Ability: Charges towards the target, stunning it on impact.
Now, because the Stun System uses hoofstomp, and the missiles' "OnFinish" will execute as soon as the missile is at the exact same spot as the target, both units get stunned. I want the missile to have a collision radius, so that it just needs to get in close rage of the target, however missile.collision does not change anything. I could check "OnPeriodic" and null the missile as soon as it gets close i guess, but is there a "natural way" that the system provides?
JASS:
library Charge initializer Init uses SpellIndex
private struct Charge extends array
private static method onPeriod takes Missile missile returns boolean
if not (UnitAlive(missile.source) and UnitAlive(missile.target)) then
endif
return false
endmethod
static method onFinish takes Missile missile returns boolean
local unit caster = missile.dummy
local unit target = missile.target
call SetUnitPathing(caster, true)
set udg_STE_TARGET = target
set udg_STE_DURATION = 3.00
set udg_STE_STACK_TIME = false
set udg_STE_ADD_STUN = true
call TriggerEvaluate(udg_STE_TRIGGER)
set caster = null
set target = null
return true
endmethod
implement MissileStruct
endstruct
private function OnCast takes nothing returns boolean
local unit caster = GetTriggerUnit()
local Missile missile
call SetUnitPathing(caster, false)
set missile = Missile.createEx(caster, GetSpellTargetX(), GetSpellTargetY(), GetUnitDefaultFlyHeight(caster))
set missile.target = GetSpellTargetUnit()
set missile.speed = 20.
set missile.collision = 32.
call Charge.launch(missile)
set caster = null
return false
endfunction
private function Init takes nothing returns nothing
call RegisterSpellEffectEvent('A002', function OnCast)
endfunction
endlibrary