Page 1 of 1

Tutorial for custom era

Posted: Tue Jan 29, 2013 10:56 pm
by DylanRocket
Got this from the 1.3 patch tutorials


This tutorial will take you through the process of adding the 'y' era with a Conquest game mode to the 'LVL' map.

Basic Era Support
1) In addme/addme.lua, add "era_y = 1, " to the sp_missionselect_listbox_contents table. This tells the game to display the Y era checkbox when the map is selected in the selection screen.
2) In addme/addme.lua, add "mode_con_y = 1, " to the sp_missionselect_listbox_contents table. This tells the game to display the Conquest mode checkbox when the map is selected in the selection screen. The "_y" allows the game to know that this game mode corresponds to the Y era.
3)) As an example, this is the orginal listbox table line: sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "LVL%s_%s", era_g = 1, era_c = 1, mode_con_g = 1, mode_con_c = 1, }
3)) this is the updated listbox table line: sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "LVL%s_%s", era_g = 1, era_c = 1, era_y = 1, mode_con_g = 1, mode_con_c = 1, mode_con_y = 1, }
4) In addme/addme.lua, add the line "AddDownloadableContent("LVL","LVLy_con",4)" before the "-- all done" comment
5) In Common/mission/, create the file "LVLy_con.req". This file name sort-of corresponds to the 'LVLy_con' in AddDownloadableContent() and the values entered into the listbox table.
6) In Common/mission/LVLy_con.req, put the following code. The code tells VisualMunge what is needed when building the map's lvls. The "script" section tells what additional scripts to include and the "config" section deals with the video configurations. The following code to put is:

ucft
{
REQN
{
"config"
"cor_movies"
}
REQN
{
"script"
"LVLy_con"
}
}

7) In Common/mission.req, add "LVLy_con" to the "lvl" section. This tells VistualMunge to include everything in our newly created Common/mission/LVLy_con file when munging the map's mission.lvl. Mission.lvl is where all of the map's game mode script files should end up.
8 ) In Common/scripts/LVL/, create the file "LVLy_con.lua" It is easiest do this by copying an exist Conquest script, such as LVLg_con.lua. If you don't copy the file, you will need to manually add in all the Conquest scripting details. This tutorial does not cover the finer parts of game mode scripting, but only what changes are needed for a custom era. Our new LVLy_con.lua is the script we referrenced a few steps ago in the "script"ing section of Common/mission/LVLy_con.req. Following through the reqs, this is the actual lua script file which will be munged into the map's mission.lvl.
9) Munge Common
10) Thats it. If you only want basic era support for the map you are done. If you open up SWBF2, your map will now display a Y era Conquest mode. If thats all you wanted, you can stop reading this tutorial right here -> |. However, if you want full era integeration there is still much to do...

Full Era Integeration
1) The parts that are missing from basic era support are custom side icons, custom CP icons, and custom side names. This advanced part of the tutorial will help you enable or add these features to your map. Step wise, it continues were the basic era support section left off.
2) In Common/scripts/LVL/LVLy_con.lua, add the line "SupportsCustomEraTeams = true" at the top of the file. This will tell the team selection screen to around the game's orginal design and use your custom team/side names instead.
3) In Common/scripts/LVL/LVLy_con.lua, add the line "CustomEraTeam2 = "Era Team 2"" right below the SupportsCustomEraTeams line. Replace 'Era Team 2' with the name of your second team's name.
4) In Common/scripts/LVL/LVLy_con.lua, add the line "CustomEraTeam1 = "Era Team 1"" right below the SupportsCustomEraTeams line. Replace 'Era Team 1' with the name of your first team's name.
5) In Common/scripts/LVL/LVLy_con.lua, take a close look at the 'SetupTeams' section. You will see something like:

