Code: Select all
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveCTF")
ScriptCB_DoFile("Ambush")
ScriptCB_SetGameRules("campaign")
ScriptCB_SetSpawnDisplayGain(0.2, 0.5)
-- Empire Attacking (attacker is always #1)
local ALL = 2
local IMP = 1
-- These variables do not change
local ATT = 1
local DEF = 2
function ScriptPostLoad()
-- Here goes all objective related information.
-- Q: Should It be possible to play Rebels?
SetAIDifficulty(0, 2, "hard")
AddAIGoal(3, "Deathmatch", 100)
EnableSPScriptedHeroes()
-- Objective 1 Stuff -- Capture Gungan Lookout
Objective1CP = CommandPost:New{name = "CP3"}
Objective1 = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, text = "level.hoth.c.1", popupText = "level.hoth.c.pop.1"}
Objective1:AddCommandPost(Objective1CP)
Objective1.OnStart = function(self)
SetObjectTeam("CP6", 1)
--objectiveSequence.delayNextSetTime = 0.5
AICanCaptureCP("CP3", ATT, false)
ActivateRegion("trigger2")
RespawnObject("CP3")
Objective1.defendGoal2 = AddAIGoal(ATT, "Defend", 3000, "CP3");
Objective1.defendGoal1 = AddAIGoal(DEF, "Defend", 300, "CP3");
end
Objective1.OnComplete = function(self)
ShowMessageText("game.objectives.complete", ATT)
SetProperty("CP3", "SpawnPath", "Local_Spawn")
DeleteAIGoal(Objective1.defendGoal2)
DeleteAIGoal(Objective1.defendGoal1)
Ambush("rebels2", 8, 5)
ATT_ReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATT_ReinforcementCount + 50)
Rebels2Goal = AddAIGoal(5, "Defend", 3000, "ShieldGen")
if self.winningTeam == DEF then
ScriptCB_SndPlaySound("HOT_obj_09")
else
--play the win sound
ScriptCB_SndPlaySound("HOT_obj_13")
ScriptCB_PlayInGameMusic("imp_hot_objComplete_01")
-- Music Timer --
music01Timer = CreateTimer("music01")
SetTimerValue(music01Timer, 33.0)
StartTimer(music01Timer)
OnTimerElapse(
function(timer)
ScriptCB_StopInGameMusic("imp_hot_objComplete_01")
ScriptCB_PlayInGameMusic("imp_hot_amb_action_01")
DestroyTimer(timer)
end,
music01Timer
)
end
end
--Objective 2 Stuff- Assault
ShieldGen = Target:New{name = "ShieldGen"}
Objective2 = ObjectiveAssault:New{teamATT = ATT, teamDEF = DEF, text = "level.OIU.c.2", popupText = "level.OIU.c.pop.2", AIGoalWeight = 0.0}
Objective2:AddTarget(ShieldGen)
Objective2.OnStart = function(self)
--objectiveSequence.delayNextSetTime = 0.5
SetProperty("ShieldGen", "MaxHealth", 120000.0)
SetProperty("ShieldGen", "CurHealth", 120000.0)
SetAIDamageThreshold("ShieldGen", 0.2)
--GOALS--
Objective2.defendGoal1 = AddAIGoal(DEF, "Defend", 30, "ShieldGen")
Objective2.defendGoal2 = AddAIGoal(DEF, "Deathmatch", 100)
Objective2.defendGoal3 = AddAIGoal(ATT, "Destroy", 100, "ShieldGen")
--Objective2.defendGoal3 = AddAIGoal(ATT, "Deathmatch", 300)
Rebels2Goal = AddAIGoal(5, "Defend", 3000, "ShieldGen")
--Objective2.dmGoal1 = AddAIGoal(DEF, "Deathmatch", 500)
end
Objective2.OnComplete = function(self)
ShowMessageText("game.objectives.complete", ATT)
ATT_ReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATT_ReinforcementCount + 50)
-- DELETING GOALS--
DeleteAIGoal(Objective2.defendGoal1)
DeleteAIGoal(Objective2.defendGoal2)
DeleteAIGoal(Objective2.defendGoal3)
if self.winningTeam == DEF then
ScriptCB_SndPlaySound("HOT_obj_09")
else
--play the win sound
ATT_ReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATT_ReinforcementCount + 50)
end
end
function StartObjectives()
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 12.0}
objectiveSequence:AddObjectiveSet(Objective1)
objectiveSequence:AddObjectiveSet(Objective2)
objectiveSequence:Start()
end
endThanks in advance,Message Severity: 3
.\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to perform arithmetic on a nil value
stack traceback:
(none): in function `AddCommandPost'
(none): in function `ScriptPostLoad'
Soul -- Merry Christmas!!


