Page 1 of 1

New era name/icon trouble

Posted: Fri Oct 01, 2010 4:33 pm
by THEWULFMAN
I searched and searched but i need help.
i am trying to make a new era for my map, as a new clone wars era but ive got probs, i also have added mavs dt2 to the map so i tried this
Hidden/Spoiler:
[code]
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

ReadDataFile("..\\..\\addon\\BDT\\data\\_LVL_PC\\dtshell.lvl")

local sp_n = 0
local mp_n = 0
sp_n = table.getn(sp_missionselect_listbox_contents)

sp_missionselect_listbox_contents[sp_n+1] = { red = 0, blue = 255, green = 255, isModLevel = 1, mapluafile = "RYB%s_%s", era_g = 1,era_1 = 1,era_w = 1,era_k = 1, mode_con_g = 1, mode_con_w = 1, mode_con_k = 1,mode_con_1 = 1,mode_uber_g = 1, mode_eli_g = 1,mode_eli_1 = 1, mode_uber_1 = 1, mode_hunt_2 = 1, mode_uber_w = 1,mode_ctf_w = 1, change = {
era_w= { name="Star Wars: The Clone Wars", icon2="bfx_cw_icon" },
},change = {
era_1 = { name="Dark Times", icon2="darktimes_icon" },
},}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

AddDownloadableContent("RYB","RYBw_con",4)
AddDownloadableContent("RYB","RYBg_con",4)
AddDownloadableContent("RYB","RYBk_con",4)
AddDownloadableContent("RYB","RYB1_con",4)
AddDownloadableContent("RYB","RYB1_uber",4)
AddDownloadableContent("RYB","RYBw_uber",4)
AddDownloadableContent("RYB","RYBg_uber",4)
AddDownloadableContent("RYB","RYBw_ctf",4)
AddDownloadableContent("RYB","RYBw_hunt",4)
AddDownloadableContent("RYB","RYBg_eli",4)
AddDownloadableContent("RYB","RYB1_eli",4)

-- all done
newEntry = nil
n = nil

ReadDataFile("..\\..\\addon\\RYB\\data\\_LVL_PC\\core.lvl")[/code]
but it comes up as "wacky, but ifr i delete the section about rename 1 to dark times, the name is rigtht, but no icon,.oh im also only trying out different icons, im not going to use bfx's icon, k,.
what am i doing wrong?
thanks in advance

Re: New era name/icon trouble

Posted: Fri Oct 01, 2010 5:54 pm
by Fiodis
Look in the stock v1.3 documentation howtos to learn how to name a custom era and give it its own icon.

Re: New era name/icon trouble

Posted: Fri Oct 01, 2010 11:31 pm
by THEWULFMAN
Fiodis wrote:Look in the stock v1.3 documentation howtos to learn how to name a custom era and give it its own icon.
I read it all, it doesnt tell me how to rename the era and give it a new icon in the select screen

Re: New era name/icon trouble

Posted: Sat Oct 02, 2010 11:13 am
by Fiodis
You can't have read it all, then.
v1.3 documentation wrote:
Hidden/Spoiler:
This tutorial will take you through the process changing the displayed label, icon, and description of a Conquest, G era map.

Backgound:
* The v1.3 patch supports over 38 game modes and 27 eras. If you want to add a new game mode or era, look at these predefined ones first. Checkout the change log for shell.lvl and common.lvl to see exactly what was added and is directly supported.
* This tutorial will assume you have created a basic LVLg_con map.

Basic Era Support
1) In addme/addme.lua, expand your sp_missionselect_listbox_contents table. Meaning, put each element on a line by itself so the table is easier to read, like this:

sp_missionselect_listbox_contents[sp_n+1] = {
isModLevel = 1,
mapluafile = "LVL%s_%s",
era_g = 1,
mode_con_g = 1,
}

2) Edit the table to add the 'change' table:

