-
Notifications
You must be signed in to change notification settings - Fork 1
Making a SWBFII Addon for XBOX (part 3) addme file
The localization system that Pandemic uses for SWBFII isn't great. On the PC you typically use the following line to get the shell/menu system to load your strings:
ReadDataFile("..\\..\\addon\\ABC\\data\\_LVL_PC\\core.lvl")
But this doesn't work on XBOX. Pandemic had to use a replacement 'core.lvl' (shipped in a different addon package) with the needed menu strings to get around this issue [Super Lame]. In our XBOX mod addme file I suggest wrapping the 'ReadDataFile' call above in an 'if(ScriptCB_GetPlatform() == "PC") statement.
For our strings to show up in the menus we used a Lua language feature that allows us to redefine the 'ScriptCB_getlocalizestr()' function used to localize strings in the menus. Here is the addme.lua file I used for the Christmas in Jinglin' town XBOX port:
Your addme should look similar.
It turns out that in order to execute a script in the SWBFII Lua space we must do the following lines:
ReadDataFile("file_containing_the_script")
ScriptCB_DoFile("script_from_that_file")
So that means the game does something like this to execute the addme.script:
ReadDataFile("mod\\path\\addme.script")
ScriptCB_DoFile("addme")
With the call to 'ReadDataFile()' the game engine reads all the parts of the target file into the Lua env, which defines (or re-defines) the script known as 'addme'. It happens to be that the 'addme' script is the only thing defined in the 'addme.script' file. But it doesn't have to be. You can create an 'addme.lvl' file which has inside of it many things (new textures, replacement shell textures, new scripts ...) and then re-name it to 'addme.script' in order to get the game to load in more assets.
-- Adding a new era is easy (on console), we just add an entry to 'gMapEras'
-- (this is a simple example, probably a better idea to check if the era exists before adding it)
table.insert(gMapEras, {
key = "era_k1",
showstr = "common.era.k1",
subst = "k1", -- should match what comes after the underscore of the 'key'
Team1Name = "common.sides.rep.name", -- Team 1 name
Team2Name = "common.sides.cis.name", -- Team 2 name
icon1 = "cis_icon",
icon2 = "rep_icon",
})
-- Adding a game mode is easy (on console), we just add an entry to 'gMapModes'
-- (this is a simple example, probably a better idea to check if the mode exists before adding it)
table.insert(gMapModes, {
key = "mode_sni",
showstr = "modename.name.sni",
descstr = "modename.description.sni",
subst = "sni",
icon = "mode_icon_sniper",
})
- Developing a SWBFII DLC package
- Notes