Here's the chunk:
Code: Select all
ScriptCB_PlayInGameMusic("ssv_prg_amb_obj1_1_explore") -- begin playing first spawn music
DisableBarriers("Ambush1_1"); -- make it so friendly ai can enter ambush arena
DisableBarriers("Ambush1_2");
ActivateRegion("ambush_1") -- begin first ambush wave
ambushSquad1 = OnEnterRegion(
function(region, player)
print("AIGoal:: ambush_1") -- ai goals
ClearAIGoals(3)
AddAIGoal(3, "Defend", 200, 0)
ClearAIGoals(2)
AddAIGoal(2, "Destroy", 500, 0)
AddAIGoal(2, "Deathmatch", 500)
BlockPlanningGraphArcs("Connection42"); -- ai aren't supposed to wander out of their closed-off positions
BlockPlanningGraphArcs("Connection43");
BlockPlanningGraphArcs("Connection44");
BlockPlanningGraphArcs("Connection45");
BlockPlanningGraphArcs("Connection46");
BlockPlanningGraphArcs("Connection47");
EnableBarriers("Ambush1_1"); -- enclose ambush arena so ai can't run away
EnableBarriers("Ambush1_2");
ScriptCB_PlayInGameMusic("ssv_prg_amb_obj1_1_combat") -- begin playing combat music on ambush
ShowMessageText("level.PRG.debug.ambush1a")
end,
"ambush_1"
)
SetupAmbushTrigger("ambush_1", "gth_troop_1", 4, 2) -- ambush1a trigger: regionName=ambush_1, pathName=gth_troop_1, numDudes=4, teamNum=2
geth_count_1a = 4 -- amount of units to subtract from in ambush1a
Ambush1aGethKill = OnObjectKill(
function(object, killer)
if killer and GetObjectTeam(object) == 2 then -- defines team to subtract units from; in this case team 2
geth_count_1a = geth_count_1a - 1 -- subtract geth_count1a by 1 upon each kill made towards ambush wave
if geth_count_1a == 1 then -- once ambush1a unit count reaches 1, initiate ambush1b
ClearAIGoals(4)
AddAIGoal(4, "Destroy", 500, 0) -- ai goals
AddAIGoal(4, "Deathmatch", 500)
Ambush("gth_troop_1", 4, 4) -- ambush1b: pathName=gth_troop_1, numDudes=4, teamNum=4
ShowMessageText("level.PRG.debug.ambush1b")
geth_count_1b = 4 -- amount of units to subtract from in ambush1b
Ambush1bGethKill = OnObjectKill(
function(object, killer)
if killer and GetObjectTeam(object) == 4 then -- defines team to subtract units from; in this case team 4
geth_count_1b = geth_count_1b - 1 -- subtract geth_count1b by 1 upon each kill made towards ambush wave
if geth_count_1b == 2 then -- once ambush1b unit count reaches 2, initiate ambush1c
ClearAIGoals(2)
ClearAIGoals(4)
AddAIGoal(2, "Destroy", 500, 0) -- ai goals
AddAIGoal(2, "Deathmatch", 500)
AddAIGoal(4, "Destroy", 500, 0)
AddAIGoal(4, "Deathmatch", 500)
Ambush("gth_troop_1", 3, 2) -- ambush1c: pathName=gth_troop_1, numDudes=3, teamNum=2
Ambush("gth_troop_1", 1, 4) -- ambush1c: pathName=gth_troop_1, numDudes=1, teamNum=4
ShowMessageText("level.PRG.debug.ambush1c")
geth_count_1c = 4 -- amount of units to subtract from in ambush1c; sum of units from team 2 and team 4
Ambush1c2GethKill = OnObjectKill(
function(object, killer)
if killer and GetObjectTeam(object) == 2 then -- defines team to subtract units from; in this case team 2
geth_count_1c = geth_count_1c - 1 -- subtract geth_count1c by 1 upon each kill made towards team 2 in ambush1c
Ambush1c4GethKill = OnObjectKill(
function(object, killer)
if killer and GetObjectTeam(object) == 4 then -- defines team to subtract units from; in this case team 4
geth_count_1c = geth_count_1c - 1 -- subtract geth_count1c by 1 upon each kill made towards team 4 in ambush1c
if geth_count_1c == 0 then -- once the amount of units in ambush1c reahces 0 play the explore music
ShowMessageText("level.PRG.debug.ambush1end")
ScriptCB_PlayInGameMusic("ssv_prg_amb_obj1_2_explore") -- begin playing explore music
end
end
end
)
end
end
)
--
-- THE FOLLOWING IS COMMENTED AND REDACTED
--[[geth_count_1c = 4
Ambush1c2GethKill = OnObjectKill(
function(object, killer)
if killer and GetObjectTeam(object) == 2 + 4 then -- argh, the problem is I don't know how to "pair" the two teams: 2 & 4
geth_count_1c = geth_count_1c - 1
if geth_count_1c == 0 then
ShowMessageText("level.PRG.debug.ambush1end")
ScriptCB_PlayInGameMusic("ssv_prg_amb_obj1_2_explore")
end
end
end
)]]
--[[geth_count_1c2 = 3
geth_count_1c4 = 1
Ambush1c2GethKill = OnObjectKill(
function(object, killer)
if killer and GetObjectTeam(object) == 2 then
geth_count_1c2 = geth_count_1c2 - 1
end
end
)
Ambush1c4GethKill = OnObjectKill(
function(object, killer)
if killer and GetObjectTeam(object) == 4 then
geth_count_1c4 = geth_count_1c4 - 1
end
end
)
geth_count_1c = geth_count_1c2 + geth_count_1c4
if geth_count_1c == 0 then
ShowMessageText("level.PRG.debug.ambush1end")
ScriptCB_PlayInGameMusic("ssv_prg_amb_obj1_2_explore")
end]]
end
end
end
)
end
end
end
)https://dl.dropbox.com/u/38430663/Mass%20Effect%20Mod/Troubleshooting/ambush_chunk.lua
So this all works...almost. The second explore music plays when there are usually one or two geth remaining in ambush1c; it's not supposed to play until after there are no geth units remaining.



