- Joined
- Jul 26, 2008
- Messages
- 1,009
Hi, I'm making a skill called Assassin's leap. Basically the hero throws knives, dissappears, and reappears with more knife throwing. It's like blink but with knives being thrown on take off and land and a minor pause betwee dissappearing and reappearing.
The problem is the spell isn't even starting. It won't even process it's conditions. I imagine this might be because of my poor vJASS skills. Any help or insight is appreciated.
The problem is the spell isn't even starting. It won't even process it's conditions. I imagine this might be because of my poor vJASS skills. Any help or insight is appreciated.
JASS:
scope AssassinLeap
globals
private constant integer SpellID = 'asle' //Spell Rawcode
private constant real til = 0.1 //Periodic of timer
private constant damagetype dmg = DAMAGE_TYPE_POISON
private constant weapontype wpn = WEAPON_TYPE_WHOKNOWS
private constant attacktype atk = ATTACK_TYPE_MAGIC
endglobals
private struct Data
unit c
real cX
real cY
real X
real Y
static method create takes unit caster, real casterX, real casterY, real targX, real targY returns Data
local Data D = Data.allocate()
set D.c = caster
set D.cX = casterX
set D.cY = casterY
set D.X = targX
set D.Y = targY
return D
endmethod
endstruct
private function AssassinLeap_Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
local group g = CreateGroup()
local unit t
call SetUnitPosition(D.c, D.X, D.Y)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\shadowstrike\\shadowstrike.mdl", GetUnitX(D.c), GetUnitY(D.c)))
call ShowUnit(D.c, true)
if GetUnitAbilityLevel(D.c, 'afok') > 0 then
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\FanOfKnives\\FanOfKnivesCaster.mdl", GetUnitX(D.c), GetUnitY(D.c)))
call GroupEnumUnitsInRange(g, D.X, D.Y, 250., null)
loop
set t = FirstOfGroup(g)
exitwhen t == null
if IsUnitEnemy(t, GetOwningPlayer(D.c)) == true then
call UnitDamageTarget(D.c, t, 25*GetUnitAbilityLevel(D.c, 'afok'), true, false, atk, dmg, wpn)
endif
set t = null
endloop
endif
call ReleaseTimer(tim)
call D.destroy()
endfunction
private function AssassinLeap_Actions takes nothing returns nothing
local Data D = Data.create(GetTriggerUnit(), GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), GetSpellTargetX(), GetSpellTargetY())
local group g = CreateGroup()
local unit t
local real til
local timer tim = NewTimer()
set til = SquareRoot(Pow(D.X - D.cX, 2) + Pow(D.Y - D.cY, 2)) / GetUnitMoveSpeed(D.c)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\shadowstrike\\shadowstrike.mdl", GetUnitX(D.c), GetUnitY(D.c)))
if GetUnitAbilityLevel(D.c, 'afok') > 0 then
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\FanOfKnives\\FanOfKnivesCaster.mdl", GetUnitX(D.c), GetUnitY(D.c)))
call GroupEnumUnitsInRange(g, GetUnitX(D.c), GetUnitY(D.c), 250., null)
loop
set t = FirstOfGroup(g)
exitwhen t == null
if IsUnitEnemy(t, GetOwningPlayer(D.c)) == true then
call UnitDamageTarget(D.c, t, 25*GetUnitAbilityLevel(D.c, 'afok'), true, false, atk, dmg, wpn)
endif
set t = null
endloop
endif
call ShowUnit(D.c, false)
call SetTimerData(tim, D)
call TimerStart(tim, til, false, function AssassinLeap_Timer)
call DestroyGroup(g)
set g = null
set t = null
set tim = null
endfunction
private function AssassinLeap_Conditions takes nothing returns boolean
return GetSpellAbilityId() == SpellID
endfunction
//===========================================================================
function InitTrig_AssassinLeap takes nothing returns nothing
local trigger AssassinLeap = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( AssassinLeap, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( AssassinLeap, function AssassinLeap_Conditions )
call TriggerAddAction( AssassinLeap, function AssassinLeap_Actions )
endfunction
endscope
Last edited: