Problems when changing era name through the addme [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
CT108
Rebel Sergeant
Rebel Sergeant
Posts: 186
Joined: Mon Aug 22, 2016 6:20 am
Projects :: None
Games I'm Playing :: CS2
xbox live or psn: Captain CT108
Location: Xanadu

Problems when changing era name through the addme [Solved]

Post by CT108 »

Hi GT

I have a problem : my game is crashing when I try to change the name of an era through the addme.lua
I know that the error is in the part that I've underlined but not where exactly in this part
Notice that I've added a new era ( DAFy_con ) and everything works fine when I don't try to change the name of an era.

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)

sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "DAF%s_%s", era_g = 1, era_c = 1, era_y = 1, mode_con_g = 1, mode_con_c = 1, mode_con_y = 1, mode_eli_g = 1,} change = {
era_y = { name="GCW Battlefront"},

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("DAF","DAFg_con",4)
AddDownloadableContent("DAF","DAFc_con",4)
AddDownloadableContent("DAF","DAFy_con",4)
AddDownloadableContent("DAF","DAFg_eli",4)

-- all done
newEntry = nil
n = nil

-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\DAF\\data\\_LVL_PC\\core.lvl")
[/code]
and my BF2log
Hidden/Spoiler:
Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaScript.cpp(435)
Script file addme not found
How can I change the name without any crashes ? Thanks for the help :)
Last edited by CT108 on Sat Feb 18, 2017 6:48 am, edited 1 time in total.
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Re: Game crashing when changing an era name through the addm

Post by SkinnyODST »

I think I see the problem
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "DAF%s_%s", era_g = 1, era_c = 1, era_y = 1, mode_con_g = 1, mode_con_c = 1, mode_con_y = 1, mode_eli_g = 1,} change = {
Look at this part at the end - mode_eli_g = 1,} change = {
Make it look like this - mode_eli_g = 1, change = {

I Removed the - "}" from behind "change = {"
Samee3
First Lance Corporal
First Lance Corporal
Posts: 123
Joined: Sun Jul 05, 2015 5:07 pm
Projects :: BF2 Refresh Mod
Games I'm Playing :: Empire at War
xbox live or psn: VaporousFern310
Location: California, USA

Re: Game crashing when changing an era name through the addm

Post by Samee3 »

In \Data_***\addme, there should be a "scriptmunge" file. Check that for errors.
Also, there are a number of mungelogs in \Data_***\_Build\Common. Check those too.
User avatar
CT108
Rebel Sergeant
Rebel Sergeant
Posts: 186
Joined: Mon Aug 22, 2016 6:20 am
Projects :: None
Games I'm Playing :: CS2
xbox live or psn: Captain CT108
Location: Xanadu

Re: Game crashing when changing an era name through the addm

Post by CT108 »

Sorry Skinny, it's still not working :(

I tried this
Hidden/Spoiler:
[code]sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "DAF%s_%s", era_g = 1, era_c = 1, era_y = 1, mode_con_g = 1, mode_con_c = 1, mode_con_y = 1, mode_eli_g = 1, change = {
era_c = { name="The Clone Wars" },
era_g = { name="Rogue One" },
era_y = { name="GCW Battlefront" }[/code]
this
Hidden/Spoiler:
[code]sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "DAF%s_%s", era_g = 1, era_c = 1, era_y = 1, mode_con_g = 1, mode_con_c = 1, mode_con_y = 1, mode_eli_g = 1, change = {
era_c = { name="The Clone Wars" },
era_g = { name="Rogue One" },
era_y = { name="GCW Battlefront" },[/code]
and this
Hidden/Spoiler:
[code]sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "DAF%s_%s", era_g = 1, era_c = 1, era_y = 1, mode_con_g = 1, mode_con_c = 1, mode_con_y = 1, mode_eli_g = 1, change = {
era_c = { name="The Clone Wars" },
era_g = { name="Rogue One" },
era_y = { name="GCW Battlefront" }, }[/code]
Nothing works

And Samee, I checked every logs in \Data_***\_Build\Common but there isn't any errors. Also I have an error at my "scriptmunge" file, but I'm not sure if it will help me so much.
My scriptmunge
Hidden/Spoiler:
Logging ScriptMunge
11:23:5502/18/17
ERROR[addme.lua]:Could not read input file.ERROR[addme.lua]:Could not read input file. [continuing]
2 Errors 0 Warnings
EDIT
I found the solution !
Hidden/Spoiler:
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "DAF%s_%s", era_g = 1, era_c = 1, era_y = 1, mode_con_g = 1, mode_con_c = 1, mode_con_y = 1, mode_eli_g = 1, change = {
era_c = { name="The Clone Wars" },
era_g = { name="Rogue One" },
era_y = { name="GCW Battlefront" } } }
Every words that are bold are the "solution". In this case, I've just forgotten a "}" at the end...

:faint: [facepalm] :faint:
Samee3
First Lance Corporal
First Lance Corporal
Posts: 123
Joined: Sun Jul 05, 2015 5:07 pm
Projects :: BF2 Refresh Mod
Games I'm Playing :: Empire at War
xbox live or psn: VaporousFern310
Location: California, USA

Re: Game crashing when changing an era name through the addm

Post by Samee3 »

CT108 wrote:I found the solution !
Hidden/Spoiler:
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "DAF%s_%s", era_g = 1, era_c = 1, era_y = 1, mode_con_g = 1, mode_con_c = 1, mode_con_y = 1, mode_eli_g = 1, change = {
era_c = { name="The Clone Wars" },
era_g = { name="Rogue One" },
era_y = { name="GCW Battlefront" } } }
Every words that are bold are the "solution". In this case, I've just forgotten a "}" at the end...

:faint: [facepalm] :faint:
Excellent! I think we've all been here...... :)
Here's a friendly tip: if you don't already, use a text editor that has syntax/bracket highlighting, specifically for LUA. Saves sooo many headaches.
My favorites are Notepad++, and Visual Studio Code.
User avatar
CT108
Rebel Sergeant
Rebel Sergeant
Posts: 186
Joined: Mon Aug 22, 2016 6:20 am
Projects :: None
Games I'm Playing :: CS2
xbox live or psn: Captain CT108
Location: Xanadu

Re: Game crashing when changing an era name through the addm

Post by CT108 »

Samee3 wrote:
Excellent! I think we've all been here...... :)
Here's a friendly tip: if you don't already, use a text editor that has syntax/bracket highlighting, specifically for LUA. Saves sooo many headaches.
My favorites are Notepad++, and Visual Studio Code.
I'm actually using Notepad ++ but I didn't looked first a the colors of the "}"
And today I retied and watched with the colors, and I found where was the problem :D
SkinnyODST
Lieutenant Colonel
Lieutenant Colonel
Posts: 545
Joined: Mon Jul 04, 2016 10:56 pm
Location: My other account
Contact:

Re: Problems when changing era name through the addme [Solve

Post by SkinnyODST »

Glad you figured it out ;)
Post Reply