- Joined
- Sep 12, 2008
- Messages
- 657
hey.. i've made a spell. but for some odd reason, it does 1 if,
and the second if never comes..
(both then, and else never do nothing..)
btw, KnockbackUnit is a function i made.. in another code..
and it uses GroupUtils..
thanks in advace =]..
and the second if never comes..
(both then, and else never do nothing..)
JASS:
scope HakkeshouKaiten initializer OnInit
private struct HakkeshouKaitenStruct
static unit KaitenCaster
static real KaitenTime
static method OnCond takes nothing returns boolean
return GetSpellAbilityId() == 'A004'
endmethod
static method OnCast takes nothing returns nothing
set KaitenCaster = GetTriggerUnit()
call PauseUnit(KaitenCaster, true)
call SetUnitAnimation(KaitenCaster, "Spell Spin")
endmethod
static method OnLoopCond takes nothing returns boolean
return GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0.405 and IsUnitAlly(GetFilterUnit(), GetOwningPlayer(KaitenCaster)) == false
endmethod
static method OnLoop takes nothing returns nothing
local unit t = null
local real FacingLocal = 0
local real DamageLocal = 100 * GetUnitAbilityLevel(KaitenCaster, 'A004')
local real DistanceLocal = 70
local real KBDurationLocal = 0.5
local group g
if KaitenCaster != null then
call DisplayTimedTextToForce(GetPlayersAll(), 0.032, " Caster is not null. ")
if KaitenTime < 2.830 then
set KaitenTime = KaitenTime + 0.032
call DisplayTimedTextToForce(GetPlayersAll(), 0.032, " Test: " + R2S(KaitenTime))
set g = NewGroup()
call GroupRefresh(g)
call ReleaseGroup(g)
call GroupEnumUnitsInArea(ENUM_GROUP, GetUnitX(KaitenCaster), GetUnitY(KaitenCaster), 250, Condition(function HakkeshouKaitenStruct.OnLoopCond))
loop
set t = FirstOfGroup(ENUM_GROUP)
exitwhen t == null
set FacingLocal = Atan2(GetUnitY(t)-GetUnitY(KaitenCaster), GetUnitX(t)-GetUnitX(KaitenCaster)) * bj_RADTODEG
call KnockbackUnit(KaitenCaster, t, GetUnitX(KaitenCaster), GetUnitY(KaitenCaster), FacingLocal, DamageLocal, DistanceLocal, KBDurationLocal)
call GroupRemoveUnit(ENUM_GROUP, t)
set t = null
endloop
else
call DisplayTimedTextToForce(GetPlayersAll(), 0.032, " Code Ended. ")
call PauseUnit(KaitenCaster, false)
set KaitenTime = 0
set KaitenCaster = null
endif
endif
endmethod
endstruct
private function OnInit takes nothing returns nothing
local trigger DM = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(DM, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(DM, Condition(function HakkeshouKaitenStruct.OnCond))
call TriggerAddAction(DM, function HakkeshouKaitenStruct.OnCast)
call TimerStart(CreateTimer(), 0.032, true, function HakkeshouKaitenStruct.OnLoop)
set DM = null
endfunction
endscope
btw, KnockbackUnit is a function i made.. in another code..
and it uses GroupUtils..
thanks in advace =]..