Page 1 of 1

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

Posted: Wed Mar 16, 2016 9:41 pm
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.

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

Posted: Wed Mar 16, 2016 9:55 pm
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?

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

Posted: Thu Mar 17, 2016 10:44 am
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.

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

Posted: Thu Mar 17, 2016 3:28 pm
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