How does one add a map to the mod? [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

How does one add a map to the mod? [Solved]

Post by LitFam »

I have recently obtained the map I needed for my mod and I was wondering how I integrate it into my mod. I have localized the map name and description already, but its still not showing up. I have added the map script under common/mission.req I have also made a correct .req file in common/mission/JA1r_con.req

My .add me
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)

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, "cor1%s_%s", {era_r = 1, mode_con_r = 1, change = { era_r = { name="Star Wars: A New Frontier"},},})
AddNewGameModes( mp_missionselect_listbox_contents, "cor1%s_%s", {era_r = 1, mode_con_r = 1, change = { era_r = { name="Star Wars: A New Frontier"},},})

AddNewGameModes( sp_missionselect_listbox_contents, "dag1%s_%s", {era_r = 1, mode_con_r = 1, change = { era_r = { name="Star Wars: A New Frontier"},},})
AddNewGameModes( mp_missionselect_listbox_contents, "dag1%s_%s", {era_r = 1, mode_con_r = 1, change = { era_r = { name="Star Wars: A New Frontier"},},})

AddNewGameModes( sp_missionselect_listbox_contents, "dea1%s_%s", {era_r = 1, mode_con_r = 1, change = { era_r = { name="Star Wars: A New Frontier"},},})
AddNewGameModes( mp_missionselect_listbox_contents, "dea1%s_%s", {era_r = 1, mode_con_r = 1, change = { era_r = { name="Star Wars: A New Frontier"},},})

AddNewGameModes( sp_missionselect_listbox_contents, "end1%s_%s", {era_r = 1, mode_con_r = 1, change = { era_r = { name="Star Wars: A New Frontier"},},})
AddNewGameModes( mp_missionselect_listbox_contents, "end1%s_%s", {era_r = 1, mode_con_r = 1, change = { era_r = { name="Star Wars: A New Frontier"},},})

AddNewGameModes( sp_missionselect_listbox_contents, "hot1%s_%s", {era_r = 1, mode_con_r = 1, change = { era_r = { name="Star Wars: A New Frontier"},},})
AddNewGameModes( mp_missionselect_listbox_contents, "hot1%s_%s", {era_r = 1, mode_con_r = 1, change = { era_r = { name="Star Wars: A New Frontier"},},})

AddNewGameModes( sp_missionselect_listbox_contents, "tat2%s_%s", {era_r = 1, mode_eli_r = 1, mode_hunt_r = 1, change = { era_r = { name="Star Wars: A New Frontier"},},})
AddNewGameModes( sp_missionselect_listbox_contents, "tat2%s_%s", {era_r = 1, mode_eli_r = 1, mode_hunt_r = 1, change = { era_r = { name="Star Wars: A New Frontier"},},})

-- Extra Maps Down Below
-- Extra Maps Down Below

AddNewGameModes( sp_missionselect_listbox_contents, "JA1%s_%s", {era_r = 1, mode_con_r = 1, change = { era_r = { name="Star Wars: A New Frontier"},},})
AddNewGameModes( mp_missionselect_listbox_contents, "JA1%s_%s", {era_r = 1, mode_con_r = 1, change = { era_r = { name="Star Wars: A New Frontier"},},})

-- 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("cor1","cor1r_con",4)
AddDownloadableContent("dag1","dag1r_con",4)
AddDownloadableContent("dea1","dea1r_con",4)
AddDownloadableContent("end1","end1r_con",4)
AddDownloadableContent("hot1","hot1r_con",4)
AddDownloadableContent("tat2","tat2r_eli",4)
AddDownloadableContent("tat2","tat2r_hunt",4)

-- Extra Maps Down Below
-- Extra Maps Down Below

AddDownloadableContent("JA1","JA1r_con",4)

-- all done
newEntry = nil
n = nil

-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\RVF\\data\\_LVL_PC\\core.lvl")[/code]
EDIT

I figured it out.
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: How does one add a map to the mod? [Solved]

Post by Marth8880 »

Would you mind explaining what you did to resolve this issue? That way future modders who search for this problem and come across this thread won't be left frustrated and in the dark. ;)
Post Reply