SetupTeams{
all = {
team = ALL,
units = 20,
reinforcements = 150,
soldier = { "all_inf_rifleman",9, 25},

The little "all" is the real team name. According to the 'Battlefront2_scripting_system.doc' doc, SWBF2 has nine predefined team names (neutral, neu, alliance, all, empire, imp, republic, rep, cis). Everything else maps to locals. This is not truly the case as "Villains" is also predeinfed, but those that are predefined and those that aren't has never been fully researched (would you like to be the first?). The team name manages the game's references for the team's name, team's icon, team's CP icons, and the team's unit names.
6) Make note of your two team names. 'all' maps to 'alliance', 'imp' maps to 'imperial', 'rep' maps to 'republic', and 'cis' maps to 'CIS'. The team names are case-insenstive.
7) Create your CP holo icon meshes. You can start from scratch or build off of an existing one like Common/mshs/com_icon_cis.msh. If needed, don't forget to create the msh's .option file too.
8 ) The custom CP holo icons go in Common/mshs/. Depending on your team name mappings, each icon should have one of the following names: com_icon_alliance, com_icon_imperial, com_icon_republic, or com_icon_CIS. If your map is CTF based, you might also want to look into com_icon_swap.
9) Open Common/ingame.req and wipe everything out. We since are going to be creating a custom ingame.lvl for this map, we only want to override the elements which have been changed. If you try to include everything the game might crash, but you would also override any other ingame.lvl mods the user might have installed.
10) Put the following code in Common/ingame.req. Make sure to adjuest it for your team names. The example uses a SetupTeams section with 'all' and 'imp' team names:

ucft
{
REQN
{
"model"
"com_icon_alliance"
"com_icon_imperial"
}
}

11) Munge Common
12) In data_LVL/_LVL_PC, rename the new ingame.lvl to "y_con-ingame.lvl". The 'y_con' part stands for the Y era and game mode Conquest. The renaming is not required, but should be done if you want to override the icons with different icons in other era/game modes of your map.
13) In Common/scripts/LVL/LVLy_con.lua, add "ReadDataFile("dc:y_con-ingame.lvl")" right before the non-'dc:' version of the line. This tells the game to read your map's ingame.lvl before reading the default ingame.lvl. Since your ingame.lvl is read first, its CP icons will be the ones used.
14) You will need to remember to manually copy the munged data_LVL/_LVL_PC/y_con-ingame.lvl to your munged map's GameData/addon/LVL/data/_LVL_PC/ folder any time you need to create a new y_con-ingame.lvl. A 'normal' mod map does not have a custom ingame.lvl, so VisualMunge will not move it for you. Do that copy now, so you don't forget to later.
15) Rename Common/ingame.req to "y_con-ingame.req". This is so you always have a copy of the req that created the y_con-ingame.lvl. If you want to make a new y_con-ingame.lvl, rename that file back to "ingame.lvl". VisualMunge does not build custom named lvls by you just creating a differently named req file.
16) Test your map

Re: Tutorial for custom era

Posted: Fri May 31, 2013 1:02 pm
by Benoz
Everytime, when I try to make exactly this on a shipped map, it won't work.
When I try to start (eg: Coruscant) with my new era, it says
"Could not open mission" that sucks, because I tried it several times.
And yes, I'm using patch 1.3
and i'm replacing I'm LVL from LVLy_era to cor1y_era every time.

I'ts sooooo annoing

Re: Tutorial for custom era

Posted: Fri May 31, 2013 2:58 pm
by Nedarb7

Re: Tutorial for custom era

Posted: Sat Jun 01, 2013 3:42 am
by Benoz
This didn't helped for me.
always this message: "Could not open MISSION\cor1a_con.lvl"

if my new era called "a"
should i rename the cor1c_con from...\data_XXX\Common\scripts\XXX to cor1a_con??

I did it, cause it sounds logical, though he in the tutorial didnt do the same.

Re: Tutorial for custom era

Posted: Sat Jun 01, 2013 8:50 am
by Nedarb7
The66Order66 wrote:if my new era called "a"
should i rename the cor1c_con from...\data_XXX\Common\scripts\XXX to cor1a_con??

I did it, cause it sounds logical, though he in the tutorial didnt do the same.
Yes you should...... sounds like that parts already correct, look over steps 6 through 8
over again, you might have missed a very important step.

Re: Tutorial for custom era

Posted: Sat Jun 01, 2013 1:34 pm
by Benoz
O.O ... it works!!

Finally, after so much tries.
Thank You very much :thumbs: :quotes:

But is it right that now 2 Mygeeto maps appears, one white and one yellow.

here:
Hidden/Spoiler:
Image
if you can fix this, i would be pleased to hear :D

Re: Tutorial for custom era

Posted: Sat Jun 01, 2013 1:38 pm
by Nedarb7
Please post your addme, the answer may lie there.

Re: Tutorial for custom era

Posted: Sat Jun 01, 2013 4:33 pm
by Benoz
here's the admee (switched the myg1a_con to cor1a_con)
Hidden/Spoiler:
--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 = "cor1%s_%s", era_g = 1, era_c = 1, era_a = 1, mode_con_g = 1, mode_con_c = 1, mode_con_a = 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("cor1","cor1a_con",4)

-- all done
newEntry = nil
n = nil

