Page 1 of 1

In-situ unit adding

Posted: Sun Dec 16, 2012 1:28 pm
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.

Re: In-situ unit adding

Posted: Fri Dec 21, 2012 5:11 pm
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")

Re: In-situ unit adding

Posted: Fri Dec 21, 2012 5:27 pm
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:

Re: In-situ unit adding

Posted: Fri Dec 21, 2012 5:50 pm
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.

Re: In-situ unit adding

Posted: Fri Dec 21, 2012 6:49 pm
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.

Re: In-situ unit adding

Posted: Sat Dec 22, 2012 12:18 pm
by Nedarb7
How did I miss that :oops:.
Yeah I guess what I said is pointless.

Re: In-situ unit adding

Posted: Mon Dec 24, 2012 7:54 pm
by CressAlbane
The line breaks don't really matter, though, do they?

Re: In-situ unit adding

Posted: Tue Dec 25, 2012 1:39 am
by Marth8880
They shouldn't.

Re: In-situ unit adding

Posted: Tue Dec 25, 2012 7:23 am
by LEO
another tipp. the shipped lua compiler wont work if theres a space in the path.

Re: In-situ unit adding

Posted: Tue Dec 25, 2012 8:10 am
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.

Re: In-situ unit adding

Posted: Thu Dec 27, 2012 5:34 pm
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.

Re: In-situ unit adding

Posted: Sat Jan 05, 2013 3:14 am
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?