Carl-Fredrik
New Member
- Reaction score
- 51
Hello everyone... you might've seen my old thread about this spell I was trying to make. I decided to start out with making it non-MUI and then learn how to improve it later.. thing is; it doesn't work ^^
The script stops working when it picks the group I think :S
Any help appreciated...
The spell is supposed to move the target forward and damage all enemies in the way but instead it starts moving, doesn't damage anything and won't stop moving; it moves outside the camera bounds eventually and the game crashes.
The script:
Thanks in advance...
Edit: Updated script
The script stops working when it picks the group I think :S
Any help appreciated...
The spell is supposed to move the target forward and damage all enemies in the way but instead it starts moving, doesn't damage anything and won't stop moving; it moves outside the camera bounds eventually and the game crashes.
The script:
JASS:
scope KodoRun initializer KodoRushInit
globals
private timer TIMER = CreateTimer()
private group ENUM_GROUP = CreateGroup()
private group DAMAGED_GROUP = CreateGroup()
private real INTERVAL = 0.03
private integer FORLOOP = 1
private real DAMAGE_BASE = 100.00
private real DAMAGE_INCREASE = 50.00
private unit HERO
private filterfunc Filth
private location LOC1
private location LOC2
private location LOC3
private location MOVE
endglobals
private function Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 039;A05A039;)
endfunction
function FilterFunction takes nothing returns boolean
local unit u=GetFilterUnit()
set LOC3 = GetUnitLoc(u)
if IsUnitEnemy(u,GetOwningPlayer(HERO)) and not IsUnitInGroup(u,DAMAGED_GROUP) and GetWidgetLife( u ) > .405 then
call GroupAddUnit(DAMAGED_GROUP, u)
call UnitDamageTarget(HERO, GetEnumUnit(), (DAMAGE_BASE + (DAMAGE_INCREASE * I2R (GetUnitAbilityLevel(HERO, 039;A05A039;)))), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectLoc("Objects\\Spawnmodels\\Human\\HumanBlood\\HeroBloodElfBlood.mdl", LOC3))
endif
set u=null
return false
endfunction
private function DoThisTimer takes nothing returns nothing
set LOC1 = GetUnitLoc(HERO)
call SetUnitX(HERO, GetLocationX(MOVE))
call SetUnitY(HERO, GetLocationY(MOVE))
call GroupEnumUnitsInRange(ENUM_GROUP, GetUnitX(HERO), GetUnitY(HERO), 50, Filth)
set FORLOOP = FORLOOP + 1
if FORLOOP == 50 then
call PauseUnit(HERO, false)
call PauseTimer(TIMER)
call SetUnitPathing(HERO, true)
call GroupClear(DAMAGED_GROUP)
call RemoveLocation(LOC1)
call RemoveLocation(MOVE)
set FORLOOP = 1
else
call RemoveLocation(LOC1)
call RemoveLocation(MOVE)
endif
endfunction
private function Actions takes nothing returns nothing
set HERO = GetTriggerUnit()
set LOC1 = GetUnitLoc(HERO)
set LOC2 = GetSpellTargetLoc()
call SetUnitFacing(HERO, AngleBetweenPoints(LOC1, LOC2))
call PauseUnit(HERO, true)
call SetUnitPathing(HERO, false)
call RemoveLocation(LOC1)
call RemoveLocation(LOC2)
call TimerStart(TIMER, INTERVAL, true, (function DoThisTimer))
endfunction
private function KodoRushInit takes nothing returns nothing
local trigger t = CreateTrigger()
set Filth = Filter(function FilterFunction)
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition (function Conditions))
call TriggerAddAction( t, function Actions )
endfunction
endscope
Thanks in advance...
Edit: Updated script