Third Game Mode Not Appearing [Solved]

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
LitFam
Sergeant Major
Sergeant Major
Posts: 234
Joined: Sat Feb 04, 2017 5:52 pm
Games I'm Playing :: SWBF II 2005
xbox live or psn: No gamertag set
Location: Milky Way, Solar System, Earth, Antarctica

Third Game Mode Not Appearing [Solved]

Post by LitFam »

I added a third game mode to my map, however it does not show.

My addme
Hidden/Spoiler:
[code]--Search through the missionlist to find a map that matches mapName,
--then insert the new flags into said entry.
--Use this when you know the map already exists, but this content patch is just
--adding new gamemodes (otherwise you should just add whole new entries to the missionlist)
function AddNewGameModes(missionList, mapName, newFlags)
for i, mission in missionList do
if mission.mapluafile == mapName then
for flag, value in pairs(newFlags) do
mission[flag] = value
end
end
end
end

--Search through the missionlist to find a map that matches mapName,
--then insert the new flags into said entry.
--Use this when you know the map already exists, but this content patch is just
--adding new gamemodes (otherwise you should just add whole new entries to the missionlist)
function AddNewGameModes(missionList, mapName, newFlags)
for i, mission in missionList do
if mission.mapluafile == mapName then
for flag, value in pairs(newFlags) do
mission[flag] = value
end
end
end
end

--insert totally new maps here:
local sp_n = 0
local mp_n = 0

sp_n = table.getn(sp_missionselect_listbox_contents)

sp_missionselect_listbox_contents[sp_n+1] = {isModLevel = 1, mapluafile = "CHR%s_%s", era_c = 1, mode_con_c = 1,}

mp_n = table.getn(mp_missionselect_listbox_contents)

mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

AddNewGameModes( sp_missionselect_listbox_contents, "CHR%s_%s", {era_c = 1, mode_surv_c = 1, mode_wav_c, change = { mode_surv = { name="Boss Battle", about="A group of droids and a Elite Octuptarra Combat Tri Droid broke of from the main battle. Do you have the courage to face the droid garrison alone?", icon="mode_icon_survival",}, mode_wav = { name="Wave Mode (Republic)", about="Survive 10 Waves of CIS Scum!", icon="mode_icon_wav",}, era_c = { name="The Clone Wars"}, mode_con = { name="Battle of Christophsis", about="The Battle of Christophsis took place for control of the planet Christophsis during the Clone Wars."},},})

-- associate this mission name with the current downloadable content directory
-- (this tells the engine which maps are downloaded, so you need to include all new mission lua's here)
-- first arg: mapluafile from above
-- second arg: mission script name
-- third arg: level memory modifier. the arg to LuaScript.cpp: DEFAULT_MODEL_MEMORY_PLUS(x)

AddDownloadableContent("CHR","CHRc_con",4)
AddDownloadableContent("CHR","CHRc_surv",4)
AddDownloadableContent("CHR","CHRc_wav",4)

-- all done
newEntry = nil
n = nil

-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\CHR\\data\\_LVL_PC\\core.lvl")[/code]
my mission
Hidden/Spoiler:
[code]ucft
{
REQN
{
"config"
"ingame_movies"
}

REQN
{
"script"
"ObjectiveBossBattle"
"ObjectiveWaveMode"
"setup_teams"
"gametype_conquest"
"gametype_capture"
"Objective"
"MultiObjectiveContainer"
"ObjectiveCTF"
"ObjectiveAssault"
"ObjectiveSpaceAssault"
"ObjectiveConquest"
"ObjectiveTDM"
"ObjectiveOneFlagCTF"
"SoundEvent_ctf"
"ObjectiveGoto"
"LinkedShields"
"LinkedDestroyables"
"LinkedTurrets"
"Ambush"
"PlayMovieWithTransition"
}

REQN
{
"lvl"
"CHRc_con"
"CHRc_surv"
"CHRc_wav"
}
}[/code]
Last edited by LitFam on Tue Aug 22, 2017 3:32 am, edited 1 time in total.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: Third Game Mode Not Appearing

Post by Marth8880 »

Code: Select all

sp_missionselect_listbox_contents[sp_n+1] = {isModLevel = 1, mapluafile = "CHR%s_%s", era_c = 1, mode_con_c  = 1,}
See how in this table there's a key named "mode_con_c" with a value of 1? What that's saying is "this map supports Conquest (con) mode in the Clone Wars (c) era." With a little bit of critical thinking, it's safe to assume that there would also need to be a key for any other mode/era combinations you wish for your map to support. So for example, if you wanted your map to also support 2-flag CTF in the Clone Wars era, you would add a key named "mode_ctf_c" with a value of 1.

Before you ask, in order to add a key to the table you just move your cursor in between the last comma in the table and the closing curly bracket and type its name and value followed by a comma. Or in other words, right where my mouse cursor is shown in this image:
Image


Helpful resources:
https://www.lua.org/pil/11.3.html
https://www.lua.org/pil/11.1.html
https://www.lua.org/pil/3.6.html
LitFam
Sergeant Major
Sergeant Major
Posts: 234
Joined: Sat Feb 04, 2017 5:52 pm
Games I'm Playing :: SWBF II 2005
xbox live or psn: No gamertag set
Location: Milky Way, Solar System, Earth, Antarctica

Re: Third Game Mode Not Appearing

Post by LitFam »

I am an idoiot. :faint:

XD Thanks again marth!
Post Reply