Custom Era not working

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
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Custom Era not working

Post by Fiodis »

I tried following Sky's tutorial for adding a custom era to shipped maps. However, when I munge, VM says in a black popup box, something along the lines of "Error: LUA returned one." I'm not sure as to the exact wording, since it stayed up for perhaps three seconds, then vanished. VM didn't generate a munge log, at all. When I looked for it in the _BUILD folder, it wasn't there. When I tried to run the debugger, it crashed before it even got to the profile selection screen. It's error log said:

Code: Select all

Message Severity: 3
.\Source\LuaScript.cpp(435)
Script file addme not found
What's wrong? My mission.lvl in TER/data/lvl_pc is 134 KB. Is that small?
Darth_Spiderpig
Sith Master
Sith Master
Posts: 2631
Joined: Fri Mar 27, 2009 10:23 am
Projects :: Something cool...
Games I'm Playing :: BF2 CoDBO BFBC2
xbox live or psn: Has no xbox....Yup
Location: Does whatever a Spiderpig does
Contact:

Re: Custom Era not working

Post by Darth_Spiderpig »

Fiodis wrote:What's wrong? My mission.lvl in TER/data/lvl_pc is 134 KB. Is that small?
No, not really.

Well, my guess is that you have a bracket error somewhere, or the addme is not where it should be. :?
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: Custom Era not working

Post by Fiodis »

Here's my addme.lua:
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)

--add my modes to the singleplayer map selection screen

AddNewGameModes(
sp_missionselect_listbox_contents,
"dag1%s_%s",
{
era_t = 1, mode_con_t = 1,
},
"kam1%s_%s",
{
era_t = 1, mode_con_t = 1,
},
"mus1%s_%s",
{
era_t = 1, mode_con_t = 1,
},
"myg1%s_%s",
{
era_t = 1, mode_con_t = 1,
},
"nab2%s_%s",
{
era_t = 1, mode_con_t = 1,
},
"pol1%s_%s",
{
era_t = 1, mode_con_t = 1,
},
"yav1%s_%s",
{
era_t = 1, mode_con_t = 1,
},
)

AddNewGameModes( mp_missionselect_listbox_contents,
"dag1%s_%s",
{
era_t = 1, mode_con_t = 1,
},
"kam1%s_%s",
{
era_t = 1, mode_con_t = 1,
},
"mus1%s_%s",
{
era_t = 1, mode_con_t = 1,
},
"myg1%s_%s",
{
era_t = 1, mode_con_t = 1,
},
"nab2%s_%s",
{
era_t = 1, mode_con_t = 1,
},
"pol1%s_%s",
{
era_t = 1, mode_con_t = 1,
},
"yav1%s_%s",
{
era_t = 1, mode_con_t = 1,
},
)


--sp_missionselect_listbox_contents[sp_n+1] = {
-- isModLevel = 1,
-- mapluafile = "TER%s_%s",
-- era_g = 1,
-- era_c = 1,
-- era_t = 1,
-- mode_con_g = 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]

-- 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("TER","TERg_con",4)
AddDownloadableContent("dag1","myg1t_con",4)
AddDownloadableContent("kam1","myg1t_con",4)
AddDownloadableContent("mus1","myg1t_con",4)
AddDownloadableContent("myg1","myg1t_con",4)
AddDownloadableContent("nab2","myg1t_con",4)
AddDownloadableContent("pol1","myg1t_con",4)
AddDownloadableContent("yav1","myg1t_con",4)
-- all done
newEntry = nil
n = nil

-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\TER\\data\\_LVL_PC\\core.lvl")
[/code]
In the dataTER/addme folder, I found a file called scriptmunge.txt. Here's it's contents:
Hidden/Spoiler:
[code]Logging ScriptMunge
13:12:5804/04/10
ERROR[addme.lua]:Could not read input file.ERROR[addme.lua]:Could not read input file. [continuing]
2 Errors 0 Warnings

[/code]
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: Custom Era not working

Post by [RDH]Zerted »

Do a full, manual clean and see if you get any errors when you remunge.
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: Custom Era not working

Post by Fiodis »

This time I did get a mungelog, but it was full of only warnings pertaining to my custom side. The debugger still crashes in the same manner, and the debug log still shows that same message about the addme.lua.
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: Custom Era not working

Post by [RDH]Zerted »

Oh, if I'm remembering correctly, the munged addme isn't cleaned unless you delete that munged file manually...

Your addme is bugged. AddNewGameModes only takes 3 parameters. You need a AddNewGameModes call for each map you want to add a new game mode/era to. You can't bunch them all up into a single call like the posted code is doing.
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: Custom Era not working

Post by Fiodis »

Ah, thanks for that tip. It's showing up ingame now, but oddly: the maps on which it is are shown twice in the selection screen, and are added twice to the playlist with one click. Also, it's localized as "toys" - something from the v1.3, I assume. Sky said he'd post details on how to localize it, but as far as I know he never did. Also, when I try to play it, I get a fatal message saying it could not open, for example, yav1t_con.lvl. What's wrong with this? I'm assuming that somehow the mission.lvl isn't munging properly.
Post Reply