-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\TCW\\data\\_LVL_PC\\core.lvl")

Re: Tutorial for custom era

Posted: Sat Jun 01, 2013 4:48 pm
by Nedarb7
Step 8 tells you that your addme must be changed, right now your only adding another map with a special era. Your addme should look like this:
Hidden/Spoiler:
--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, "cor1%s_%s", {era_a = 1, mode_con_a = 1,} )

AddNewGameModes( mp_missionselect_listbox_contents, "cor1%s_%s", {era_a = 1, mode_con_a = 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("cor1","cor1a_con",4)

-- all done
newEntry = nil
n = nil

-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\TCW\\data\\_LVL_PC\\core.lvl")

Re: Tutorial for custom era

Posted: Sun Jun 02, 2013 5:10 am
by Benoz
I know I demand a lot :/
but could you, if you have time, make a data_XXX for me, that adds an era for a pre-existing map?
I know it's a lot of work, but you dont need to edit a custom side, only that it works.

Because after trying this several times again and again, and after all advices you gave me, I#m feeling stupid of myself. :(

I know it's a big desire

Re: Tutorial for custom era

Posted: Sun Jun 02, 2013 11:45 am
by Noobasaurus
I can do this, the data folder is uploading right now. All the stuff in there are the assets I used for my Claymore mod. Obviously there is nothing in the sides folder, otherwise you would be able to re create it. Anyway, it should still work. However, if you try to play the added era, it will crash, because it tries to load sides that do not exist.

Here it is. Go to File->Download to download it. Please try to use these files as a base, so you study them and copy paste parts of what you need into the appropriate files. If you try to make your era in the folder, you'll have problems because some of the munging files needed aren't there. So just look at the addme and the mission luas and the lua and all the good stuff and you'll get it.

However, if you do munge the folder as is, the era will show up on most stock maps as "Claymore Mod." I recommend not using the letter p for your era because if people have both installed there will be problems.

Re: Tutorial for custom era

Posted: Sun Jun 02, 2013 1:37 pm
by Benoz
I think i did all right, changed the Troops of the Scripts, but...
...even your data_XXX didn't helped...I don't know why...
...when I try to start the new era, it crashes back to the desktop.
It is loading until the last loadingpoint.

I'm despairing right now,
maybe I have to re-install ModTools???

Re: Tutorial for custom era

Posted: Sun Jun 02, 2013 2:19 pm
by Noobasaurus
Try simply making an era that loads the stock sides. Then, if that does not work, run it with the debugger.
The66Order66 wrote:changed the Troops of the Scripts
Nononononono...do not copy what my sides were. See, if you do that, it'll try to load sides that aren't there, therefore crashing the game. Instead, load the stock sides like this:
Hidden/Spoiler:
[code]
ReadDataFile("SIDE\\rep.lvl",
"rep_inf_ep3_rifleman",
"rep_inf_ep3_rocketeer",
"rep_inf_ep3_engineer",
"rep_inf_ep3_sniper",
"rep_inf_ep3_officer",
"rep_inf_ep3_jettrooper",
"rep_hero_yoda")

ReadDataFile("SIDE\\cis.lvl",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_officer",
"cis_inf_sniper",
"cis_inf_droideka",
"cis_hero_grievous")

SetupTeams{
rep = {
team = REP,
units = 32,
reinforcements = 150,
soldier = { "rep_inf_ep3_rifleman",9, 25},
assault = { "rep_inf_ep3_rocketeer",1,4},
engineer = { "rep_inf_ep3_engineer",1,4},
sniper = { "rep_inf_ep3_sniper",1,4},
officer = {"rep_inf_ep3_officer",1,4},
special = { "rep_inf_ep3_jettrooper",1,4},

},
cis = {
team = CIS,
units = 32,
reinforcements = 150,
soldier = { "cis_inf_rifleman",9, 25},
assault = { "cis_inf_rocketeer",1,4},
engineer = { "cis_inf_engineer",1,4},
sniper = { "cis_inf_sniper",1,4},
officer = {"cis_inf_officer",1,4},
special = { "cis_inf_droideka",1,4},
}
}

SetHeroClass(REP, "rep_hero_yoda")
SetHeroClass(CIS, "cis_hero_grievous")[/code]
Paste that in where the sides are in the luas currently. If the era shows up and you can play as the default units, it worked.

Re: Tutorial for custom era

Posted: Mon Jun 03, 2013 11:58 am
by Benoz
OMG it worked!!!
Thx so much, after all this time :D