Chocobo
White-Flower
- Reaction score
- 409
When I try to use ForGroup and Local Variables, it never worked. This Spell is supposed to Splash all units dealing BoltofFire[level] damage, it does 0 damage.
Code:
function Bolt_of_Fire_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A02Z' ) ) then
return false
endif
return true
endfunction
function BoltOfFireCond1 takes nothing returns boolean
if ( not ( distance < 270.00 ) ) then
return false
endif
return true
endfunction
function BoltOfFireCond2 takes nothing returns boolean
if ( not ( distance > 400.00 ) ) then
return false
endif
return true
endfunction
function BoltOfFireCond3 takes nothing returns boolean
return ( IsUnitVisible(unit, GetFilterPlayer()) == true )
endfunction
function Bolt_of_Fire_Actions takes nothing returns nothing
local real distance
local real totaldistance
local unit unit
local unit dummy
local integer level
local effect sfx
set level = GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetTriggerUnit())
set unit = GetSpellTargetUnit()
set position1 = GetUnitLoc(GetTriggerUnit())
set position2 = GetUnitLoc(unit)
set distance = DistanceBetweenPoints(position1, position2)
if ( BoltOfFireCond1() ) then
call DisplayTimedTextToForce( GetForceOfPlayer(GetOwningPlayer(GetTriggerUnit())), 10.00, "TRIGSTR_1724" )
return
else
set totaldistance = distance
endif
call TriggerSleepAction( ( distance / 1000.00 ) )
set position1 = GetUnitLoc(unit)
set distance = DistanceBetweenPoints(position1, position2)
if ( BoltOfFireCond2() ) then
call DisplayTimedTextToForce( GetForceOfPlayer(GetOwningPlayer(GetTriggerUnit())), 10.00, "TRIGSTR_1725" )
else
endif
call CreateNUnitsAtLoc( 1, 'e002', GetTriggerPlayer(), position1, 0.00 )
set dummy = GetLastCreatedUnit()
call SetUnitAbilityLevelSwapped( 'A030', dummy, level )
call IssueImmediateOrderBJ( dummy, "stomp" )
call AddSpecialEffectLocBJ( position1, "war3mapImported\\nuke.mdx" )
set sfx = GetLastCreatedEffectBJ()
call CreateTextTagLocBJ( ( "Explosion! (" + ( I2S(BoltOfFireDmg[level]) + " dmg!)" ) ), point, 0, 6.00, 0.00, 100, 0.00, 0 )
call ForGroupBJ(GetAllUnits(150.00, (GetTriggeringUnit()), function SourceDamage) //GetAllUnits(150.00, GetTriggeringUnit()) means all units in 150 range of triggering unit, SourceDamage means to damage the target by level.
call ShowTextTagForceBJ( true, GetLastCreatedTextTag(), GetPlayersMatching(Condition(function BoltOfFireCond3)) )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 64, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 3.00 )
set level = 0
set unit = null
set distance = 0.00
set totaldistance = 0.00
call TriggerSleepAction( 1.00 )
call RemoveUnit( dummy )
set dummy = null
call TriggerSleepAction( 5.00 )
call DestroyEffectBJ( sfx )
endfunction
//===========================================================================
function InitBolt_of_Fire takes nothing returns nothing
set Bolt_of_Fire = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( Bolt_of_Fire, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( Bolt_of_Fire, Condition( function Bolt_of_Fire_Conditions ) )
call TriggerAddAction( Bolt_of_Fire, function Bolt_of_Fire_Actions )
endfunction