Campaign scripting partial fail

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

Campaign scripting partial fail

Post by wishihadaname »

Thank you everyone at GT for helping me figure out how to campaign script, so far I only have 1 objective but at least it works.... sort of.... I'm preatty sure my coding is spot on, what i'm having a problem with is that for some reason my localizations are not showing up. I get a [null] popup for all of the text that I had entered into the localization tool, and it also appears that the game is not recognising my rally point region and can't find the arrow pointer thingy for the hud.

here are the relavant error messages
Hidden/Spoiler:
Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(2264)
ShowPopup() has been depricated. Please remove all references to it in code

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(2523)
Timer "victoryTimer" not found

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(2523)
Timer "delayTimer" not found

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(635)
Entity "hud_objective_icon_circle" not found

Message Severity: 2
.\Source\ActiveRegion.cpp(186)
Region "rallypoint1" not found

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(2359)
Region "rallypoint1" not found

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(2359)
Region "rallypoint1" not found
and here is the mission chunk of my lua just in case I messed that up too
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)


--Get to the rally becon
Objective1 = ObjectiveGoto:New{TeamATT = ATT, TeamDEF = DEF,
text = "level.LPR.campaign.regroupend", popupText = "level.LPR.campaign.popup2",
regionName = "rallypoint1", mapIcon = "hud_objective_icon_circle", AIGoalWeight = 0}

Objective1:AddHint("level.geo1.hints.movement")
Objective1:AddHint("level.geo1.hints.obj_markers")
Objective1:AddHint("level.geo1.hints.review_objectives")
Objective1:AddHint("level.geo1.hints.sprint")


Objective1.OnStart = function(self)
att_obj1_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj1_aigoal = AddAIGoal(DEF, "Deathmatch", 100)
MapAddEntityMarker("hud_objective_icon_circle", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)

end

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

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
Sorry for being such a nub, its my first attempt at a campaign.
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Campaign scripting partial fail

Post by Fiodis »

Perhaps you could toss in an AcitvateRegion prior to trying to stick a marker to it?
User avatar
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

Re: Campaign scripting partial fail

Post by wishihadaname »

I don't think that's the problem, i've looked at some examples of vanilla missions and they don't use that function before setting a goto objective. Also it doesn't help with getting my localizations working. IDK ill try it and report back in a bit.

edit1: I've looked through my lua and found this line right below the SetMemoryPool lines, what does it do and do I need to change it?

ReadDataFile("dc:LPR\\LPR.lvl", "LPR_conquest")
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: Campaign scripting partial fail

Post by [RDH]Zerted »

wishihadaname wrote:...ReadDataFile("dc:LPR\\LPR.lvl", "LPR_conquest")
LPR_conquest corresponds to the game mode configured in ZE. The line is saying to load all level/layer data included in LPR_conquest. This is the line that actually loads your physical map.

You never give MapAddEntityMarker an object to put the marker on. Its first parameter is supposed to be the object you want it point at. Instead, you gave it hud_objective_icon_circle. Also, MapRemoveEntityMarker's parameter is supposed to be the object you're removing the marker from too.
User avatar
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

Re: Campaign scripting partial fail

Post by wishihadaname »

ohh.......... so if my region is located in the campaign layer then I need to add a line to tell the script to read the campaign layer of ZE too right?
User avatar
bobfinkl
Rebel Colonel
Rebel Colonel
Posts: 593
Joined: Sun Jul 13, 2008 9:01 am
Projects :: Lots of unreleased stuff
Games I'm Playing :: Life
xbox live or psn: No gamertag set
Location: The quaint little city gametoast.

Re: Campaign scripting partial fail

Post by bobfinkl »

wishihadaname wrote:add a line to tell the script to read the campaign layer of ZE too right?
No, you can't load more than one layer like that at a time, you have to use either the campaign layer or conquest layer (I highly suggest the campaign layer).
User avatar
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

Re: Campaign scripting partial fail

Post by wishihadaname »

Ok, thank you, I've got one last problem though. It seems that my localization tool has now been saving the localizations I made. Whats the differance between scopes and keys? I think I may have used them backwards. Because I added LPR as a scope under level and the added my messages and popups as keys under LPR. But when I save, exit out of the localizer and then open it again, everything except LPR is gone.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Campaign scripting partial fail

Post by Maveritchell »

bobfinkl wrote:
wishihadaname wrote:add a line to tell the script to read the campaign layer of ZE too right?
No, you can't load more than one layer like that at a time, you have to use either the campaign layer or conquest layer (I highly suggest the campaign layer).
Gee shucks, that is funny, I am going to have to tell a couple of my working scripts that they need to stop working, because they shouldn't be. :wink:
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Campaign scripting partial fail

Post by Fiodis »

Don't you always load at least two (base and one mode) anyway (unless you set it up not to)?
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: Campaign scripting partial fail

Post by [RDH]Zerted »

No, one normally includes the base layer into the ZE configured game mode.

You can load multiple game modes. It's quite interesting to load an enclosed map into a space or land map. You can easily do that with the FakeConsole's code input command.
User avatar
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

Re: Campaign scripting partial fail

Post by wishihadaname »

Ok well I made a bit of a mistake when I placed objects. I played EVERYTHING into the conquest layer. Is there some way to make it so that campaign uses both the camapaign layer and the conquest layer? I intended the conquest to be a much smaller map then the campaign so I don't really want to just have the same layer for both game modes.
User avatar
KnightsFan
Second Lance Corporal
Second Lance Corporal
Posts: 108
Joined: Fri Mar 06, 2009 9:34 pm

Re: Campaign scripting partial fail

Post by KnightsFan »

I believe you can just add more layers into the ReadDataFile piece, using the same syntax as with units. I can't seem to find where I saw this, though, so it may not work...

So change
ReadDataFile("ABC\\ABC.lvl", "ABC_conquest")
to
ReadDataFile("ABC\\ABC.lvl", "ABC_conquest", "ABC_campaign")

or whatever your world/layers are named.
User avatar
bobfinkl
Rebel Colonel
Rebel Colonel
Posts: 593
Joined: Sun Jul 13, 2008 9:01 am
Projects :: Lots of unreleased stuff
Games I'm Playing :: Life
xbox live or psn: No gamertag set
Location: The quaint little city gametoast.

Re: Campaign scripting partial fail

Post by bobfinkl »

Maveritchell wrote:Gee shucks, that is funny, I am going to have to tell a couple of my working scripts that they need to stop working, because they shouldn't be.
That gave me a good laugh, but a bit more on-topic, must be another one of the random unfixable bugs I've been getting recently.
Post Reply