How to make side/script changes affect only SP or MP.

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
commanderawesome
Field Commander
Field Commander
Posts: 971
Joined: Tue Aug 13, 2013 11:58 pm
Projects :: Skin Changer - Warfront - Other stuff
Games I'm Playing :: SWBF SWTOR KotOR EaW
xbox live or psn: AaTc_CmdrAwesome
Location: The Universe

How to make side/script changes affect only SP or MP.

Post by commanderawesome »

I don't know if you guys already knew this or not, but it turns out this BF1 lua command works in BF2 as well:

Code: Select all

if(ScriptCB_InNetGame()) then
This allows one to have different code for Multiplayer than in Singleplayer, or vise-versa.

So for example:
Hidden/Spoiler:
[code]if(ScriptCB_InNetGame()) then

ReadDataFile("SIDE\\rep.lvl",
--"rep_bldg_forwardcenter",
"rep_fly_assault_dome",
--"rep_fly_gunship",
"rep_fly_gunship_dome",
"rep_fly_jedifighter_dome",
"rep_inf_ep2_rocketeer",
"rep_inf_ep2_rifleman",
"rep_inf_ep2_jettrooper",
"rep_inf_ep2_sniper",
"rep_inf_ep3_officer",
"rep_inf_ep2_engineer",
"rep_hero_macewindu",
"rep_walk_atte")

ReadDataFile("SIDE\\cis.lvl",
"cis_fly_droidfighter_dome",
--"cis_fly_geofighter",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_sniper",
"cis_inf_officer",
"cis_inf_engineer",
"cis_hero_countdooku",
"cis_inf_droideka",
"cis_tread_hailfire",
--"cis_hover_stap",
"cis_walk_spider")
ReadDataFile("SIDE\\geo.lvl",
"gen_inf_geonosian")

ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_geoturret")

SetupTeams{

rep = {
team = REP,
units = 28,
reinforcements = 150,
soldier = { "rep_inf_ep2_rifleman",10, 25},
assault = { "rep_inf_ep2_rocketeer",1, 4},
engineer = { "rep_inf_ep2_engineer",1, 4},
sniper = { "rep_inf_ep2_sniper",1, 4},
officer = {"rep_inf_ep3_officer",1, 4},
special = { "rep_inf_ep2_jettrooper",1, 4},

},
cis = {
team = CIS,
units = 28,
reinforcements = 150,
soldier = { "cis_inf_rifleman",10, 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},
}
}

else

ReadDataFile("SIDE\\rep.lvl",
--"rep_bldg_forwardcenter",
"rep_fly_assault_dome",
--"rep_fly_gunship",
"rep_fly_gunship_dome",
"rep_fly_jedifighter_dome",
"rep_inf_ep2_rocketeer",
"rep_inf_ep2_rifleman",
"rep_inf_ep2_jettrooper",
"rep_inf_ep2_sniper",
"rep_inf_ep3_officer",
"rep_inf_ep2_engineer",
"rep_hero_macewindu",
"rep_walk_atte")

ReadDataFile("SIDE\\cis.lvl",
"cis_fly_droidfighter_dome",
--"cis_fly_geofighter",
"cis_inf_marine",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_sniper",
"cis_inf_officer",
"cis_inf_engineer",
"cis_hero_countdooku",
"cis_inf_droideka",
"cis_tread_hailfire",
--"cis_hover_stap",
"cis_walk_spider")
ReadDataFile("SIDE\\geo.lvl",
"gen_inf_geonosian")

ReadDataFile("dc:SIDE\\NewUnits.lvl",
"rep_inf_ep2_officer",
"cis_inf_battledroid_inf")

ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_geoturret")

SetupTeams{

rep = {
team = REP,
units = 28,
reinforcements = 150,
soldier = { "rep_inf_ep2_rifleman",10, 25},
assault = { "rep_inf_ep2_rocketeer",1, 4},
engineer = { "rep_inf_ep2_engineer",1, 4},
sniper = { "rep_inf_ep2_sniper",1, 4},
officer = {"rep_inf_ep2_officer",1, 4},
special = { "rep_inf_ep2_jettrooper",1, 4},

},
cis = {
team = CIS,
units = 28,
reinforcements = 150,
soldier = { "cis_inf_battledroid_inf",10, 25},
pilot = { "cis_inf_rifleman",1, 4},
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},
}
}

AddUnitClass(CIS, "geo_inf_geonosian",0,1)
end[/code]
^ This will make side changes for SP only. This can also be done the other way around and for any kind of lua scripting you want.

Credit goes to SleepKiller from SWBFGamers for finding this for SWBF1.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: How to make side/script changes affect only SP or MP.

Post by AQT »

We already have the following for SWBF2:

Code: Select all

if ScriptCB_InMultiplayer() then
Which does the same thing as what you posted. The question is, why are there two seperate commands that do the same exact thing, unless one has more capabilities than the other?
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: How to make side/script changes affect only SP or MP.

Post by Marth8880 »

AQT wrote:The question is, why are there two seperate commands that do the same exact thing, unless one has more capabilities than the other?
ScriptCB_IsMultiplayer() probably applies to LAN and Internet sessions, whereas ScriptCB_InNetGame() probably only applies to Internet sessions.
CdtFox
2nd Lieutenant
2nd Lieutenant
Posts: 379
Joined: Wed Feb 17, 2016 8:51 am
Projects :: BUC and Designated Days
Games I'm Playing :: SWBF2+EAW+Subnautica
xbox live or psn: No gamertag set
Location: France
Contact:

Re: How to make side/script changes affect only SP or MP.

Post by CdtFox »

commanderawesome wrote:I don't know if you guys already knew this or not, but it turns out this BF1 lua command works in BF2 as well:

Code: Select all

if(ScriptCB_InNetGame()) then
This allows one to have different code for Multiplayer than in Singleplayer, or vise-versa.
Nice find Commander! :thumbs:
AQT wrote:We already have the following for SWBF2:

Code: Select all

if ScriptCB_InMultiplayer() then
2 possibilities?! we can't be better served :P
Post Reply