I've followed the instructions for changing the name of an era in the addme.lua and that worked no problem, but I can't get the icon to change - it stays as the regular Conquest icon. Here's my addme:
Hidden/Spoiler:
[code]
-- recursively merges the second given table into the first given table
function MergeTables( mission, newFlags )
--for each table entry,
local array = type({})
for key,value in pairs(newFlags) do
--check for nested tables
if type(value) == array then
--mission must have this key as a table too
if type(mission[key]) ~= array then
mission[key] = {}
end
--merge these two tables recursively
MergeTables(mission[key], value)
else
--the key is a simple variable, so simply store it
mission[key] = value
end
end
end
--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
MergeTables(mission, newFlags)
end
end
end
--insert totally new maps here:
local sp_n = 0
local mp_n = 0
sp_n = table.getn(sp_missionselect_listbox_contents)
-- 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("JER","JERc_con",4)
-- all done
newEntry = nil
n = nil
-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\JER\\data\\_LVL_PC\\core.lvl")
ReadDataFile("..\\..\\addon\\JER\\data\\_LVL_PC\\ingame.lvl")
[/code]
I have both the ingame.lvl and common.lvl loaded because both of those were suggested as possible solutions in THIS thread. Here are my common.req and ingame.req files:
common.req
My texture is a 32x32 tga with a black/white alpha channel, pretty much just a redesigned version of the imp_icon.tga. I've tried putting the texture in interface, interface/PC, mshs, and mshs/PC, and I can't get it. What am I doing wrong?
Re: Custom Era Icon
Posted: Tue Mar 10, 2015 3:08 am
by Maveritchell
Try loading the .lvl file with the texture in it before you call for the texture.
And incidentally (it shouldn't really matter), doesn't the 1.3 patch tutorial call for a custom shell.lvl to be made for this kind of thing? Surprised you're loading it in through the ingame.lvl.
Re: Custom Era Icon
Posted: Tue Mar 10, 2015 3:13 am
by jedimoose32
I have yet to see any mention of a custom shell.lvl being required to do this. I've read a handful of threads here on the forums and combed through the official 1.3 documentation, and it doesn't mention a custom shell. If you're sure, then can you point me in the right direction?
I've currently got the common.lvl being loaded before the sp_missionselect_listbox_contents bit as you can see in the addme I posted. I'll try moving the ingame.lvl up there too I guess. Edit: Didn't work.
Re: Custom Era Icon
Posted: Tue Mar 10, 2015 4:14 am
by Maveritchell
I just did a quick check using exactly the same settings you had, and there's nothing in your setup that's wrong (i.e. I munged an "empty" ingame.lvl with only the texture, added it to any 'ol subfolder - mshs, and then added it to the addme). It's probably your texture, given all of that. What's the size of the .lvl file you create, and are you making sure that it's actually present in the addon/MODID folder?
Re: Custom Era Icon
Posted: Tue Mar 10, 2015 5:13 am
by thelegend
As far as I know when you load your icon in a common.lvl file then it must be in the addme.lua. Exactly like the core.lvl. By the way actually ingame.lvl files must be load in your main lua. Am I right? I always let this lua read the ingame.lvl, never the addme.lua. I am probably wrong.
My era icon works. I put the texture in the same folder where the other era texturers are loaded.
Then I create a common.lvl (the .req file is the same as yours) and then I put the ReadDataFile in the addme.lua. After that I copy the munged common.lvl into my Addon Map's folder.
Edit: Forget what I wrote. It's awful to write on a cell phone. Anyway, I have not looked through your addme.lua properly. Your title says you want to change your era icon. But your addme can't read the conquest icon? So...If you want to change the era + the conquest Icon then you need to change the following lines: (I put the following lines from my addme.lua)
sp_missionselect_listbox_contents[sp_n+1] = { red = 85, green = 85, blue = 85, isModLevel = 1, mapluafile = "AWM%s_%s", era_p = 1, mode_con_p = 1, mode_eli_p =1,
change = {
era_p = { name="Pirates of the Caribbean", icon2="p_era_icon" },
mode_con = { name="Duel Mode", icon="duel_icon", about="Duel Mode - Maelstrom: Captain Jack Sparrow has started a duel against the cruel captain of the Flying Dutchman." },
mode_eli = { name="Battle Mode", icon="battle_icon", about="Battle Mode - Maelstrom: The Crews of the Black Pearl and the Flying Dutchman fight eachother to win the final battle" },
},
}
As you can see I changed two modes. But it doesn't matter. To change the era icon you also need to add "era_c = {name..."
You also need to load up your common.lvl below this line:
Here's my addme.lua. All the icons work for me, so..
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] = { red = 85, green = 85, blue = 85, isModLevel = 1, mapluafile = "AWM%s_%s", era_p = 1, mode_con_p = 1, mode_eli_p =1,
change = {
era_p = { name="Pirates of the Caribbean", icon2="p_era_icon" },
mode_con = { name="Duel Mode", icon="duel_icon", about="Duel Mode - Maelstrom: Captain Jack Sparrow has started a duel against the cruel captain of the Flying Dutchman." },
mode_eli = { name="Battle Mode", icon="battle_icon", about="Battle Mode - Maelstrom: The Crews of the Black Pearl and the Flying Dutchman fight eachother to win the final battle" },
},
}
-- 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)
-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\AWM\\data\\_LVL_PC\\core.lvl")
ReadDataFile("..\\..\\addon\\AWM\\data\\_LVL_PC\\common.lvl")
[/code]
I put my icon files into my Interface folder. Just by the way your common.req looks fine to me.
Re: Custom Era Icon
Posted: Tue Mar 10, 2015 5:39 am
by Maveritchell
thelegend wrote:As far as I know when you load your icon in a common.lvl file then it must be in the addme.lua. Exactly like the core.lvl. By the way actually ingame.lvl files must be load in your main lua. Am I right?
No. A .lvl file is an .lvl file is an .lvl file. They all use the same .req structure, and the name of the file is academic.
Edit: although it's worth mentioning (I didn't see it until it was emphasized in the above post) - I don't know if the 1.3 patch supports changing the default modes. You may want to try using a non-conquest mode, in addition to verifying your texture is being munged correctly.
Re: Custom Era Icon
Posted: Tue Mar 10, 2015 2:48 pm
by jedimoose32
Thanks for your help guys. I got it working. I changed
(removed the '2', even though I saw in a few threads that people were using 'icon2')
Mav, interestingly enough it is actually fine in this case to load common.lvl at the bottom of the addme, even though the texture is called above it.
Re: Custom Era Icon [Solved]
Posted: Tue Mar 10, 2015 11:18 pm
by [RDH]Zerted
The texture isn't used until much later in the loading process when the game generates all the era checkboxes. Sometime after all the addons have been processed. You could load assets up until that point. In the addme, you're simply storing the icon's name for later reference.
Re: Custom Era Icon [Solved]
Posted: Tue Mar 10, 2015 11:29 pm
by jedimoose32
Huh. So the addme.lua for every stock and mod map gets loaded right away when you're starting the game? And then the shell gathers everything up and sticks it together in the table. That makes sense given my limited knowledge of the shell I guess.
Re: Custom Era Icon [Solved]
Posted: Wed Mar 11, 2015 12:16 am
by [RDH]Zerted
Stock maps don't have addmes. Their values are directly in a large table defined within the shell.
It's more the addmes gather everything up. Look at your addme closely, you're directly adding your map's info into this table: sp_missionselect_listbox_contents. Later on the shell looks through that table and builds all the GUI controls it needs.
Re: Custom Era Icon [Solved]
Posted: Wed Mar 11, 2015 12:21 am
by jedimoose32
Right, I guess I could have worded that better. The addmes add (go figure) the map's stuff to the table. The shell reads the table and displays its contents.
Interesting about the stock maps. I guess that makes more sense than making each one have an addme.