Hello everyone.. I just started to learn jass and i've try to make a skill out of it.. However it didn't went well.. The JASS don't seem to work on the loop part and just skip everything else after the loop action..
Here is the script
You may notices that i didn't null the variable.. well i will after i find out how to complete the jass.. So do help me.. Thank you very much =)
Here is the script
JASS:
function RB_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function RB_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local unit t = GetSpellTargetUnit()
local lightning l
local integer i
call AddLightningLoc( "FORK", GetUnitLoc(c), GetSpellTargetLoc() )
set l = GetLastCreatedLightningBJ()
loop
exitwhen IsUnitAliveBJ(c) == false or IsUnitAliveBJ(t) == false or i == 46 or R2I(DistanceBetweenPoints(GetUnitLoc(c), GetUnitLoc(t))) >= 800
call MoveLightningLoc( l, GetUnitLoc(c), GetUnitLoc(t) )
call SetLightningColorBJ( l, GetRandomReal(0, 1), GetRandomReal(0, 1), 1, 1 )
call UnitDamageTargetBJ( c, t, 50.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
set i = i + 1
endloop
set i = 0
call DestroyLightningBJ(l)
endfunction
//======================
function InitTrig_RB takes nothing returns nothing
local trigger RB = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(RB, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(RB, Condition(function RB_Conditions))
call TriggerAddAction(RB, function RB_Actions)
set RB = null
endfunction
You may notices that i didn't null the variable.. well i will after i find out how to complete the jass.. So do help me.. Thank you very much =)