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

First Lance Corporal
User avatar
Posts: 128
Joined: Mon Aug 22, 2016 6:20 am
Location: Dantooine
Projects :: Star Wars BF2 Dantooine at War
Games I'm Playing :: SBF2 - Empire at War
xbox live or psn: Captain CT108

Problems when changing era name through the addme [Solved]

Postby CT108 » Fri Feb 17, 2017 8:44 am

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: Select all
--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)

[u]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"},[/u]
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")


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.

1st Warning
User avatar
Posts: 421
Joined: Mon Jul 04, 2016 10:56 pm
Location: STRAYA MATE
Projects :: Yavin Valley of Ruins
Games I'm Playing :: SWBF1 SWBF2
xbox live or psn: Skinny ODST

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

Postby SkinnyODST » Fri Feb 17, 2017 7:37 pm

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 = {"

Private First Class
User avatar
Posts: 86
Joined: Sun Jul 05, 2015 5:07 pm
Location: California, USA
Projects :: BF2 Refresh Mod
Games I'm Playing :: Empire at War
xbox live or psn: VaporousFern310

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

Postby Samee3 » Fri Feb 17, 2017 7:52 pm

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.

First Lance Corporal
User avatar
Posts: 128
Joined: Mon Aug 22, 2016 6:20 am
Location: Dantooine
Projects :: Star Wars BF2 Dantooine at War
Games I'm Playing :: SBF2 - Empire at War
xbox live or psn: Captain CT108

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

Postby CT108 » Sat Feb 18, 2017 6:31 am

Sorry Skinny, it's still not working :(

I tried this
Hidden/Spoiler:
Code: Select all
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" }


this
Hidden/Spoiler:
Code: Select all
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" },


and this
Hidden/Spoiler:
Code: Select all
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" }, }


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:

Private First Class
User avatar
Posts: 86
Joined: Sun Jul 05, 2015 5:07 pm
Location: California, USA
Projects :: BF2 Refresh Mod
Games I'm Playing :: Empire at War
xbox live or psn: VaporousFern310

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

Postby Samee3 » Sat Feb 18, 2017 11:47 am

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.

First Lance Corporal
User avatar
Posts: 128
Joined: Mon Aug 22, 2016 6:20 am
Location: Dantooine
Projects :: Star Wars BF2 Dantooine at War
Games I'm Playing :: SBF2 - Empire at War
xbox live or psn: Captain CT108

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

Postby CT108 » Sat Feb 18, 2017 11:54 am

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

1st Warning
User avatar
Posts: 421
Joined: Mon Jul 04, 2016 10:56 pm
Location: STRAYA MATE
Projects :: Yavin Valley of Ruins
Games I'm Playing :: SWBF1 SWBF2
xbox live or psn: Skinny ODST

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

Postby SkinnyODST » Sat Feb 18, 2017 9:32 pm

Glad you figured it out ;)

Return to SWBF2 Modding

Who is online

Users browsing this forum: No registered users and 2 guests