here is my mission lua
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
-- load the gametype script
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_DoFile("ObjectiveCTF")
ScriptCB_DoFile("ObjectiveTDM")
ScriptCB_DoFile("Ambush")
ScriptCB_DoFile("setup_teams")
-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;
function ScriptPostLoad()
SetAIDifficulty(0, 2, "hard")
AllowAISpawn(ATT, false)
AllowAISpawn(DEF, false)
EnableSPScriptedHeroes()
ScriptCB_SetGameRules("campaign")
DisableAIAutoBalance()
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
onfirstspawn = OnCharacterSpawn(
function(character)
if character == 0 then
ShowPopup("level.LPR.campaign.popup1")
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
BeginObjectivesTimer()
ScriptCB_EnableCommandPostVO(0)
ShowMessageText("level.LPR.campaign.regroup1", ATT)
end
end)
--dissable some CP's
KillObject ("cp3")
KillObject ("cp1")
KillObject ("cp2")
--Get to the rally becon
Objective1 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
text = "level.LPR.campaign.regroupend1", popupText = "level.LPR.campaign.popup1",
regionName = "goto1", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}
Objective1.OnStart = function(self)
att_obj1_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj1_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
MapAddEntityMarker("rep_walk_atte_beacon", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)
end
Objective1.OnComplete = function(self)
DeleteAIGoal(att_obj1_aigoal)
DeleteAIGoal(def_obj1_aigoal)
RespawnObject("cp3")
RespawnObject("cp2")
ShowMessageText("game.objectives.complete", ATT)
MapRemoveEntityMarker("rep_walk_atte_beacon")
ATTReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATTReinforcementCount + 40)
end
end
-- Hold the rally point
Objective2CP = CommandPost:New{name = "cp3", hideCPs = false}
Objective2 = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, textATT = "level.LPR.campaign.objective2", popupText = "level.LPR.campaign.popup3", timeLimit = 240, timeLimitWiningTeam = ATT}
Objective2.OnStart = function (self)
DEFGoal = AddAIGoal (DEF,"Conquest", 100, "cp3")
ATTGoal = AddAIGoal (ATT,"Defend", 100, "cp3")
MapAddEntityMarker("cp3", "hud_objective_icon_circle", 4.0, ATT, "YELLOW", true)
SetProperty ("cp3", "AISpawnWeight", 100)
KillObject ("cp4")
Objective2.OnComplete = function (self)
MapRemoveEntityMarker("cp3")
OBJ2_ReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, OBJ2_ReinforcementCount + 45)
DeleteAIGoal(DEFGoal)
DeleteAIGoal(ATTGoal)
end
end
function BeginObjectivesTimer()
beginobjectivestimer = CreateTimer("beginobjectivestimer")
OnTimerElapse(BeginObjectives, beginobjectivestimer)
SetTimerValue(beginobjectivestimer, 5)
StartTimer(beginobjectivestimer)
end
function BeginObjectives()
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 5}
objectiveSequence:AddObjectiveSet(Objective1)
objectiveSequence:Start()
end
---------------------------------------------------------------------------
-- FUNCTION: ScriptInit
-- PURPOSE: This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES: The name, 'ScriptInit' is a chosen convention, and each
-- mission script must contain a version of this function, as
-- it is called from C to start the mission.
---------------------------------
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
-- load the gametype script
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_DoFile("ObjectiveCTF")
ScriptCB_DoFile("ObjectiveTDM")
ScriptCB_DoFile("Ambush")
ScriptCB_DoFile("setup_teams")
-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;
function ScriptPostLoad()
SetAIDifficulty(0, 2, "hard")
AllowAISpawn(ATT, false)
AllowAISpawn(DEF, false)
EnableSPScriptedHeroes()
ScriptCB_SetGameRules("campaign")
DisableAIAutoBalance()
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
onfirstspawn = OnCharacterSpawn(
function(character)
if character == 0 then
ShowPopup("level.LPR.campaign.popup1")
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
BeginObjectivesTimer()
ScriptCB_EnableCommandPostVO(0)
ShowMessageText("level.LPR.campaign.regroup1", ATT)
end
end)
--dissable some CP's
KillObject ("cp3")
KillObject ("cp1")
KillObject ("cp2")
--Get to the rally becon
Objective1 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
text = "level.LPR.campaign.regroupend1", popupText = "level.LPR.campaign.popup1",
regionName = "goto1", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}
Objective1.OnStart = function(self)
att_obj1_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj1_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
MapAddEntityMarker("rep_walk_atte_beacon", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)
end
Objective1.OnComplete = function(self)
DeleteAIGoal(att_obj1_aigoal)
DeleteAIGoal(def_obj1_aigoal)
RespawnObject("cp3")
RespawnObject("cp2")
ShowMessageText("game.objectives.complete", ATT)
MapRemoveEntityMarker("rep_walk_atte_beacon")
ATTReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATTReinforcementCount + 40)
end
end
-- Hold the rally point
Objective2CP = CommandPost:New{name = "cp3", hideCPs = false}
Objective2 = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, textATT = "level.LPR.campaign.objective2", popupText = "level.LPR.campaign.popup3", timeLimit = 240, timeLimitWiningTeam = ATT}
Objective2.OnStart = function (self)
DEFGoal = AddAIGoal (DEF,"Conquest", 100, "cp3")
ATTGoal = AddAIGoal (ATT,"Defend", 100, "cp3")
MapAddEntityMarker("cp3", "hud_objective_icon_circle", 4.0, ATT, "YELLOW", true)
SetProperty ("cp3", "AISpawnWeight", 100)
KillObject ("cp4")
Objective2.OnComplete = function (self)
MapRemoveEntityMarker("cp3")
OBJ2_ReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, OBJ2_ReinforcementCount + 45)
DeleteAIGoal(DEFGoal)
DeleteAIGoal(ATTGoal)
end
end
function BeginObjectivesTimer()
beginobjectivestimer = CreateTimer("beginobjectivestimer")
OnTimerElapse(BeginObjectives, beginobjectivestimer)
SetTimerValue(beginobjectivestimer, 5)
StartTimer(beginobjectivestimer)
end
function BeginObjectives()
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 5}
objectiveSequence:AddObjectiveSet(Objective1)
objectiveSequence:Start()
end
---------------------------------------------------------------------------
-- FUNCTION: ScriptInit
-- PURPOSE: This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES: The name, 'ScriptInit' is a chosen convention, and each
-- mission script must contain a version of this function, as
-- it is called from C to start the mission.
---------------------------------








