Page 1 of 1

Problems when changing era name through the addme [Solved]

Posted: Fri Feb 17, 2017 8:44 am
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 :)

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

Posted: Fri Feb 17, 2017 7:37 pm
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 = {"

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

Posted: Fri Feb 17, 2017 7:52 pm
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.

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

Posted: Sat Feb 18, 2017 6:31 am
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:

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

Posted: Sat Feb 18, 2017 11:47 am
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.

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

Posted: Sat Feb 18, 2017 11:54 am
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

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

Posted: Sat Feb 18, 2017 9:32 pm
by SkinnyODST
Glad you figured it out ;)