sp_missionselect_listbox_contents[sp_n+1] = {
isModLevel = 1,
mapluafile = "LVL%s_%s",
era_g = 1,
mode_con_g = 1,
change = {

},
}

3) We want to change the Conquest game mode, so add another table inside the new 'change' table. The name/index of the new table has to match the game mode key. For Conquest, the key is 'mode_con'. So:

sp_missionselect_listbox_contents[sp_n+1] = {
isModLevel = 1,
mapluafile = "LVL%s_%s",
era_g = 1,
mode_con_g = 1,
change = {
mode_con = { },
},
}

4) Add indexes for Conquest's new name ('name'), new icon ('icon'), and new description ('about'). You only need to add the indexes you want to change, but this tutorial changes all of them so:

sp_missionselect_listbox_contents[sp_n+1] = {
isModLevel = 1,
mapluafile = "LVL%s_%s",
era_g = 1,
mode_con_g = 1,
change = {
mode_con = { name="Candy Conquest", icon="mode_icon_holo", about="Drop off ten cubes of sugar at your ant hill (CP) to win. Watch out for human overlords, kids with magnifying glasses, other ant colonies, and sticky traps..." },
},
}

5) Munge your map. Since we only changed addme.lua, you don't need to check or select anything in VisualMunge. This will greatly decrease its munge time.
6) Start the game. In the map selection screens, your map's Conquest game mode checkbox will now be labeled 'Candy Conquest' and its icon and description will have changed too.
7) In addition to Conquest, we also wanted to chagne the era's name and icon (eras display no descriptions). The procedure is the same except we use the era's key instead of the game mode's key and an index of 'icon2' instead of 'icon'. Here is the completed example table:

sp_missionselect_listbox_contents[sp_n+1] = {
isModLevel = 1,
mapluafile = "LVL%s_%s",
era_g = 1,
mode_con_g = 1,
change = {
era_g = { name="Ant Wars", icon2="rvb_icon" },
mode_con = { name="Candy Conquest", icon="mode_icon_holo", about="Drop off ten cubes of sugar at your ant hill (CP) to win. Watch out for humans overlords, kids with magnifying glasses, other ant colonies, and sticky traps..." },
},
}

8) In your map's readme, make sure to list that the 'v1.3 patch r112+' is required to correctly view the game mode/era. If the player doesn't have the v1.3 patch, then the map's mission will still be displayed, but it will show the original values (i.e. 'Conquest' instead of 'Candy Conquest').
9) Thats it!

Re: New era name/icon trouble

Posted: Sat Oct 02, 2010 11:16 am
by THEWULFMAN
i read it all, this wasnt there , thank you thank you thank you thank you thank you, i typed those out!, anyway i will try this out today, this for some reson isnt listed in the docs i have, thank you thank you thank you
i just hope it works!

Re: New era name/icon trouble

Posted: Sat Oct 02, 2010 11:25 am
by Fiodis
Take a look in GameData\v1.3patch\docs\howtos. The following files ought to be there:
  • Add A Preivew Video.txt
  • Add an Era.txt
  • Add Custom Map Colors.txt
  • Adding A Custom Galactic Conquest.txt
  • Change an Era's and Game Mode's Name or Icon or Description.txt
  • Make Custom User Scripts.txt
  • Munge A Custom LVL File.txt
  • Using Ingame Player Data.txt
If any of those are missing, send me a PM and I'll reply with the missing files.

Re: New era name/icon trouble

Posted: Sat Oct 02, 2010 12:08 pm
by THEWULFMAN
  • Adding A Custom Galactic Conquest.txt
  • Change an Era's and Game Mode's Name or Icon or Description.txt
  • Make Custom User Scripts.txt
  • Munge A Custom LVL File.txt
  • Using Ingame Player Data.txt
these are missing, thank you for your help, i got it working but im still mising alot of the docs aparently

Re: New era name/icon trouble

