Hey all
can someone tell me why this trigger isnt starting or repeating when the game starts?
can someone tell me why this trigger isnt starting or repeating when the game starts?
Lua:
function Trig_Enemy_Spawn_Conditions()
return udg_SpawnCap < 500
end
function Trig_Enemy_Spawn_Func004Func002A()
udg_TempLoc = GetUnitLoc (GetEnumUnit())
udg_SpawnCap = udg_SpawnCap + udg_MonsterPointsTierLvl[1]
CreateUnitAtLoc(Player(20), FourCC("n009"), udg_TempLoc, 0.)
RemoveLocation (udg_TempLoc)
end
function Trig_Enemy_Spawn_Func005Func002A()
udg_TempLoc = GetUnitLoc (GetEnumUnit())
if 0 == GetRandomInt(0, 1) then
CreateUnitAtLoc(Player(20), FourCC("n00B"), udg_TempLoc, 0.)
else
CreateUnitAtLoc(Player(21), FourCC("n000"), udg_TempLoc, 0.)
end
udg_SpawnCap = udg_SpawnCap + udg_MonsterPointsTierLvl[1]
RemoveLocation (udg_TempLoc)
end
function Trig_Enemy_Spawn_Actions()
if udg_SpawnSeconds <= 100 then
udg_SpawnSeconds = udg_SpawnSeconds + 1
else
udg_SpawnSeconds = 0
end
DisplayTimedTextToForce(GetForceOfPlayer(Player(0)), 1.1, "Test")
if UnitAlive(udg_SpawnBuildings[4]) == true and ModuloReal(I2R(udg_SpawnSeconds), 5.00) == 4.00 then
--// Scorched Spawn
udg_TempLoc = GetRandomLocInRect (udg_SpawnFields[4])
udg_SpawnCap = udg_SpawnCap + udg_MonsterPointsTierLvl[1]
CreateUnitAtLoc(Player(21), FourCC("n009"), udg_TempLoc, 0.)
RemoveLocation (udg_TempLoc)
end
if CountUnitsInGroup(udg_GravesUnitGroup) > 0 and ModuloReal(I2R(udg_SpawnSeconds), 4.00) == 3.00 then
--// Scorched Spawn
ForGroup( udg_GravesUnitGroup, Trig_Enemy_Spawn_Func004Func002A() )
end
if CountUnitsInGroup(udg_SewerUnitGroup) > 0 and ModuloReal(I2R(udg_SpawnSeconds), 4.00) == 3.00 then
--// Canalization Spawn
ForGroup( udg_SewerUnitGroup, Trig_Enemy_Spawn_Func005Func002A() )
end
if UnitAlive(udg_SpawnBuildings[5]) == true and I2R(udg_SpawnSeconds) / 1.50 >= 10 and ModuloReal(I2R(udg_SpawnSeconds), 9.00) == 8.00 then
--// Fire Spawn
udg_TempLoc = GetRandomLocInRect (udg_SpawnFields[5])
udg_SpawnCap = udg_SpawnCap + udg_MonsterPointsTierLvl[2]
if 0 == GetRandomInt(0, 1) then
CreateUnitAtLoc(Player(21), FourCC("n003"), udg_TempLoc, 0.)
else
CreateUnitAtLoc(Player(21), FourCC("n002"), udg_TempLoc, 0.)
end
RemoveLocation (udg_TempLoc)
end
if UnitAlive(udg_SpawnBuildings[2]) == true and ModuloReal(I2R(udg_SpawnSeconds), 14.00) == 13.00 then
--// Orc Spawn
udg_TempLoc = GetRandomLocInRect (udg_SpawnFields[2])
udg_SpawnCap = udg_SpawnCap + udg_MonsterPointsTierLvl[3]
CreateUnitAtLoc(Player(22), FourCC("n004"), udg_TempLoc, 0.)
RemoveLocation (udg_TempLoc)
end
if UnitAlive(udg_SpawnBuildings[0]) == true and ModuloReal(I2R(udg_SpawnSeconds), 14.00) == 13.00 then
--// Portal Spawn
udg_TempLoc = GetRandomLocInRect (udg_SpawnFields[0])
udg_SpawnCap = udg_SpawnCap + udg_MonsterPointsTierLvl[3]
CreateUnitAtLoc(Player(21), FourCC("n008"), udg_TempLoc, 0.)
RemoveLocation (udg_TempLoc)
end
if IsUnitAliveBJ(udg_SpawnBuildings[3]) == true and ModuloReal(I2R(udg_SpawnSeconds), 19.00) == 18.00 then
--// Sunken SHip Spawn
udg_TempLoc = GetRandomLocInRect (udg_SpawnFields[3])
udg_SpawnCap = udg_SpawnCap + udg_MonsterPointsTierLvl[4]
CreateUnitAtLoc(Player(22), FourCC("n007"), udg_TempLoc, 0.)
RemoveLocation (udg_TempLoc)
end
if UnitAlive(udg_SpawnBuildings[6]) == true and ModuloReal(I2R(udg_SpawnSeconds), 19.00) == 18.00 then
--// Scorched Spawn
udg_TempLoc = GetRandomLocInRect (udg_SpawnFields[6])
udg_SpawnCap = udg_SpawnCap + udg_MonsterPointsTierLvl[4]
CreateUnitAtLoc(Player(21), FourCC("n006"), udg_TempLoc, 0.)
RemoveLocation (udg_TempLoc)
end
if UnitAlive(udg_SpawnBuildings[1]) == true and ModuloReal(I2R(udg_SpawnSeconds), 25.00) == 24.00 then
--// Beast Spawn
udg_TempLoc = GetRandomLocInRect (udg_SpawnFields[1])
udg_SpawnCap = udg_SpawnCap + udg_MonsterPointsTierLvl[5]
CreateUnitAtLoc(Player(23), FourCC("n005"), udg_TempLoc, 0.)
RemoveLocation (udg_TempLoc)
end
if ModuloReal(I2R(udg_SpawnSeconds), 25.00) == 23.00 then
--// Beast Spawn
udg_TempLoc = GetPlayerStartLocationLoc (Player(21))
udg_SpawnCap = udg_SpawnCap + udg_MonsterPointsTierLvl[5]
CreateUnitAtLoc(Player(23), FourCC("n00A"), udg_TempLoc, 0.)
RemoveLocation (udg_TempLoc)
end
MultiboardSetItemValueBJ( udg_MultiboardGame, 3, 1, I2S(udg_SpawnCap) )
end
function InitTrig_Enemy_Spawn()
gg_trg_Enemy_Spawn = CreateTrigger( )
TriggerRegisterTimerEventPeriodic( gg_trg_Enemy_Spawn, 8.00 )
TriggerAddCondition( gg_trg_Enemy_Spawn, Condition( Trig_Enemy_Spawn_Conditions() ) )
TriggerAddAction( gg_trg_Enemy_Spawn, Trig_Enemy_Spawn_Actions() )
end
Last edited: