How to Make a Multi-map Map Pack [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
User avatar
RED51
Jedi
Jedi
Posts: 1024
Joined: Sun Sep 07, 2008 6:25 pm
Games I'm Playing :: SWBFII

How to Make a Multi-map Map Pack [Solved]

Post by RED51 »

My Q was solved, and since all the info was all around the place, I'll make a tut that will show you how to do this.
First Part: How to make a multi map map pack (NOTE: replace the name's; PFE, BCT, TML, and PIV with your three letter map id)

Step1: making the addme
Open up your addme(found in data_PFE/addme) and scroll to this part;
Hidden/Spoiler:
[code]--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 = "PFE%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

-- 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("PFE","PFEe_con",4)
AddDownloadableContent("PFE","PFEe_ctf",4)
[/code]
and remove the map pack's name and replace it with the first map you want to be in this pack, like so:
Hidden/Spoiler:
[quote]
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "BCT%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

-- 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("BCT","BCTe_con",4)
AddDownloadableContent("BCT","BCTe_ctf",4)
[/quote]
Then put the name's of the other maps in there like so:
Hidden/Spoiler:
[quote]sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "BCT%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "TML%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "PIV%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

-- 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("BCT","BCTe_con",4)
AddDownloadableContent("BCT","BCTe_ctf",4)
AddDownloadableContent("PIV","PIVe_con",4)
AddDownloadableContent("PIV","PIVe_ctf",4)
AddDownloadableContent("TML","TMLe_con",4)
AddDownloadableContent("TML","TMLe_ctf",4)[/quote]
Next, you need to change these numbers in order to have all the map names show up in the instant action map list:
Hidden/Spoiler:
[quote]sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "BCT%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
sp_missionselect_listbox_contents[sp_n+2] = { isModLevel = 1, mapluafile = "TML%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
sp_missionselect_listbox_contents[sp_n+3] = { isModLevel = 1, mapluafile = "PIV%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

-- 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("BCT","BCTe_con",4)
AddDownloadableContent("BCT","BCTe_ctf",4)
AddDownloadableContent("PIV","PIVe_con",4)
AddDownloadableContent("PIV","PIVe_ctf",4)
AddDownloadableContent("TML","TMLe_con",4)
AddDownloadableContent("TML","TMLe_ctf",4)[/quote]
Then, add these lines if you want to have all these maps in the mulit player map list:
Hidden/Spoiler:
[quote]sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "BCT%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
sp_missionselect_listbox_contents[sp_n+2] = { isModLevel = 1, mapluafile = "TML%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
sp_missionselect_listbox_contents[sp_n+3] = { isModLevel = 1, mapluafile = "PIV%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]
mp_missionselect_listbox_contents[mp_n+2] = sp_missionselect_listbox_contents[sp_n+2]
mp_missionselect_listbox_contents[mp_n+3] = sp_missionselect_listbox_contents[sp_n+3]


-- 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("BCT","BCTe_con",4)
AddDownloadableContent("BCT","BCTe_ctf",4)
AddDownloadableContent("PIV","PIVe_con",4)
AddDownloadableContent("PIV","PIVe_ctf",4)
AddDownloadableContent("TML","TMLe_con",4)
AddDownloadableContent("TML","TMLe_ctf",4)[/quote]
Step2:setting up the reqs
go into the commom folder, and open up the mission req, and scroll to these lines:
Hidden/Spoiler:
[code] REQN
{
"lvl"
"PFEe_con"
"PFEe_ctf"
}
}[/code]
And add in these lines
Hidden/Spoiler:
[code] REQN
{
"lvl"
"BCTe_con"
"BCTe_ctf"
"PIVe_con"
"PIVe_ctf"
"TMLe_con"
"TMLe_ctf"
}
}[/code]
Next, go into the mission folder and make these reqs:
PIVe_con, TMLe_con, BCTe_con.
In the req's, put these lines:
Hidden/Spoiler:
[code]ucft
{
REQN
{

"config"
"cor_movies"

}

REQN
{
"script"
"BCTe_con"
}
}
[/code]
Step 3: putting on the scripts

go back to your maps script folder(i.e.: BF2_modtools/data_BCT/common/scripts/BCT) and remove the abc folder and put it in the map packs script folder.(NOTE: replace abc with your map name)

Step 4: bringing the worlds
go back to data_BCT and go into the world folder. Remove the BCT folder and put it in the map packs world folder.

And your done! If there was a mistake in the tut, then feel free to edit the post.
Last edited by RED51 on Sat Oct 11, 2008 3:29 pm, edited 1 time in total.
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: How do I make a multi map pack addme/lua?

Post by [RDH]Zerted »

Just combine the addme luas. Do you still have your old attempt? If so, post it.
User avatar
RED51
Jedi
Jedi
Posts: 1024
Joined: Sun Sep 07, 2008 6:25 pm
Games I'm Playing :: SWBFII

Re: How do I make a multi map pack addme/lua?

Post by RED51 »

No...I've seemed to have lost that addme file...but I do have the lastest one. here it is:
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




--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 = "cor1%s_%s", "BCT%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

-- 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","cor1e_con",4)
AddDownloadableContent("cor1","cor1e_ctf",4)
AddDownloadableContent("geo1","geo1e_hunt",4)
AddDownloadableContent("geo1","geo1e_xl",4)
AddDownloadableContent("kas2","kas2e_uber",4)
AddDownloadableContent("BCT","BCTe_con",4)
AddDownloadableContent("BCT","BCTe_ctf",4)

-- all done
newEntry = nil
n = nil

-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\PFE\\data\\_LVL_PC\\core.lvl")
[/code]
As you can read, I'm also trying to add a new era.

Here's a new addme file:
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




--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 = "cor1%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "geo1%s_%s", era_e = 1, mode_xl_e = 1, mode_hunt_e = 1,}
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "kas%s_%s", era_e = 1, mode_uber_e = 1,}
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "BCT%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

-- 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","cor1e_con",4)
AddDownloadableContent("cor1","cor1e_ctf",4)
AddDownloadableContent("geo1","geo1e_hunt",4)
AddDownloadableContent("geo1","geo1e_xl",4)
AddDownloadableContent("kas2","kas2e_uber",4)
AddDownloadableContent("BCT","BCTe_con",4)
AddDownloadableContent("BCT","BCTe_ctf",4)

-- all done
newEntry = nil
n = nil

-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\PFE\\data\\_LVL_PC\\core.lvl")
[/code]
Also, there's a bug with the new era thing. The era icon shows up in the cor map mode selection, but it won't let me put it on the map play list. This new addme only has the BCT level showing up, where the last one had the above bug. It would just really save ne some time if Mav or someone who helped put in the kotor era just show me there addme.

You never need to bump to add in new information - especially when the post is only three hours old. Just edit your old post. -Staff
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: How do I make a multi map pack addme/lua?

Post by [RDH]Zerted »

RED51 wrote:

Code: Select all

sp_n = table.getn(sp_missionselect_listbox_contents)  --gets the length of the sp table

sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "cor1%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "geo1%s_%s", era_e = 1, mode_xl_e = 1, mode_hunt_e = 1,}
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "kas%s_%s", era_e = 1, mode_uber_e = 1,}
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "BCT%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}

mp_n = table.getn(mp_missionselect_listbox_contents)  --gets the length of the mp table
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]
Only BCT is showing up because you only stored the BCT in the listbox (sp_missionselect_listbox_contents). The listbox is a table/array. Notice the sp_n+1? That says the location in the table to store the data. sp_n is equal to the amount of maps already in the table, and the +1 means to put your map the last map. However, you keep putting your map at the same spot in the table, thus overwriting the map you put there before. You need to increment the spot you are storing the map, so you want to use sp_n+2 for GEO, sp_n+3 for KAS, etc... Understand?

You will also need to do the same thing for the mp_missionselect_listbox_contents (so you will have 4 mp = sp listbox lines).
User avatar
RED51
Jedi
Jedi
Posts: 1024
Joined: Sun Sep 07, 2008 6:25 pm
Games I'm Playing :: SWBFII

Re: How do I make a multi map pack addme/lua?

Post by RED51 »

It worked...sort've. :? Now there's a new bug. Here's a pic of the new bug:
Image
As you can see, there's two kas and geos(cor is also has this bug). How do I fix that? Oh, BCT works, so there's one problem solved.
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: How do I make a multi map pack addme/lua?

Post by Frisbeetarian »

There's no bug there, it did exactly what you told it to do. You said isModLevel = 1, so it made a mode level of the scripts cor1, geo1, and kas. I'm guessing, however that the replica maps aren't perfect copies of each other, the copy probably has the new modes you added while the old one doesn't.
Are you trying to add an era and modes to the preexisting cor, geo, and kas?
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: How do I make a multi map pack addme/lua?

Post by [RDH]Zerted »

RED51 wrote:As you can see, there's two kas and geos(cor is also has this bug). How do I fix that?
--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
Frisbeetarian wrote:You said isModLevel = 1, so it made a mode level of the scripts cor1, geo1, and kas...
No, isModLevel is just a variable the game uses to help determine map colors. The maps were added as new map entries, so they have their own line. If thats not what you wanted, then you want to use AddNewGameModes() instead of the 'sp/mp listbox[#] = { xxx=xxx, }'.

missionList is one of those sp/mp tables (you will need to do it for both)
mapName is the value of your mapluafile
newFlags is a table of everything you are changing/adding. Example: {era_e = 1, mode_uber_e = 1,}
User avatar
RED51
Jedi
Jedi
Posts: 1024
Joined: Sun Sep 07, 2008 6:25 pm
Games I'm Playing :: SWBFII

Re: How do I make a multi map pack addme/lua?

Post by RED51 »

Completely under stood what you said, but have no idea how to excute...what/where do I type in?
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: How do I make a multi map pack addme/lua?

Post by [RDH]Zerted »

Code: Select all

--add my modes to the singleplayer map selection screen
AddNewGameModes( sp_missionselect_listbox_contents, "cor1%s_%s", {era_e = 1, mode_con_e = 1, mode_ctf_e = 1,} )
AddNewGameModes( sp_missionselect_listbox_contents, "geo1%s_%s", {era_e = 1, mode_xl_e = 1, mode_hunt_e = 1,} )
AddNewGameModes( sp_missionselect_listbox_contents, "kas%s_%s", {era_e = 1, mode_uber_e = 1,} )

--add my modes to the multiplayer map selection screen
AddNewGameModes( mp_missionselect_listbox_contents, "cor1%s_%s", {era_e = 1, mode_con_e = 1, mode_ctf_e = 1,} )
AddNewGameModes( mp_missionselect_listbox_contents, "geo1%s_%s", {era_e = 1, mode_xl_e = 1, mode_hunt_e = 1,} )
AddNewGameModes( mp_missionselect_listbox_contents, "kas%s_%s", {era_e = 1, mode_uber_e = 1,} )

--add my new map and its modes to both SP and MP
mp_n = table.getn(mp_missionselect_listbox_contents)  --gets the length of the mp table
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "BCT%s_%s", era_e = 1, mode_con_e = 1, mode_ctf_e = 1,}
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]
For the map names, I am unsure if it should be like cor1%s_%s or only cor1. You still need to do the AddDownloadableContent() calls.
User avatar
RED51
Jedi
Jedi
Posts: 1024
Joined: Sun Sep 07, 2008 6:25 pm
Games I'm Playing :: SWBFII

Re: How do I make a multi map pack addme/lua?

Post by RED51 »

It works!! Before this is locked, I'm gona make a tut on how to do this.
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: How do I make a multi map pack addme/lua?

Post by Frisbeetarian »

[RDH]Zerted wrote:No, isModLevel is just a variable the game uses to help determine map colors.
Ah, got it.

I also wanted to throw out there that I've gotten it to work without using the AddNewGameModes script. I just created a new map, used the shipped map's name for the new maps Lua (might not be necessary), loaded any layers in this Lua from the shipped map, then put it into the addme.lua just like I normally would with one small change, for the AddDownloadableContent line, I use the shipped map's lvl file name instead of the mod map's.
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: How do I make a multi map pack addme/lua?

Post by [RDH]Zerted »

RED51 wrote:It works!! Before this is locked, I'm gona make a tut on how to do this.
Then edit your first post and stick it there. There is no reason to lose these good posts or start another topic.

Edit: You forgot to also increment mp_n+1. I changed that in your post, but don't forget to update your script if you need to.
Post Reply