Adding New Modes [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
authraw
1st Lieutenant
1st Lieutenant
Posts: 445
Joined: Mon Jun 26, 2006 3:45 pm

Adding New Modes [Solved]

Post by authraw »

I want to add two hunt modes and two campaign modes to my map (one for each era.) Basically, I created the map with Hero Assault, Conquest, and 1-flag CTF modes. Then I went into data_DTH\Common\scripts\DTH and made four copies of one of the CTF modes. I renamed them to the following names:

DTH_c_c.lua
DTH_g_c.lua
DTH_c_hunt.lua
DTH_g_hunt.lua

I made no changes to these luas. Next, I went into data_DTH\addme and edited addme.lua:
--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 = "DTH%s_%s", era_g = 1, era_c = 1, mode_con_g = 1, mode_con_c = 1, mode_1flag_g = 1, mode_1flag_c = 1, mode_eli_g = 1, mode_hunt_g = 1, mode_hunt_c = 1, mode_c_c = 1, mode_c_g = 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("DTH","DTHg_con",4)
AddDownloadableContent("DTH","DTHc_con",4)
AddDownloadableContent("DTH","DTHg_hunt",4)
AddDownloadableContent("DTH","DTHc_hunt",4)
AddDownloadableContent("DTH","DTHg_c",4)
AddDownloadableContent("DTH","DTHc_c",4)

AddDownloadableContent("DTH","DTHg_1flag",4)
AddDownloadableContent("DTH","DTHc_1flag",4)
AddDownloadableContent("DTH","DTHg_eli",4)

-- all done
newEntry = nil
n = nil

-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\DTH\\data\\_LVL_PC\\core.lvl")
(The bold text is the new stuff)

I cleaned and munged. Now, hunt and campaign (both eras) appear in the menu selection, but when I try to run one of those modes, it gives me a FATAL ERROR and says that "DTHc_c cannot be read" (or whichever mode I try to run.) What did I miss?

If it helps, here are the errors in the BFront2.log:

Code: Select all

Message Severity: 3
.\Source\LoadUtil.cpp(1019)
Unable to find level chunk  in MISSION.lvl


Message Severity: 3
.\Source\LuaHelper.cpp(112)
OpenScript(DTHc_c): script (0c46e5ce) not found

Message Severity: 5
.\Source\GameState.cpp(1283)
Could not open MISSION\DTHc_c.lvl
So--yeah. What part of the puzzle did I miss?
Last edited by authraw on Sat Jun 02, 2007 11:42 pm, edited 1 time in total.
MasterSaitek009
Black Sun Slicer
Posts: 619
Joined: Wed Aug 23, 2006 4:10 pm

RE: Adding New Modes

Post by MasterSaitek009 »

First of all just to keep everything standard (and to make it so you're calling on the right thing in the addme.lua) rename your new LUAs to:
  • DTHc_c.lua
    DTHg_c.lua
    DTHc_hunt.lua
    DTHg_hunt.lua
That's the way they're normally formated.
Then go to your "common" folder and open "Mission.req". Add these to lines by the other ones like them (with the quotes):

Code: Select all

"DTHc_c"
"DTHg_c"
"DTHc_hunt"
"DTHg_hunt"
Then go to your "mission" folder inside the "common" folder and copy and paste your DTHg_con.req file four times, renaming them to these names
  • "DTHc_c.req"
    "DTHg_c.req"
    "DTHc_hunt.req"
    "DTHg_hunt.req"
Then open up those four new files and change there references inside, from "DTHg_con" to the names of the LUAs.
I hope that helps. I had troubles with this problem too. :D It's pretty complicated.
Last edited by MasterSaitek009 on Sat Jun 02, 2007 11:50 pm, edited 1 time in total.
User avatar
authraw
1st Lieutenant
1st Lieutenant
Posts: 445
Joined: Mon Jun 26, 2006 3:45 pm

RE: Adding New Modes

Post by authraw »

Yay, that worked! Thanks a lot. That is officially way too complicated. :P
MasterSaitek009
Black Sun Slicer
Posts: 619
Joined: Wed Aug 23, 2006 4:10 pm

RE: Adding New Modes

Post by MasterSaitek009 »

Your welcome! It seems like such a simple little thing but there were what, 30 steps involved? :D
Glad I could help!

BTW, I love your new avatar!
Post Reply