- Joined
- Jul 28, 2008
- Messages
- 211
I read some tutorials about vJASS and i decidet to make something on my own.
Its supposed to be a knockback spell ( still don't know if does it work ).
When i cast the spell, nothing happens. Like its a normal spell.
Here's my script :
Can someone help me? And pls tell me would it even do anything if the it worked.
Thx
Its supposed to be a knockback spell ( still don't know if does it work ).
When i cast the spell, nothing happens. Like its a normal spell.
Here's my script :
JASS:
scope Ability initializer InitTrig_Spell
globals
unit target
//Spell target
real x
//Target's x
real y
//Target's y
real tx
//Max distance x
real ty
//Max distance y
constant integer spell = 'A000'
//Spell Id
constant string sfx = "Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl"
//Spell effect
endglobals
private function Damage takes integer level returns real //Damage dealt
return 50.00 + level * 25.00
endfunction
private function MaxDistance takes nothing returns real //Total distance traveled
return 500.00
endfunction
private function Time takes nothing returns real //Travel time
return 1.00
endfunction
private function Period takes nothing returns real //Time between unim movment
return 0.04
endfunction
private function DistanceIncrease takes nothing returns real //Distance the unit is moved every period
return MaxDistance() / ( Time() / Period() )
endfunction
//===========================================================================
private function Trig_Spell_Conditions takes nothing returns boolean
return GetSpellAbilityId() == spell
endfunction
private function Move takes nothing returns nothing
if x>tx then
set x = x - DistanceIncrease()
else
set x = x + DistanceIncrease()
endif
if y>ty then
set y = y - DistanceIncrease()
else
set y = y + DistanceIncrease()
endif
call SetUnitPosition( target, x, y )
call DestroyEffect( AddSpecialEffectTarget( sfx, target, "origin" ) )
endfunction
private function Trig_Spell_Actions takes nothing returns nothing
local timer t = CreateTimer()
local location loc = PolarProjectionBJ( GetUnitLoc( target ), MaxDistance(), GetUnitFacing( GetTriggerUnit() ) )
set target = GetSpellTargetUnit()
call SetUnitPathing( target, false )
call UnitDamageTarget( GetTriggerUnit(), target, Damage( GetUnitAbilityLevel( GetTriggerUnit(), spell )), true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
set x = GetUnitX(target)
set y = GetUnitY(target)
set tx = GetLocationX( loc )
set ty = GetLocationY( loc )
call RemoveLocation( loc )
set loc = null
call TimerStart( t, Period(), true, function Move )
call TriggerSleepAction( Time() )
call SetUnitPathing( target, true )
call DestroyTimer( t )
set t = null
endfunction
//===========================================================================
function InitTrig_Spell takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Trig_Spell_Conditions ) )
call TriggerAddAction( t, function Trig_Spell_Actions )
endfunction
endscope
Can someone help me? And pls tell me would it even do anything if the it worked.
Thx