MasterRofl
New Member
- Reaction score
- 8
Yeah.. hey. I just started learning JASS today, and I've been trying to make this spell work for quite a while. Right now, I have a syntax error with these lines:
location TargetLocation = GetUnitLoc( TargetUnit )
location KnifeLocation = GetUnitLoc( Knife )
P.S. How can I optimize this? >_>
location TargetLocation = GetUnitLoc( TargetUnit )
location KnifeLocation = GetUnitLoc( Knife )
P.S. How can I optimize this? >_>
JASS:
scope ThrowKnife
function Actions takes nothing returns nothing
globals
unit TargetUnit = GetSpellTargetUnit()
unit Caster = GetTriggerUnit()
location CasterLocation = GetUnitLoc( GetTriggerUnit() )
integer SlowLevel = GetUnitAbilityLevelSwapped( 039;A01U039;, Caster )
endglobals
CreateUnitAtLoc( GetOwningPlayer( Caster ), 039;n00N039;, CasterLocation, 0 )
globals
unit Knife = GetLastCreatedUnit()
endglobals
call EnableTrigger( KnifeMovement )
endfunction
function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A01U039;
endfunction
public function InitTrig takes nothing returns nothing
local trigger ThrowKnife = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( ThrowKnife, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( ThrowKnife, Condition( function Conditions ) )
call TriggerAddAction( ThrowKnife, function Actions )
endfunction
endscope
JASS:
scope KnifeMovement
private function Actions takes nothing returns nothing
location TargetLocation = GetUnitLoc( TargetUnit )
location KnifeLocation = GetUnitLoc( Knife )
SetUnitPositionLocFacingLocBJ( Knife, PolarProjectionBJ( KnifeLocation, 36, AngleBetweenPoints( KnifeLocation, TargetLocation ) ), TargetLocation )
if ( DistanceBetweenPoints( KnifeLocation, TargetLocation ) < 36 ) then
call SetUnitAbilityLevel( Knife, 039;A026039;, SlowLevel )
call IssueTargetOrder( Knife, "slow", TargetUnit )
call KillUnit( Knife )
call UnitDamageTargetBJ( Caster, TargetUnit, 300, ATTACK_TYPE_HERO, DAMAGE_TYPE_FIRE )
call DisableTrigger( KnifeMovement )
endif
endfunction
//===========================================================================
function InitTrig takes nothing returns nothing
globals
trigger KnifeMovement = CreateTrigger()
endglobals
call DisableTrigger( KnifeMovement )
call TriggerRegisterTimerEventPeriodic( KnifeMovement, 0.03 )
call TriggerAddAction( KnifeMovement, function Actions )
endfunction
endscope