Page 1 of 1

Objective sequence does not start [Solved]

Posted: Mon Dec 21, 2009 11:03 pm
by Eggman
This is a really simple scripting problem I should be able to fix on my own, but I just cannot find where the error is, so I need an extra set of eyes.

The map loads up fine, but as the topic title says, the objective sequence doesn't start. Here's the error message:

Code: Select all

Message Severity: 3
.\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to index global `objectivesequence' (a nil value)
stack traceback:
	(none): in function `BeginObjectives'
	(none): in function <(none):63>
And here's the relevant portion of the script:
Hidden/Spoiler:
[code]
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_SetGameRules("campaign")
ScriptCB_DoFile("Ambush")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("ObjectiveCTF")

-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;
AmbushTeam = 3
ATM = AmbushTeam
AmbushTeam2 = 4
AT2 = AmbushTeam2
AmbushTeam3 = 5
AT3 = AmbushTeam3
AmbushTeam4 = 6
AT4 = AmbushTeam4
AmbushTeam5 = 7
AT5 = AmbushTeam5


function ScriptPostLoad()


--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "cp1c"}
cp2 = CommandPost:New{name = "cp2c"}
cp3 = CommandPost:New{name = "cp3c"}
cp4 = CommandPost:New{name = "cp4c"}

ScriptCB_SetGameRules("campaign")
SetAIDifficulty(0, 0, "medium")
DisableAIAutoBalance()

KillObject("cp4c")


--This delays the objectives until the player spawns
onfirstspawn = OnCharacterSpawn(
function(character)
if IsCharacterHuman(character) then
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil

ScriptCB_PlayInGameMusic("rep_fel_amb_obj1_3_explore")
ShowMessageText("level.al6.intro")
onfirstspawn = nil
start_timer = CreateTimer("start_timer")
SetTimerValue(start_timer, 2)
StartTimer(start_timer)
begin_objectives = OnTimerElapse(
function()
BeginObjectives()
ReleaseTimerElapse(begin_objectives)
begin_objectives = nil
end,
start_timer
)
end

end)

ActivateRegion("gunship1")
gunship1 = OnLeaveRegion(
function(region, player)
PlayAnimation("gunship1")
DeactivateRegion("gunship1")
KillObject("cp1c")
RespawnObject("cp4c")
end,
"gunship1"
)


--Objective 1: Reach the shore
Objective1 = ObjectiveGoto:New{teamATT = ATT, teamDEF = DEF, text = "level.al6.objectives.1", popupText = "level.al6.objectives.campaign.1_popup", AIGoalWeight = 0, regionName = "objective1"}

Objective1.OnStart = function(self)
att_obj1_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj1_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
AICanCaptureCP("cp2c", DEF, false)
SetProperty("cp2c", "Team", 2)

end

Objective1.OnComplete = function(self)
DeleteAIGoal(att_obj1_aigoal)
DeleteAIGoal(def_obj1_aigoal)
ShowMessageText("game.objectives.complete")
MapRemoveEntityMarker("goto")

end

--Objective 2: Find cover at the bottom of the hill
Objective2 = ObjectiveGoto:New{teamATT = ATT, teamDEF = DEF, text = "level.al6.objectives.2", popupText = "level.al6.objectives.campaign.2_popup", AIGoalWeight = 0, regionName = "objective2"}

Objective2.OnStart = function(self)
att_obj2_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj2_aigoal = AddAIGoal(DEF, "Deathmatch", 100)

end

Objective2.OnComplete = function(self)
DeleteAIGoal(att_obj2_aigoal)
DeleteAIGoal(def_obj2_aigoal)
ShowMessageText("game.objectives.complete")
MapRemoveEntityMarker("goto")

end

--Objective 3: Capture the top of the ridge
Objective3CP = CommandPost:New{name = "cp2c"}
Objective3 = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, text = "level.al6.objectives.3", popupText = "level.al6.objectives.campaign.3_popup", AIGoalWeight = 1000}
Objective3:AddCommandPost(Objective3CP)

Objective3.OnStart = function (self)

end

Objective3.OnComplete = function (self)

end

EnableSPHeroRules()

function BeginObjectives()
objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 7.0}
objectiveSequence:AddObjectiveSet(Objective1)
objectiveSequence:AddObjectiveSet(Objective2)
objectivesequence:AddObjectiveSet(Objective3)
objectiveSequence:Start()
end

end [/code]
Can anyone see what I'm missing?

Re: Objective sequence does not start

Posted: Mon Dec 21, 2009 11:43 pm
by 501st_commander
dont you need this?
Hidden/Spoiler:
SetAIDifficulty(2, -8, "medium")
AllowAISpawn(ATT, false)
AllowAISpawn(DEF, true)
EnableSPScriptedHeroes()
ScriptCB_SetGameRules("campaign")

onfirstspawn = OnCharacterSpawn(
function(character)
if character == 0 then
ShowPopup("level.geo1.hints.hints")
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
BeginObjectivesTimer()
ScriptCB_EnableCommandPostVO(0)

end
end)

Re: Objective sequence does not start

Posted: Tue Dec 22, 2009 12:26 pm
by Xavious
501st_commander wrote:dont you need this?
Hidden/Spoiler:
SetAIDifficulty(2, -8, "medium")
AllowAISpawn(ATT, false)
AllowAISpawn(DEF, true)
EnableSPScriptedHeroes()
ScriptCB_SetGameRules("campaign")

onfirstspawn = OnCharacterSpawn(
function(character)
if character == 0 then
ShowPopup("level.geo1.hints.hints")
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
BeginObjectivesTimer()
ScriptCB_EnableCommandPostVO(0)

end
end)
He has that.
Eggman wrote:

Code: Select all

function BeginObjectives()
   objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 7.0}
    objectiveSequence:AddObjectiveSet(Objective1)
    objectiveSequence:AddObjectiveSet(Objective2)
   objectivesequence:AddObjectiveSet(Objective3)
    objectiveSequence:Start()
end  
I'm fairly sure the problem is with the fifth line down in the section I quoted above. "Sequence" should be capitalized.

Re: Objective sequence does not start

Posted: Tue Dec 22, 2009 12:56 pm
by Eggman
Xavious wrote:
Eggman wrote:

Code: Select all

function BeginObjectives()
   objectiveSequence = MultiObjectiveContainer:New{delayVictoryTime = 7.0}
    objectiveSequence:AddObjectiveSet(Objective1)
    objectiveSequence:AddObjectiveSet(Objective2)
   objectivesequence:AddObjectiveSet(Objective3)
    objectiveSequence:Start()
end  
I'm fairly sure the problem is with the fifth line down in the section I quoted above. "Sequence" should be capitalized.
Wow, I would never have spotted that. Problem solved. :)