Posted: Sat Oct 02, 2010 12:13 pm
by Xavious
Adding a Custom Galactic Conquest.txt
Hidden/Spoiler:
[code]Overview
* The UnOfficial v1.3 patch r102+ supports up to 11 custom Galactic Conquests (cgc). Custom Galactic Conquest scripts are loaded and processed near the start of shell_interface.lua.
* The UnOfficial v1.3 patch r129+ supports an unlimited number of cGC scripts. These scripts must start at number 11 and increment that number one at a time. If there is a break in the numbering, such as: custom_gc_12, custom_gc_13, custom_gc_15, and custom_gc_16, then when the game sees script 14 missing, it will stop checking for other scripts. Thus custom_gc_15 and custom_gc_16 won't be loaded.


Requirements
* SWBF2 mod tools
* v1.3 patch r94+ installed
* Basic understanding of Lua
* Basic understanding of how the game works
* A willingness to look through the game's ifs_freeform shell stripts to learn how Galactic Conquest is really configured and played

How To Do It:
1) First, you will need to read and understand the 'Munge A Custom LVL File.txt' document
2) Then you need to pick a custom Galactic Conquest slot. This guide will use slot four: "3". If you plan to distribute your scripts to others, it is best to include the source code, as users might have to recompile it for a different slot.
3) Configure your map to munge the custom lvl: "custom_gc_3.lvl" (see the custom lvl doc for help)
4) custom_gc_3.lvl must, at the very least, contain the lua script: "custom_gc_3". When your custom lvl is processed by the game, it will load only this script. You can always include more scripts or resources in the lvl if you need them (and you do), but the expected script (custom_gc_3) must load them (use ScriptCB_DoFile() or ReadDataFile()).
) Look in the v1.3 patch's "code examples" folder for the "custom_gc_example.zip" file. Extract this zip file and rename its template custom_gc_1.lua to custom_gc_3.lua
) In custom_gc_3.lua, read the beginning section of comments. It goes over the 7 simple things you need to change for easily integerating your custom Galactic Conquest into the game's shell.
) Create the other scripts for your custom Galactic Conquest. You can look at the example and use its scripts as a guide.
) After you munge your custom_gc_3.lvl, copy it to the folder: "GameData\Data\_LVL_PC"
) Thats it! Run your game and check its debug output. You should see it saying it found and loaded your script each time the shell is reloaded.

More Info
* For an example custom Galactic Conquest, see "custom_gc_example.zip" in the "code eamples" folder of the v1.3 patch.[/code]
Change an Era's and Game Mode's Name or Icon or Description.txt
Hidden/Spoiler:
[code]
This tutorial will take you through the process changing the displayed label, icon, and description of a Conquest, G era map.

Backgound:
* The v1.3 patch supports over 38 game modes and 27 eras. If you want to add a new game mode or era, look at these predefined ones first. Checkout the change log for shell.lvl and common.lvl to see exactly what was added and is directly supported.
* This tutorial will assume you have created a basic LVLg_con map.

Basic Era Support
1) In addme/addme.lua, expand your sp_missionselect_listbox_contents table. Meaning, put each element on a line by itself so the table is easier to read, like this:

sp_missionselect_listbox_contents[sp_n+1] = {
isModLevel = 1,
mapluafile = "LVL%s_%s",
era_g = 1,
mode_con_g = 1,
}

2) Edit the table to add the 'change' table:

sp_missionselect_listbox_contents[sp_n+1] = {
isModLevel = 1,
mapluafile = "LVL%s_%s",
era_g = 1,
mode_con_g = 1,
change = {

},
}

3) We want to change the Conquest game mode, so add another table inside the new 'change' table. The name/index of the new table has to match the game mode key. For Conquest, the key is 'mode_con'. So:

sp_missionselect_listbox_contents[sp_n+1] = {
isModLevel = 1,
mapluafile = "LVL%s_%s",
era_g = 1,
mode_con_g = 1,
change = {
mode_con = { },
},
}

