SWBF CUSTOM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

SWBF CUSTOM

The best way to custom your games.
 
HomeLatest imagesSearchRegisterLog in

Share
 

 How To: Adding Campaign Mode

View previous topic View next topic Go down 
AuthorMessage
RevanSithLord
Scout Trooper Commander
Scout Trooper Commander
RevanSithLord

Messages : 969
Registration Date : 2010-08-21
Age : 33
Location : The good 'ol United States of America, Iowa Great Lakes region

How To: Adding Campaign Mode Empty
PostSubject: How To: Adding Campaign Mode   How To: Adding Campaign Mode I_icon_minitime7/27/2017, 8:55 pm

Here's a note before we get started: XXX only represents the 3 letter ID of your map, go into whatever your map's ID is]

Step 1:
Go into this directory (or whatever your mod tools are installed in):

C:\BF2_ModTools\data_XXX\Common\scripts\XXX

Make a copy of one of the con.lua files. It can be either one. Copy either XXXg_con or XXXc_con and rename that copy to XXXc_c.

Step 2:
Go into your map's common folder.

Ex. C:\BF2_ModTools\Data_XXX\Common

Open the mission.req (it'd be a good idea to make a backup before proceeding).

Go to this area:

Code:
REQN
    {
        "lvl"
        "XXXg_con"
        "XXXc_con"
    }

Add in your new file. ("XXXc_c")

It should now look like this:

Code:
REQN
    {
        "lvl"
        "XXXc_c"
        "XXXg_con"
        "XXXc_con"
    }
}

Save and close.

Step 3:
Go back to C:\BF2_ModTools\Data_XXX\Common and go into the mission folder. Find your map's .req files and copy one of them (XXXg_con or XXXc_con). Rename that new copy to XXXc_c. Open XXXc_c.req and make sure it looks like this:

Code:
ucft
{
 REQN
     {

         "config"
         "cor_movies"

     }

 REQN
 {
 "script"
 "XXXc_c"
 }
}

Save and close.

Step 4:
Go to C:\BF2_ModTools\data_XXX\addme and open the addme.lua.

Go to this area:

Code:
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "XXX%s_%s", era_g = 1, era_c = 1, mode_con_g = 1, mode_con_c  = 1,}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

Add this to it.

Code:
mode_c_c = 1

Right between era_c = 1 and mode_con_g = 1, so now it should look like this.

Code:
sp_missionselect_listbox_contents[sp_n+1] = { isModLevel = 1, mapluafile = "XXX%s_%s", era_g = 1, era_c = 1, mode_c_c = 1, mode_con_g = 1, mode_con_c  = 1,}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = { isModLevel = 1, mapluafile = "XXX%s_%s",  era_c = 1, mode_con_c  = 1,}
-- mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

Got it?

Great, now go here to this section in the same file.

Code:
AddDownloadableContent("XXX","XXXg_con",4)
AddDownloadableContent("XXX","XXXc_con",4)

Add this line right above them:
Code:
AddDownloadableContent("XXX","XXXc_c",4)

It should now look like this:
Code:
AddDownloadableContent("XXX","XXXc_c",4)
AddDownloadableContent("XXX","XXXg_con",4)
AddDownloadableContent("XXX","XXXc_con",4)

Your entire addme should look like this:

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] = { isModLevel = 1, mapluafile = "XXX%s_%s", era_g = 1, era_c = 1, mode_c_c = 1, mode_con_g = 1, mode_con_c  = 1,}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = { isModLevel = 1, mapluafile = "XXX%s_%s",  era_c = 1, mode_con_c  = 1,}
-- 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("XXX","XXXc_c",4)
AddDownloadableContent("XXX","XXXg_con",4)
AddDownloadableContent("XXX","XXXc_con",4)

-- all done
newEntry = nil
n = nil

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

Now save and close.

Munge and test.

If all goes well, it should show up in the Instant Action menu as a selection!

Congratulations, Commanders! You just added a campaign to your map.

Next lesson soon!
Back to top Go down
http://www.loadedandplay.com
 

How To: Adding Campaign Mode

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» Campaign Changes
» [FAQ]Adding custom sounds via BF1
» [FAQ]Adding Custom Sound Effects
» [FAQ]Adding Background
» [FAQ]Adding Sky Background

Permissions in this forum:You cannot reply to topics in this forum
SWBF CUSTOM :: Star Wars Battlefront Games :: Modding-