In-situ unit adding

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
[TFA]Padawan_Fighter
High General
High General
Posts: 806
Joined: Wed Mar 25, 2009 3:37 pm
Projects :: Ha - as if I will ever get back to them
Games I'm Playing :: SWBF2 ARK EliteDngrs
xbox live or psn: No gamertag set
Location: Lost at sea

In-situ unit adding

Post by [TFA]Padawan_Fighter »

So I'm thinking of making some sort of crazy BF2 Christmas party set on Hoth (conquest). I have a bunch of code console stuff in mind, but I'm trying to add some units.

Basically, I want to add wampas to the Alliance side. To do this, I open up the code console and type

Code: Select all

AddUnitClass(ALL,"snw_inf_wampa", 1,1)
But nothing happens. At best, though, Pilot Luke shows up on the unit list for some odd reason. Am I doing something wrong?

*EDIT* Now I'm doing ReadDataFile to let the game know where to get the class.

Code: Select all

ReadDataFile("SIDE\\snw.lvl", "snw_inf_wampa")
The game crashes after this line.
LEO
First Lance Corporal
First Lance Corporal
Posts: 130
Joined: Tue Nov 20, 2012 5:06 pm
Projects :: Map_for_swbf2
Games I'm Playing :: Swbf2
xbox live or psn: No gamertag set

Re: In-situ unit adding

Post by LEO »

why you don't put the wampas in your alliance side folder?
and then make the lua like this


ReadDataFile("dc:SIDE\\all.lvl", "snw_inf_wampa")
User avatar
Cleb
Lieutenant General
Lieutenant General
Posts: 711
Joined: Sun Jun 17, 2012 10:12 pm
Projects :: Learning how to use 3DS Max
Games I'm Playing :: BF2 CIV4 MC
xbox live or psn: ˙. ˙. ˙. ˙. ˙. ˙
Location: Somewhere
Contact:

Re: In-situ unit adding

Post by Cleb »

Yeah sometimes that happens to me where the hero replaces the unit. The only way i know how to fix it is to remove heroes. There is probably another way but I dont know. Also leo, that wasnt the problem. :wink:
User avatar
Nedarb7
Lieutenant General
Lieutenant General
Posts: 676
Joined: Sat Sep 22, 2012 3:41 pm

Re: In-situ unit adding

Post by Nedarb7 »

Instead of using "AddUnitClass" try this:

Code: Select all

SetupTeams{

        all={
            team = ALL,
            units = 32,
            reinforcements = 150,
            soldier = {"all_inf_rifleman_snow",9, 25},
            assault = {"all_inf_rocketeer_snow",1, 4},
            engineer   = {"all_inf_engineer_snow",1, 4},
            sniper  = {"all_inf_sniper_snow",1, 4},
            officer = {"all_inf_officer_snow",1, 4},
            special = {"all_inf_wookiee_snow",1, 4},
            pilot =  {"snw_inf_wampa",1, 4},        <--------------This
        },
I hope this helps.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: In-situ unit adding

Post by Teancum »

Nedarb7 wrote:Instead of using "AddUnitClass" try this:

Code: Select all

SetupTeams{

        all={
            team = ALL,
            units = 32,
            reinforcements = 150,
            soldier = {"all_inf_rifleman_snow",9, 25},
            assault = {"all_inf_rocketeer_snow",1, 4},
            engineer   = {"all_inf_engineer_snow",1, 4},
            sniper  = {"all_inf_sniper_snow",1, 4},
            officer = {"all_inf_officer_snow",1, 4},
            special = {"all_inf_wookiee_snow",1, 4},
            pilot =  {"snw_inf_wampa",1, 4},        <--------------This
        },
I hope this helps.
If I understand correctly he's doing this in-game using the cheat console, so multiple lines aren't really feasible.
User avatar
Nedarb7
Lieutenant General
Lieutenant General
Posts: 676
Joined: Sat Sep 22, 2012 3:41 pm

Re: In-situ unit adding

Post by Nedarb7 »

How did I miss that :oops:.
Yeah I guess what I said is pointless.
CressAlbane
Master Bounty Hunter
Master Bounty Hunter
Posts: 1519
Joined: Fri Dec 18, 2009 8:02 am
Projects :: CTF Arenas
Games I'm Playing :: Steam- cressalbane2
Location: ¿uoıʇɐɔoן ʎɯ sıɥʇ sı

Re: In-situ unit adding

Post by CressAlbane »

The line breaks don't really matter, though, do they?
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: In-situ unit adding

Post by Marth8880 »

They shouldn't.
LEO
First Lance Corporal
First Lance Corporal
Posts: 130
Joined: Tue Nov 20, 2012 5:06 pm
Projects :: Map_for_swbf2
Games I'm Playing :: Swbf2
xbox live or psn: No gamertag set

Re: In-situ unit adding

Post by LEO »

another tipp. the shipped lua compiler wont work if theres a space in the path.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: In-situ unit adding

Post by Teancum »

CressAlbane wrote:The line breaks don't really matter, though, do they?
Not necessarily, but to hand type all that in-game is not feasible.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: In-situ unit adding

Post by Maveritchell »

1) AFAIK, you can't ReadDataFile or ReadDataFileIngame (despite its name) in ScriptPostLoad.

2) If you use AddUnitClass after a hero has been added to a side, it'll make the hero selectable in the unit selection screen, although if chosen, the hero will still use a hero health bar. The added unit will then be the hero.
User avatar
[TFA]Padawan_Fighter
High General
High General
Posts: 806
Joined: Wed Mar 25, 2009 3:37 pm
Projects :: Ha - as if I will ever get back to them
Games I'm Playing :: SWBF2 ARK EliteDngrs
xbox live or psn: No gamertag set
Location: Lost at sea

Re: In-situ unit adding

Post by [TFA]Padawan_Fighter »

LEO wrote:why you don't put the wampas in your alliance side folder?
and then make the lua like this


ReadDataFile("dc:SIDE\\all.lvl", "snw_inf_wampa")
Because I want to do it all ingame, and potentially so that other players can join in on my Frankenstein editing.
Teancum wrote:
CressAlbane wrote:The line breaks don't really matter, though, do they?
Not necessarily, but to hand type all that in-game is not feasible.
Feasible shmeasible, I can do all that if I need to. -Possible- is the adjective I'm looking for.
Maveritchell wrote:1) AFAIK, you can't ReadDataFile or ReadDataFileIngame (despite its name) in ScriptPostLoad.

2) If you use AddUnitClass after a hero has been added to a side, it'll make the hero selectable in the unit selection screen, although if chosen, the hero will still use a hero health bar. The added unit will then be the hero.
I see. So, in order for it to work, I'd need to do it the other way around (Put stormtroopers on the wampa's side)? And also the fact that it is impossible entirely without actually modding the game?
Post Reply