4) Add indexes for Conquest's new name ('name'), new icon ('icon'), and new description ('about'). You only need to add the indexes you want to change, but this tutorial changes all of them so:

sp_missionselect_listbox_contents[sp_n+1] = {
isModLevel = 1,
mapluafile = "LVL%s_%s",
era_g = 1,
mode_con_g = 1,
change = {
mode_con = { name="Candy Conquest", icon="mode_icon_holo", about="Drop off ten cubes of sugar at your ant hill (CP) to win. Watch out for human overlords, kids with magnifying glasses, other ant colonies, and sticky traps..." },
},
}

5) Munge your map. Since we only changed addme.lua, you don't need to check or select anything in VisualMunge. This will greatly decrease its munge time.
6) Start the game. In the map selection screens, your map's Conquest game mode checkbox will now be labeled 'Candy Conquest' and its icon and description will have changed too.
7) In addition to Conquest, we also wanted to chagne the era's name and icon (eras display no descriptions). The procedure is the same except we use the era's key instead of the game mode's key and an index of 'icon2' instead of 'icon'. Here is the completed example table:

sp_missionselect_listbox_contents[sp_n+1] = {
isModLevel = 1,
mapluafile = "LVL%s_%s",
era_g = 1,
mode_con_g = 1,
change = {
era_g = { name="Ant Wars", icon2="rvb_icon" },
mode_con = { name="Candy Conquest", icon="mode_icon_holo", about="Drop off ten cubes of sugar at your ant hill (CP) to win. Watch out for humans overlords, kids with magnifying glasses, other ant colonies, and sticky traps..." },
},
}

8) In your map's readme, make sure to list that the 'v1.3 patch r112+' is required to correctly view the game mode/era. If the player doesn't have the v1.3 patch, then the map's mission will still be displayed, but it will show the original values (i.e. 'Conquest' instead of 'Candy Conquest').
9) Thats it![/code]
Make Custom User Scripts.txt
Hidden/Spoiler:
[code]Overview
* The UnOfficial v1.3 patch r102+ supports up to 11 custom user scripts. User scripts are loaded and processed at the start of game_interface.lua. This allows the scripts to control or adjust almost everything that happens ingame. For instance, you can create a script that does a few FakeConsole commands at the start of any map or a script that changes the server name to reflect the amount of people on the server.
* The UnOfficial v1.3 patch r129+ supports an unlimited number of custom user scripts. These scripts must start at number 11 and increment that number one at a time. If there is a break in the numbering, such as: user_script_12, user_script_13, user_script_15, and user_script_16, then when the game sees script 14 missing, it will stop checking for other scripts. Thus user_script_15 and user_script_16 won't be loaded.

Requirements
* SWBF2 mod tools
* v1.3 patch r141+ installed
* Basic understanding of Lua
* Basic understanding of how the game works

How To Do It:
1) First, you will need to read and understand the 'Munge A Custom LVL File.txt' document
2) Next, you need to pick a user script slot. The open slots start at 11 and must go up one at a time. Check your "GameData\data\_LVL_PC folder" and see which 'user_script_##.lvl' files you have. If the script name in the req file doesn't match the lvl file name, the script won't work.
x) If you are using a v1.3 patch below version r141, then only slots 0-10 are available.
X) This guide will use slot eleven: "11". If you plan to distribute your scripts to others, it is best to include the source code. This will allow each person to adjust the code for the amount of user scripts that person already has.
3) Configure your map to munge the custom lvl: "user_script_11.lvl" (see the custom lvl doc for help)
4) user_script_11.lvl must, at the very least, contain the lua script: "user_script_11". When your custom lvl is processed by the game, it will load only this script. You can always include more scripts or resources in the lvl if you need them, but the expected script (user_script_11) must load them (use ScriptCB_DoFile() or ReadDataFile()).
5) After you munge your user_script_11.lvl, copy it to the folder: "GameData\Data\_LVL_PC"
6) Thats it! Run your game and check its debug output. You should see it saying it found and loaded your script each time you load a map/level.

More Info
* For an example user script that runs a few FakeConsole commands when you play a single-player map (easy to remove the SP part), see "user_script_example.zip" in the "code eamples" folder of the v1.3 patch.
* You can use these scripts to better configure a dedicated server or enforce rules, such as 'no vehicles' by using the FakeConsole command 'Lock Vehicles' or a snipers only rule by listening in on AddUnitClass() and canceling any non-sniper units from being added to the team![/code]
Munge A Custom LVL File.txt
Hidden/Spoiler:
[code]Overview
* This tutorial will guide you through munging a custom lvl file

Requirements
* SWBF2 mod tools
* Basic understanding of modding
* Basic understanding of the munge process

How To Do It
1) This guide will assume the mod map is XXX
2) Create the folder: "data_XXX\Shell"
3) Create the text file: "data_XXX\Shell\shell.req"
4) Create the folder "data_XXX\Shell\scripts"
5) Create the script file: "data_XXX\Shell\scripts\test.lua"
6) In shell.req, add the following code. The 'test' should match the name of the script created in step 5, but without its file extension:

ucft
{
REQN
{
"script"
"test"
}
}

7) Open VisualMunge, click "Unselect All", check "Shell", click "Munge"
8) When VisualMunge finishes, it will have created the lvl file: "data_XXX\_LVL_PC\shell.lvl"
9) Rename shell.lvl to whatever name you need, then move it to where you need the file.

Notes
* The test.lua script is just an example script file. You should change the req file to reflect whatever it is you are trying to munging.[/code]
Using Ingame Player Data.txt
Hidden/Spoiler:
[code]
Overview:
* The new function 'uf_processPlayers()' allows modders to handle ingame player data. This data is the same as what you see in the player list. There are many things that can be done with this information.
* This 'tutorial' will describe the player's data table format, and show you example code to kill a player based on on his name.

Player Data Format:
* The player data is in the form of a Lua table. The table contains of a table for each player playing in the server. The player's table consists of the 'indexstr' and the 'namestr'.
* The 'indexstr' is that player's character id. The character id is what you use in functions like 'GetCharacterUnit(charId)' or event triggers like 'OnCharacterSpawn(charId, funtion() end)'
* The 'namestr' is that player's ingame name. It is the name you see in the player list and the name you see running around on the map.
* I am not sure if no-namers are not included in this table, but I think they are not included...
* Example player data table:

exampleTable = {
{ indexstr = "1", namestr = "Alpha"},
{ indexstr = "3", namestr = "Bravo"},
{ indexstr = "2", namestr = "Player 1"},
{ indexstr = "4", namestr = "LastJoinedPlayer"},
}

Kill A Player By Name:
* The uf_processPlayers() function takes one argument/parameter, another function. This argument is called when the player data table has been created. It is given that player table as its only argument/parameter too. In Lua, functions are just like other variables. Create your function just like you would a new number:

--a function to kill [RDH]Zerted, the function takes a single table 'players' as an argument/parameter
local killZerted = function( players )
--can't do anything if the player data table is missing
if not players then return end
end

* Now we have a function that doesn't really do anything. We want to search the player table until we find [RDH]Zerted. After adding the searching in, the code now looks like:

--a function to kill [RDH]Zerted, the function takes a single table 'players' as an argument/parameter
local killZerted = function( players )
--can't do anything if the player data table is missing
if not players then return end

--for each player ingame,
local i
for i=1,table.getn(players) do
--search for the player with the name [RDH]Zerted
if players.namestr == "[RDH]Zerted" then
--found [RDH]Zerted creeping around our map!
end
end
end

* When we find [RDH]Zerted, we want to kill him. This done by killing his unit. First, we have to make sure that he even has a unit (he could be dead already...):

--a function to kill [RDH]Zerted, the function takes a single table 'players' as an argument/parameter
local killZerted = function( players )
--can't do anything if the player data table is missing
if not players then return end

--for each player ingame,
local i
for i=1,table.getn(players) do
--search for the player with the name [RDH]Zerted
if players.namestr == "[RDH]Zerted" then
--get [RDH]Zerted's unit
local unit = GetCharacterUnit(players.indexstr])
if not unit then return end --[RDH]Zerted is already dead, so there is nothing more for us to do
end
end
end

* Now that we know [RDH]Zerted is alive, we can kill him:

--a function to kill [RDH]Zerted, the function takes a single table 'players' as an argument/parameter
local killZerted = function( players )
--can't do anything if the player data table is missing
if not players then return end

--for each player ingame,
local i
for i=1,table.getn(players) do
--search for the player with the name [RDH]Zerted
if players.namestr == "[RDH]Zerted" then
--get [RDH]Zerted's unit
local unit = GetCharacterUnit(players.indexstr])
if not unit then return end --[RDH]Zerted is already dead, so there is nothing more for us to do

--kill [RDH]Zerted's ingame unit
KillObject( unit )
return
end
end
end

* Almost done. We have a function that takes the player data table as an argument and kills [RDH]Zerted if hes playing in the server. But how does this function get called? Just keep reading:

--gets the player list, then calls the given function with the player data
uf_processPlayers( killZerted )

* Thats it. uf_processPlayers will create the player data table and pass it into our killZerted function. The entire code block follows. An additional check was put around the whole section to make sure the uf_processPlayers() function exists. If a person doesn't have the v1.3 patch r115+, then the code would cause a crash without the extra check:

if uf_processPlayers then
--a function to kill [RDH]Zerted, the function takes a single table 'players' as an argument/parameter
local killZerted = function( players )
--can't do anything if the player data table is missing
if not players then return end

--for each player ingame,
local i
for i=1,table.getn(players) do
--search for the player with the name [RDH]Zerted
if players.namestr == "[RDH]Zerted" then
--get [RDH]Zerted's unit
local unit = GetCharacterUnit(players.indexstr])
if not unit then return end --[RDH]Zerted is already dead, so there is nothing more for us to do

--kill [RDH]Zerted's ingame unit
KillObject( unit )
return
end
end
end

--gets the player list, then calls the given function with the player data
uf_processPlayers( killZerted )
else
--of course, the player won't see this debug message, but it doesn't hurt to have it...
print("WARNING: Cannot kill [RDH]Zerted: The uf_processPlayers function is missing. Please update your game to the latest UnOfficial v1.3 patch")
end

* It is important to note that uf_processPlayers() jumps into the player list screen for a second to grab the player data. If used in a map, the player's screen may flash as switching screens doesn't happen instantly. Because of this, its best not to use the function too often. However, the visual flashing shouldn't matter on dedicated servers. [/code]

Re: New era name/icon trouble

Posted: Sat Oct 02, 2010 12:17 pm
by THEWULFMAN
THANK YOU, one last question, i have a new era icon made, but i dont know how to put it in game, is this covered here?

Re: New era name/icon trouble

Posted: Sat Oct 02, 2010 4:27 pm
by AQT
Do you know how to set up a custom loadscreen .lvl file? Well the same concept applies to getting a custom era icon to work, except you use a custom shell.lvl, which is covered in the Munge A Custom LVL File.txt tutorial. Afterng munging with the Shell option checked, the custom shell.lvl will end up in the data_***\_LVL_PC folder. You'll then need to move the file to the _LVL_PC in your map's addon directory. All that is left to do is to load your custom shell.lvl in your addme.lua.
Hidden/Spoiler:
[code]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

ReadDataFile("..\\..\\addon\\***\\data\\_LVL_PC\\shell.lvl")[/code]
And of course change the icon2 name to the name of the TGA of your custom icon.

Re: New era name/icon trouble

Posted: Sat Oct 02, 2010 9:14 pm
by THEWULFMAN
I thought i would work lie that, thanks for clarfieing, ive already done and it works! thanks guys!