Adding Unit to Spawn Classes

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
Teletubbyterror
Recruit Womprat Killer
Posts: 5
Joined: Wed May 13, 2015 8:01 pm
Projects :: Working on my first real modification
Games I'm Playing :: SWBF2 Arma 3

Adding Unit to Spawn Classes

Post by Teletubbyterror »

I understand how to replace a unit like the standard rifleman with a hero unit such as Vader, but how would I add Vader on in addition to the units already there?

For instance, I want to have all the standard imperial troops in a mission and have Vader be playable not as a hero, but simply another unit from the spawn menu. Currently, I copy/paste the "special" unit script and replace the jet trooper script with the Vader script, but this removes the jet trooper entirely when in game.

Eventually, I want to add Leia, Solo, and Luke for the rebels side as well, simply as playable units. But, I cannot figure out how to do this without replacing the stock units entirely.

I researched and could not find anything, any help is greatly appreciated.
Raigiku
Private Third Class
Posts: 58
Joined: Mon Jun 05, 2017 5:14 pm
Projects :: Battlefront Redux
Games I'm Playing :: League of Legends
xbox live or psn: TheRaigiku
Location: Perú

Re: Adding Unit to Spawn Classes

Post by Raigiku »

You can either do this:
Hidden/Spoiler:
[quote="[RDH]Zerted"]You can also change the table in setup_teams.lua to add more units the normal way:
[quote]-- list of types
local typeList = { "soldier", "pilot", "assault", "sniper", "marine", "engineer", "officer", "special", "extra1", "extra2", "extra3" }[/quote]
[quote]SetupTeams{
rep = {
team = REP,
units = 128,
reinforcements = 680,
soldier = { "rep_inf_ep3_rocketeer",10, 10},
assault = { "rep_inf_ep3_engineer",25, 25},
engineer = { "rep_inf_ep3_sniper_felucia",10, 10},
sniper = { "rep_inf_ep3_officer",1, 1},
officer = { "rep_inf_ep3_marine",25, 25},
special = { "rep_inf_ep3_jettrooper",10, 10},
extra1 = { "rep_inf_ep3_rifleman",48,48},
},[/quote]
Edit: oops, didn't notice this was a year old
Edit 2: I've added everything in red. They don't have to be named extra1, extra2, etc.... Name them whatever you want. There is a max limit. I don't remember what it is, but the game crashes when you go over it.[/quote]
Or this:
Hidden/Spoiler:
[quote="phazon_elite"]Actually, the text can be placed here:

[quote]
SetupTeams{
rep = {
team = REP,
units = 128,
reinforcements = 680,
soldier = { "rep_inf_ep3_rocketeer",10, 10},
assault = { "rep_inf_ep3_engineer",25, 25},
engineer = { "rep_inf_ep3_sniper_felucia",10, 10},
sniper = { "rep_inf_ep3_officer",1, 1},
officer = {"rep_inf_ep3_marine",25, 25},
special = { "rep_inf_ep3_jettrooper",10, 10},

},
cis = {
team = CIS,
units = 128,
reinforcements = 650,
soldier = { "cis_inf_rifleman",10,10 },
assault = { "cis_inf_rocketeer",15, 15},
engineer = { "cis_inf_engineer",15, 15},
sniper = { "cis_inf_sniper",15, 15},
officer = {"cis_inf_officer",9, 9},
special = { "cis_inf_droideka",1, 4},
}
}

AddUnitClass(CIS, "cis_inf_marine",60,60)
AddUnitClass(REP, "rep_inf_ep3_rifleman",48,48)

SetHeroClass(CIS, "cis_hero_grievous")
SetHeroClass(REP, "rep_hero_yoda")[/quote]

I think it's easier to do that, but that's my opinion.[/quote]
Teletubbyterror
Recruit Womprat Killer
Posts: 5
Joined: Wed May 13, 2015 8:01 pm
Projects :: Working on my first real modification
Games I'm Playing :: SWBF2 Arma 3

Re: Adding Unit to Spawn Classes

Post by Teletubbyterror »

Thank you so, so much!
Donhomerj
Recruit Womprat Killer
Posts: 12
Joined: Sun Feb 17, 2019 5:55 am
Projects :: No Mod project currently.
Games I'm Playing :: SWBF2
xbox live or psn: No gamertag set

Re: Adding Unit to Spawn Classes

Post by Donhomerj »

Is it possible to make that extra unit AI only?
Robobermann
Private
Posts: 33
Joined: Wed Jul 25, 2018 6:58 pm
Projects :: My projects
Games I'm Playing :: SWBF2 2005

Re: Adding Unit to Spawn Classes

Post by Robobermann »

Donhomerj wrote:Is it possible to make that extra unit AI only?
You can make it a local ally, like the wookiees on Kashyyyk. Here is an example:
Hidden/Spoiler:
[code]function ScriptPostLoad()
SetProperty("CP1", "AllyPath", "CP1Spawn")
SetProperty("CP2", "AllyPath", "CP2Spawn")
SetProperty("CP3", "AllyPath", "CP3Spawn")
SetProperty("CP4", "AllyPath", "CP4Spawn")
SetProperty("CP5", "AllyPath", "CP5Spawn")
SetProperty("CP7", "AllyPath", "CP7Spawn")[/code]

[code]
SetTeamName (3, "mouse")
AddUnitClass (3, "imp_inf_mouse_droid", 5)
SetUnitCount (3, 7)
SetTeamAsFriend(3,ATT)
SetTeamAsFriend(3,DEF)
SetTeamAsFriend(ATT,3)
SetTeamAsFriend(DEF,3)[/code]
Donhomerj
Recruit Womprat Killer
Posts: 12
Joined: Sun Feb 17, 2019 5:55 am
Projects :: No Mod project currently.
Games I'm Playing :: SWBF2
xbox live or psn: No gamertag set

Re: Adding Unit to Spawn Classes

Post by Donhomerj »

Cool, thank you! Thats a cool and simple idea. Do you think this could work online? e.G. have the coruscant map conquest with the jedi soldiers from the campaign assisting the clones?
Robobermann
Private
Posts: 33
Joined: Wed Jul 25, 2018 6:58 pm
Projects :: My projects
Games I'm Playing :: SWBF2 2005

Re: Adding Unit to Spawn Classes

Post by Robobermann »

Donhomerj wrote:Cool, thank you! Thats a cool and simple idea. Do you think this could work online? e.G. have the coruscant map conquest with the jedi soldiers from the campaign assisting the clones?
I believe the only way to make this work online with stock maps is to make it an era mod. Check the FAQ if you are interested
Post Reply