- Joined
- Sep 29, 2006
- Messages
- 447
I'm making an ability that picks every unit in front of the caster and casts storm bolt on that unit. With my trigger I can enable it in the editor, but when I go to save it I get an "Expected a name" error on the "loop" line, and I can't figure out why. Can anyone help? Also, can anyone see if this trigger will even work?
Here's the trigger:
EDIT: Just as a heads up. The ResetAnim() function is a function in the map header and it works fine.
Here's the trigger:
JASS:
function ClusterRocketsConditions takes nothing returns boolean
return GetSpellAbilityId() == 'A009'
endfunction
function DummyActions takes unit u, real x, real y returns nothing
local unit u2 = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'h008', x, y, 0)
call UnitAddAbility( u2, 'A00C' )
call UnitApplyTimedLife( u2, 'BTLF', 2.00 )
call IssueTargetOrder( u2, "thunderbolt", u )
set u2 = null
endfunction
function GroupConditions takes nothing returns boolean
local unit f = GetFilterUnit()
local player p = GetOwningPlayer(GetTriggerUnit())
return ( IsUnitEnemy(f, p) == true ) and ( IsUnitType(f, UNIT_TYPE_MECHANICAL) == true )
endfunction
function GetTargets takes unit u, real r returns nothing
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real xx
local real yy
local real angle
local real face = GetUnitFacing(u)
local real absmod
local group g = CreateGroup()
local unit u2
call GroupEnumUnitsInRange(g, x, y, r, Condition(function GroupConditions))
loop
set u2 = FirstOfGroup(g)
exitwhen u2 == null
call GroupRemoveUnit(g,u2)
set xx = GetUnitX(u2)
set yy = GetUnitY(u2)
set angle = Atan2(y-yy,x-xx) * bj_RADTODEG
set absmod = ModuloReal(RAbsBJ(angle-face), 360)
if absmod > 65 and absmod < 255 then
call DummyActions(u2, x, y)
endif
endloop
call DestroyGroup(g)
set g = null
endfunction
function ClusterRocketsActions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real r = 20000.00
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local player p = GetOwningPlayer(u)
local integer i = GetConvertedPlayerId(GetOwningPlayer(u))
call UnitRemoveAbility( u, GetSpellAbilityId() )
set udg_AbilityInteger[i] = ( udg_AbilityInteger[i] - 1 )
call GetTargets(u, r)
call ResetAnim(u)
set u = null
endfunction
//===========================================================================
function InitTrig_cluster_rockets_2 takes nothing returns nothing
set gg_trg_cluster_rockets_2 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_cluster_rockets_2, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_cluster_rockets_2, Condition( function ClusterRocketsConditions ) )
call TriggerAddAction( gg_trg_cluster_rockets_2, function ClusterRocketsActions )
endfunction
EDIT: Just as a heads up. The ResetAnim() function is a function in the map header and it works fine.
Last edited: