- Joined
- Sep 14, 2009
- Messages
- 284
I need some help to find an unexpected "(". I can't for the god of me find where the error is.
According to JassHelper the "(" is in the line where the Timer is created.
The error disappears when I remove the () from the call of CreateCombatSpawnUnit function, but I need it to take that argument and it should work I think?
Here is the code:
EDIT: Solved. Thanks Jampion, totally forgot that.
According to JassHelper the "(" is in the line where the Timer is created.
The error disappears when I remove the () from the call of CreateCombatSpawnUnit function, but I need it to take that argument and it should work I think?
Here is the code:
JASS:
globals
rect array combatSpawnRectGreenwood
region array combatSpawnRegionGreenwood
endglobals
//===========================================================================
function CombatSpawnRectGreenwood_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(), abilPartyManager) >= 1
endfunction
function CombatSpawnRectGreenwood_Actions takes nothing returns nothing
local integer i = 0
local region r = GetTriggeringRegion()
loop
exitwhen i >= 1 // Number of combatSpawnRects in zone.
if combatSpawnRegionGreenwood[i] == r then
call TimerStart(CreateTimer(), GetRandomReal(2, 5), false, function CreateCombatSpawnUnit(combatSpawnRectGreenwood[i]))
endif
set i = i + 1
endloop
set r = null
endfunction
//===========================================================================
function InitTrig_CombatSpawnRectGreenwood takes nothing returns nothing
set gg_trg_CombatSpawnRectGreenwood = CreateTrigger()
call TriggerRegisterEnterRectSimple(gg_trg_CombatSpawnRectGreenwood, gg_rct_CombatSpawnGreenwood00)
call TriggerAddCondition(gg_trg_CombatSpawnRectGreenwood, Condition(function CombatSpawnRectGreenwood_Conditions))
call TriggerAddAction(gg_trg_CombatSpawnRectGreenwood, function CombatSpawnRectGreenwood_Actions)
endfunction
JASS:
function CreateCombatSpawnUnit takes rect r returns nothing
local location l = GetRandomLocInRect(r)
call DestroyTimer(GetExpiredTimer())
call CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), combatSpawnType[GetRandomInt(0, 1)], GetLocationX(l), GetLocationY(l), GetRandomReal(0, 360))
call RemoveLocation(l)
set l = null
endfunction
EDIT: Solved. Thanks Jampion, totally forgot that.
Last edited: