Page 1 of 1

4 factions on maps

Posted: Wed Mar 25, 2009 4:41 pm
by Ping
I was just wondering if it was possible to have four factions on a map at once. I mean, only two would be playable, but I don't know if there can be more than three sides on a map.

Edit: Whoops! Put this in the wrong forum. Staff, could you please move this to the BF2 modding forum?

Re: 4 factions on maps

Posted: Wed Mar 25, 2009 4:53 pm
by Teancum
Yep, when I get time tonight I'll post the Geonosis Uber lua, which does just that (REP, CIS, Geonosians and Jedi)

Re: 4 factions on maps

Posted: Wed Mar 25, 2009 5:19 pm
by Ping
Teancum wrote:Yep, when I get time tonight I'll post the Geonosis Uber lua, which does just that (REP, CIS, Geonosians and Jedi)
Ok, thanks. Is it also possible to have all 4 of them fight against each other, and is it also possible to give all four sides CPs?

Re: 4 factions on maps

Posted: Wed Mar 25, 2009 5:25 pm
by Maveritchell
Ping wrote:
Teancum wrote:Yep, when I get time tonight I'll post the Geonosis Uber lua, which does just that (REP, CIS, Geonosians and Jedi)
Ok, thanks. Is it also possible to have all 4 of them fight against each other, and is it also possible to give all four sides CPs?
Absolutely. I wouldn't advise making it a conquest game if you're going to have four teams capturing CPs, though. (Although it might be fun to try.)

Here's an example from one of my wave modes, which has seven teams (obviously not all against each other, but it's possible) running around at once:
Hidden/Spoiler:
[code] SetTeamName(3, "imp")
AddUnitClass(3, "imp_inf_gunner",2,60)
AddUnitClass(3, "imp_inf_heavymelee",2,60)
AddUnitClass(3, "imp_inf_commando",2,60)
AddUnitClass(3, "imp_inf_evotrooper",2,60)
SetUnitCount (3, 100)
--first number is numteam, second is numunits
AddAIGoal(3, "Deathmatch", 100)


SetTeamName(4, "imp")
AddUnitClass(4, "imp_inf_royalguard",2,60)
AddUnitClass(4, "imp_inf_commander",2,60)
AddUnitClass(4, "imp_inf_shadowtrooper",2,60)
SetUnitCount (4, 100)
--first number is numteam, second is numunits
AddAIGoal(4, "Deathmatch", 100)

SetTeamName(5, "imp")
AddUnitClass (5, "imp_hero_shadowguard", 1, 6)

SetUnitCount (5, 50)
--first number is numteam, second is numunits
AddAIGoal(5, "Deathmatch", 100)

SetTeamName(6, "imp")
AddUnitClass (6, "imp_hero_vader", 1, 1)
SetUnitCount (6, 50)
--first number is numteam, second is numunits
AddAIGoal(6, "Deathmatch", 100)

SetTeamName(7, "imp")
AddUnitClass (7, "imp_hero_sidious", 1, 1)
SetUnitCount (7, 50)
--first number is numteam, second is numunits
AddAIGoal(7, "Deathmatch", 100)

SetTeamAsEnemy(ATT,3)
SetTeamAsEnemy(3,ATT)
SetTeamAsFriend(DEF,3)
SetTeamAsFriend(3,DEF)

SetTeamAsEnemy(ATT,4)
SetTeamAsEnemy(4,ATT)
SetTeamAsFriend(DEF,4)
SetTeamAsFriend(4,DEF)
SetTeamAsFriend(3,4)
SetTeamAsFriend(4,3)

SetTeamAsEnemy(ATT,5)
SetTeamAsEnemy(5,ATT)
SetTeamAsFriend(DEF,5)
SetTeamAsFriend(5,DEF)
SetTeamAsFriend(4,5)
SetTeamAsFriend(5,4)
SetTeamAsFriend(3,5)
SetTeamAsFriend(5,3)

SetTeamAsEnemy(ATT,6)
SetTeamAsEnemy(6,ATT)
SetTeamAsFriend(DEF,6)
SetTeamAsFriend(6,DEF)
SetTeamAsFriend(5,6)
SetTeamAsFriend(6,5)
SetTeamAsFriend(4,6)
SetTeamAsFriend(6,4)
SetTeamAsFriend(3,6)
SetTeamAsFriend(6,3)

SetTeamAsEnemy(ATT,7)
SetTeamAsEnemy(7,ATT)
SetTeamAsFriend(DEF,7)
SetTeamAsFriend(7,DEF)
SetTeamAsFriend(6,7)
SetTeamAsFriend(7,6)
SetTeamAsFriend(5,7)
SetTeamAsFriend(7,5)
SetTeamAsFriend(4,7)
SetTeamAsFriend(7,4)
SetTeamAsFriend(3,7)
SetTeamAsFriend(7,3)[/code]
You can see how easy it is to set them up (and how they are allied with each other). All you need to do to get them to spawn from a CP is assign the CP to their team number. (Use the invisible CP for AI teams.)

Re: 4 factions on maps

Posted: Wed Mar 25, 2009 5:31 pm
by Ping
Maveritchell wrote:
Ping wrote:
Teancum wrote:Yep, when I get time tonight I'll post the Geonosis Uber lua, which does just that (REP, CIS, Geonosians and Jedi)
Ok, thanks. Is it also possible to have all 4 of them fight against each other, and is it also possible to give all four sides CPs?
Absolutely. I wouldn't advise making it a conquest game if you're going to have four teams capturing CPs, though. (Although it might be fun to try.)

Here's an example from one of my wave modes, which has seven teams (obviously not all against each other, but it's possible) running around at once:
Hidden/Spoiler:
[code] SetTeamName(3, "imp")
AddUnitClass(3, "imp_inf_gunner",2,60)
AddUnitClass(3, "imp_inf_heavymelee",2,60)
AddUnitClass(3, "imp_inf_commando",2,60)
AddUnitClass(3, "imp_inf_evotrooper",2,60)
SetUnitCount (3, 100)
--first number is numteam, second is numunits
AddAIGoal(3, "Deathmatch", 100)


SetTeamName(4, "imp")
AddUnitClass(4, "imp_inf_royalguard",2,60)
AddUnitClass(4, "imp_inf_commander",2,60)
AddUnitClass(4, "imp_inf_shadowtrooper",2,60)
SetUnitCount (4, 100)
--first number is numteam, second is numunits
AddAIGoal(4, "Deathmatch", 100)

SetTeamName(5, "imp")
AddUnitClass (5, "imp_hero_shadowguard", 1, 6)

SetUnitCount (5, 50)
--first number is numteam, second is numunits
AddAIGoal(5, "Deathmatch", 100)

SetTeamName(6, "imp")
AddUnitClass (6, "imp_hero_vader", 1, 1)
SetUnitCount (6, 50)
--first number is numteam, second is numunits
AddAIGoal(6, "Deathmatch", 100)

SetTeamName(7, "imp")
AddUnitClass (7, "imp_hero_sidious", 1, 1)
SetUnitCount (7, 50)
--first number is numteam, second is numunits
AddAIGoal(7, "Deathmatch", 100)

SetTeamAsEnemy(ATT,3)
SetTeamAsEnemy(3,ATT)
SetTeamAsFriend(DEF,3)
SetTeamAsFriend(3,DEF)

SetTeamAsEnemy(ATT,4)
SetTeamAsEnemy(4,ATT)
SetTeamAsFriend(DEF,4)
SetTeamAsFriend(4,DEF)
SetTeamAsFriend(3,4)
SetTeamAsFriend(4,3)

SetTeamAsEnemy(ATT,5)
SetTeamAsEnemy(5,ATT)
SetTeamAsFriend(DEF,5)
SetTeamAsFriend(5,DEF)
SetTeamAsFriend(4,5)
SetTeamAsFriend(5,4)
SetTeamAsFriend(3,5)
SetTeamAsFriend(5,3)

SetTeamAsEnemy(ATT,6)
SetTeamAsEnemy(6,ATT)
SetTeamAsFriend(DEF,6)
SetTeamAsFriend(6,DEF)
SetTeamAsFriend(5,6)
SetTeamAsFriend(6,5)
SetTeamAsFriend(4,6)
SetTeamAsFriend(6,4)
SetTeamAsFriend(3,6)
SetTeamAsFriend(6,3)

SetTeamAsEnemy(ATT,7)
SetTeamAsEnemy(7,ATT)
SetTeamAsFriend(DEF,7)
SetTeamAsFriend(7,DEF)
SetTeamAsFriend(6,7)
SetTeamAsFriend(7,6)
SetTeamAsFriend(5,7)
SetTeamAsFriend(7,5)
SetTeamAsFriend(4,7)
SetTeamAsFriend(7,4)
SetTeamAsFriend(3,7)
SetTeamAsFriend(7,3)[/code]
You can see how easy it is to set them up (and how they are allied with each other). All you need to do to get them to spawn from a CP is assign the CP to their team number. (Use the invisible CP for AI teams.)
Thank you! I'm still warming up to .lua code, but I get the gist of it.

Re: 4 factions on maps

Posted: Wed Mar 25, 2009 9:34 pm
by Teancum
And here's the Geonosis code:
Hidden/Spoiler:
ReadDataFile("SIDE\\rep.lvl",
"rep_inf_ep2_rifleman",
"rep_inf_ep2_rocketeer",
"rep_inf_ep2_engineer",
"rep_inf_ep2_sniper",
"rep_inf_ep2_rocketeer_chaingun",
"rep_inf_ep2_jettrooper",
"rep_hover_fightertank",
"rep_walk_atte",
"rep_hero_kiyadi",
"rep_hero_aalya",
"rep_hero_macewindu")

ReadDataFile("SIDE\\cis.lvl",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_walk_spider",
"cis_tread_hailfire",
"cis_inf_officer",
"cis_inf_droideka",
"cis_hero_countdooku")

ReadDataFile("SIDE\\geo.lvl",
"gen_inf_geonosian")

ReadDataFile("SIDE\\vehicles.lvl",
"rep_fly_gunship",
"cis_fly_geofighter")

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

ReadDataFile("SIDE\\heroes.lvl",
"rep_hero_plokoon")

ReadDataFile("SIDE\\jed.lvl",
"jed_knight_01",
"jed_knight_02",
"jed_knight_03")

ReadDataFile("SIDE\\infantry.lvl",
"rep_inf_ep2_officer",
"rep_inf_ep2_recon",
"rep_inf_ep2_commander",
"cis_inf_magnagaurd",
"cis_inf_recon",
"cis_inf_commander",
"rep_inf_fixer_commando")

SetupTeams{
rep = {
team = REP,
units = 80,
reinforcements = 600,
soldier = { "rep_inf_ep2_rifleman",20, 60},
assault = { "rep_inf_ep2_rocketeer",5, 15},
engineer = { "rep_inf_ep2_engineer",5, 15},
sniper = { "rep_inf_ep2_sniper",5, 15},
officer = {"rep_inf_ep2_officer",5, 15},
special = { "rep_inf_ep2_jettrooper",5, 15},

},
cis = {
team = CIS,
units = 80,
reinforcements = 600,
soldier = { "cis_inf_rifleman",20, 60},
assault = { "cis_inf_rocketeer",5, 15},
engineer = { "cis_inf_engineer",5, 15},
sniper = { "cis_inf_sniper",5, 15},
officer = {"cis_inf_officer",5, 15},
special = { "cis_inf_droideka",5, 15},
}
}
AddUnitClass(REP, "rep_inf_ep2_recon",1,3)
AddUnitClass(REP, "rep_inf_fixer_commando",1,2)
AddUnitClass(REP, "rep_inf_ep2_commander",1,1)
AddUnitClass(CIS, "cis_inf_recon",1,3)
AddUnitClass(CIS, "cis_inf_magnagaurd",1,2)
AddUnitClass(CIS, "cis_inf_commander",1,1)

SetHeroClass(CIS, "cis_hero_countdooku")
SetHeroClass(REP, "rep_hero_macewindu")



-- Geonosians Stats
SetTeamName(3, "geonosians")
SetUnitCount(3, 35)
AddUnitClass(3, "geo_inf_geonosian", 15)

-- Jedi Stats
SetTeamName(4, "jedi")
SetUnitCount(4, 13)
AddUnitClass(4, "rep_hero_kiyadi",1)
AddUnitClass(4, "rep_hero_aalya",1)
AddUnitClass(4, "rep_hero_plokoon",1)
AddUnitClass(4, "jed_knight_02",5)
AddUnitClass(4, "jed_knight_03",5)

--Team relationships
SetTeamAsFriend(3, DEF)
SetTeamAsFriend(DEF, 3)
SetTeamAsEnemy(ATT,3)
SetTeamAsEnemy(3,ATT)
SetTeamAsFriend(DEF,3)
SetTeamAsFriend(4, ATT)
SetTeamAsFriend(ATT, 4)
SetTeamAsEnemy(DEF, 4)
SetTeamAsEnemy(4, DEF)

Re: 4 factions on maps

Posted: Thu Mar 26, 2009 3:55 am
by sampip
I have a question, in the tutorial on the FAQ, it says something about setting a AI goal to Deathmatch.
Does this come in anywhere? Because I have tried to make a team, but they arent appearing in battle.

Edit: It's in Mav's but it isn't in Teancum's?

Re: 4 factions on maps

Posted: Thu Mar 26, 2009 6:01 am
by Teancum
Mine's just a snippet of the code. I put all of my AddAIGoal() functions near the top. Sorry for the confusion.

Re: 4 factions on maps

Posted: Thu Mar 26, 2009 12:08 pm
by sampip
Oh right, Thanks. I was just wondering.
Did you put it under:
function ScriptPostLoad()?

Re: 4 factions on maps

Posted: Thu Mar 26, 2009 1:43 pm
by Maveritchell
You can, but his and mine both come from ScriptInit() right under SetupTeams.