JASS:
Fan Of Knives Help![/b]
Hello.
My name is Chris, and i'we decided to make a spell for my warden which will throw Knives around her and then damage units that get too close to the knives using Level*HeroAgility. With 4 Total Levels. The problem is i can't seem to get it working it is creating the Knives and they walk their way but they don't damage any creature, please help me.
[code=jass]scope FanofKnifes initializer onInit
globals
private trigger FokTrigger = CreateTrigger()
private unit FokKnife
private unit FokCaster
private unit FokTarget
private xedamage xed
private group g = null
endglobals
private function Conditions_Dummy takes nothing returns boolean
return GetSpellAbilityId() == 'A004'
endfunction
private function Actions_Dummy takes nothing returns nothing
local location FokLocation1
local location FokLocation2
local location FokLocation3
local real FokSpeed = 15.00
local real FokDistance = 500.00
local real FokAngle
local real FokFacing
local integer FokKnives = 18
local player FokPlayer
set FokCaster = GetTriggerUnit()
set FokLocation1 = GetUnitLoc(FokCaster)
set FokPlayer = GetOwningPlayer(FokCaster)
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = FokKnives
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set FokAngle = ( ( 360.00 / I2R(FokKnives) ) * I2R(bj_forLoopAIndex) )
set FokLocation2 = Location(GetLocationX(FokLocation1) + 50.00 * Cos(FokAngle * bj_DEGTORAD), GetLocationY(FokLocation1) + 50.00 * Sin(FokAngle * bj_DEGTORAD))
set FokKnife = CreateUnitAtLoc( FokPlayer, 'h000', FokLocation2, FokAngle )
call UnitApplyTimedLife(FokKnife,'BTLF', 1.30)
set FokFacing = ( GetUnitFacing(FokKnife) + FokAngle )
set FokLocation3 = Location(GetLocationX(FokLocation2) + FokDistance * Cos(FokFacing * bj_DEGTORAD), GetLocationY(FokLocation2) + FokDistance * Sin(FokFacing * bj_DEGTORAD))
call SetUnitFacing(FokKnife, FokFacing)
call IssuePointOrderLoc( FokKnife, "move", FokLocation3 )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call TriggerRegisterUnitInRange(FokTrigger, FokKnife, 100.00, null)//Condition(IsUnitEnemy(GetTriggerUnit(), FokPlayer)))
call RemoveLocation(FokLocation1)
call RemoveLocation(FokLocation2)
call RemoveLocation(FokLocation3)
set FokPlayer = null
endfunction
private function Actions_Damage takes nothing returns nothing
local real x = GetUnitX(FokKnife)
local real y = GetUnitY(FokKnife)
set FokTarget = GetFilterUnit()
call KillUnit(FokKnife)
call GroupEnumUnitsInRange(g, x, y, 100.0 + XE_MAX_COLLISION_SIZE , null)
call xed.damageGroup(FokCaster, g, GetHeroAgi(FokCaster, true) * (1 * GetUnitAbilityLevel(FokCaster, 'A004')))
set FokKnife = null
set FokCaster = null
call DestroyGroup(g)
endfunction
// private function Conditions_Damage takes nothing returns boolean
// local unit u = GetFilterUnit()
// return GetUnitState(u, UNIT_STATE_LIFE) >= 0
// set u = null
// endfunction
private function onInit takes nothing returns nothing
local trigger tr = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( tr, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( tr, Condition( function Conditions_Dummy ) )
call TriggerAddAction( tr, function Actions_Dummy )
call TriggerAddAction( FokTrigger, function Actions_Damage)
endfunction
endscope
Last edited: