The original code was very very long, and the damage used to bug out, the spell is meant to do 3 ticks of damage, but sometimes it would only do one tick of damage. So I decided to make a loop that uses a timer. I have been stuck on this for hours, the map does not load anymore. I dont know where the problem is, whether its my variables or syntax error or a trigger/function thats wrong etc. But it stopped working after I made the timer/loop, and changed actions function, so I know the problem is in one of those, if not both. Any help would be appreciated
JASS:
integer udg_FBB_ExecCount=0
timer udg_FBB_Timer=null
unit udg_MiddleB=null
unit udg_FBB_CAster=null
trigger gg_trg_Finger_Blitz_Barrage=null
trigger gg_trg_Quick_Attack=null
JASS:
function Trig_Finger_Blitz_Barrage_Conditions takes nothing returns boolean
if(not(GetSpellAbilityId()=='A01K'))then
return false
endif
return true
endfunction
function Trig_Finger_Blitz_Barrage_Func009001003 takes nothing returns boolean
return(IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_FBB_CAster))==true)
endfunction
function Trig_Finger_Blitz_Barrage_Func009A takes nothing returns nothing
call UnitDamageTargetBJ(udg_FBB_CAster, GetEnumUnit(), ((I2R(GetUnitAbilityLevelSwapped('A01K', udg_FBB_CAster))+3.00)*(0.70*I2R(GetHeroStatBJ(bj_HEROSTAT_INT, udg_FBB_CAster, true)))), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
endfunction
function Trig_Finger_Blitz_Barrage_Func088001003 takes nothing returns boolean
return(IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_FBB_CAster))==true)
endfunction
function Trig_Finger_Blitz_Barrage_Func088A takes nothing returns nothing
call UnitDamageTargetBJ(udg_FBB_CAster, GetEnumUnit(), ((I2R(GetUnitAbilityLevelSwapped('A01K', udg_FBB_CAster))+3.00)*(0.70*I2R(GetHeroStatBJ(bj_HEROSTAT_INT, udg_FBB_CAster, true)))), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
endfunction
function Trig_Finger_Blitz_Barrage_Func118001003 takes nothing returns boolean
return(IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_FBB_CAster))==true)
endfunction
function Trig_Finger_Blitz_Barrage_Func118A takes nothing returns nothing
call UnitDamageTargetBJ(udg_FBB_CAster, GetEnumUnit(), ((I2R(GetUnitAbilityLevelSwapped('A01K', udg_FBB_CAster))+3.00)*(0.70*I2R(GetHeroStatBJ(bj_HEROSTAT_INT, udg_FBB_CAster, true)))), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
endfunction
function FBB_Timer takes nothing returns nothing
set udg_FBB_ExecCount = udg_FBB_ExecCount + 1
if udg_FBB_ExecCount > 3 then
call PauseTimer(udg_FBB_Timer)
call DestroyTimer(udg_FBB_Timer)
call DisableTrigger(gg_trg_Quick_Attack)
call SetUnitTimeScalePercent(udg_FBB_CAster, 100.00)
set udg_FBB_Timer = null
return
endif
set bj_wantDestroyGroup = true
call ForGroupBJ(GetUnitsInRangeOfLocMatching(400.00, GetUnitLoc(udg_MiddleB), Condition(function Trig_Finger_Blitz_Barrage_Func009001003)), function Trig_Finger_Blitz_Barrage_Func009A)
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetUnitLoc(udg_MiddleB), GetRandomReal(0, 200.00), GetRandomDirectionDeg()), "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl")
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetUnitLoc(udg_MiddleB), GetRandomReal(0, 200.00), GetRandomDirectionDeg()), "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl")
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetUnitLoc(udg_MiddleB), GetRandomReal(0, 200.00), GetRandomDirectionDeg()), "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl")
call AddSpecialEffectLocBJ(PolarProjectionBJ(GetUnitLoc(udg_MiddleB), GetRandomReal(0, 200.00), GetRandomDirectionDeg()), "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl")
endfunction
function Trig_Finger_Blitz_Barrage_Actions takes nothing returns nothing
set udg_FBB_CAster = GetTriggerUnit()
call EnableTrigger(gg_trg_Quick_Attack)
call SetUnitTimeScalePercent(udg_FBB_CAster, 300.00)
set udg_MiddleB = CreateNUnitsAtLoc(1, 'h03A', GetOwningPlayer(udg_FBB_CAster), PolarProjectionBJ(GetUnitLoc(udg_MiddleB), 150.00, 45.00), 45.00)
call SetUnitAnimation(udg_MiddleB, "death")
call UnitApplyTimedLifeBJ(3.00, 'BTLF', udg_MiddleB)
set udg_FBB_ExecCount = 0
set udg_FBB_Timer = CreateTimer()
call TimerStart(udg_FBB_Timer, 1.0, true, function FBB_Timer)
endfunction
function InitTrig_Finger_Blitz_Barrage takes nothing returns nothing
set gg_trg_Finger_Blitz_Barrage=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Finger_Blitz_Barrage,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Finger_Blitz_Barrage,Condition(function Trig_Finger_Blitz_Barrage_Conditions))
call TriggerAddAction(gg_trg_Finger_Blitz_Barrage,function Trig_Finger_Blitz_Barrage_Actions)
endfunction
function Trig_Quick_Attack_Actions takes nothing returns nothing
call SetUnitAnimation(udg_FBB_CAster,"attack")
endfunction
function InitTrig_Quick_Attack takes nothing returns nothing
set gg_trg_Quick_Attack=CreateTrigger()
call DisableTrigger(gg_trg_Quick_Attack)
call TriggerRegisterTimerEventPeriodic(gg_trg_Quick_Attack,0.05)
call TriggerAddAction(gg_trg_Quick_Attack,function Trig_Quick_Attack_Actions)
endfunction
Last edited: