Preventing the AI from spawning as certain 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
Voyager7456

Preventing the AI from spawning as certain classes?

Post by Voyager7456 »

Hello again. :D

With the release of the Modding Tools, I've been happily poking away at the ODFs. :P

However, I was wondering if there was a way to stop the AI from spawning as a specific class? I looked around at some of the ODFs and couldn't see anything...

Thanks. :)
LordofEntropy

RE: Preventing the AI from spawning as certain classes?

Post by LordofEntropy »

Go to the mission script file of the map where you want to change the spawn numbers. They're in C:\BF2_ModTools\data_ModID\Common\scripts\ModID, in any of the .lua files (open in notepad). Scroll down until you see:

Code: Select all

	SetupTeams{
		rep = {
			team = REP,
			units = 32,
			reinforcements = 150,
			soldier  = { "snw_inf_wampa", 9,25},
			assault  = { "rep_inf_ep3_rocketeer",1, 4},
			engineer = { "rep_inf_ep3_engineer",1, 4},
			sniper   = { "rep_inf_ep3_sniper",1, 4},
			officer = {"rep_inf_ep3_officer",1, 4},
			special = { "rep_inf_ep3_jettrooper",1, 4},
	        
		},
    		cis = {
        		team = CIS,
       			units = 10,
        		reinforcements = -1,
        		soldier = { "CIS_inf_rifleman",9, 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},
(or the equivalent if you are playing under galactic civil war) and change the numbers following the class you don't want the bots to spawn as to 0, 0. So, for example, if you didn't want to bots to spawn as the wampa in the example above, you would change that part to read:

Code: Select all

SetupTeams{
		rep = {
			team = REP,
			units = 32,
			reinforcements = 150,
			soldier  = { "snw_inf_wampa", 0, 0},
                        ...................
That will set the min, max number of bots that will spawn as this character class to 0.
Schizo

RE: Preventing the AI from spawning as certain classes?

Post by Schizo »

We could do that with BF1 too... it's nothing new.
merlineater

Post by merlineater »

Er, how exactly can you put all the heroes on one map but so the AI cannot play as them??

Also, on a similar vein: when deciding which heroes to put on a map, how do you know what the names are... for instance, darth maul is:

SetHeroClass(CIS, "cis_hero_darthmaul")

What would say, dooku or yoda be?? WOuld it be Countdooku or just dooku.

I hope its clear what I'm saying :P

Oh also, is it possible to edit existing levels in this way:

eg. Geonosis??
saberhagen

Re: RE: Preventing the AI from spawning as certain classes?

Post by saberhagen »

Super_Shadowman wrote:Hmm? I never noticed that. Give me an example of a map where it was used.
Not a very exciting example, but on my Hoth Snow Patrol map the AI wasn't allowed to spawn as rocket troopers. They were only available to the player.
LordofEntropy

RE: Re: RE: Preventing the AI from spawning as certain class

Post by LordofEntropy »

@ merlin: Go to your mission script files in C:\BF2_ModTools\data_ModID\Common\scripts\ModID. Take one of the .lua files in the folder, and open it up. Scroll down till you see something like:

Code: Select all

    ReadDataFile("SIDE\\rep.lvl",
                             "rep_inf_ep3_rifleman",
                             "rep_inf_ep3_rocketeer",
                             "........"
             ReadDataFile("SIDE\\cis.lvl",
                             "cis_inf_rifleman",
                             "cis_inf_rocketeer",
                             "cis_inf_engineer",
                             "........"
And replace those two sections with:

Code: Select all

    ReadDataFile("SIDE\\all.lvl",
                "all_hero_luke_jedi",
                "all_hero_hansolo_tat",
                "all_hero_leia",
                "all_hero_chewbacca")
                    
    ReadDataFile("SIDE\\imp.lvl",
                "imp_hero_darthvader",
                "imp_hero_emperor",
                "imp_hero_bobafett")
                
    ReadDataFile("SIDE\\rep.lvl",
                "rep_hero_yoda",
                "rep_hero_macewindu",
                "rep_hero_anakin",
                "rep_hero_aalya",
                "rep_hero_kiyadimundi",
                "rep_hero_obiwan")
                
    ReadDataFile("SIDE\\cis.lvl",
                "cis_hero_grievous",
                "cis_hero_darthmaul",
                "cis_hero_countdooku",
                "cis_hero_jangofett")
This is from a section from the Mos Eisley Assault mission script. It tells the game to load each of those character classes when it opens the map. Then scroll down (in the same file) until you see:

Code: Select all

	SetupTeams{
		rep = {
			team = REP,
			units = 20,
			reinforcements = 150,
			soldier  = { "rep_inf_ep3_rifleman",9, 25},
			assault  = { "rep_inf_ep3_rocketeer",1, 4},
			engineer = { "rep_inf_ep3_engineer",1, 4},
			sniper   = { "rep_inf_ep3_sniper",1, 4},
			officer = {"rep_inf_ep3_officer",1, 4},
			special = { "rep_inf_ep3_jettrooper",1, 4},
	        
		},
		cis = {
			team = CIS,
			units = 20,
			reinforcements = 150,
			soldier  = { "cis_inf_rifleman",9, 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},
		}
	}

and replace this section with:

Code: Select all

    SetupTeams{
        hero = {
            team = ALL,
            units = 32,
                reinforcements = -1,
                soldier = { "all_hero_hansolo_tat",1,2},
                assault = { "all_hero_chewbacca",   1,2},
                engineer= { "all_hero_luke_jedi",   1,2},
                sniper  = { "rep_hero_obiwan",  1,2},
                officer = { "rep_hero_yoda",        1,2},
                special = { "rep_hero_macewindu",   1,2},           
        },
    }   

    AddUnitClass(ALL,"all_hero_leia",   1,2)
    AddUnitClass(ALL,"rep_hero_aalya",  1,2)
    AddUnitClass(ALL,"rep_hero_kiyadimundi",1,2)

    SetupTeams{
        villain = {
            team = IMP,
            units = 32,
            reinforcements = -1,
                soldier = { "imp_hero_bobafett",    1,2},
                assault = { "imp_hero_darthvader",1,2},
                engineer= { "cis_hero_darthmaul", 1,2},
                sniper  = { "cis_hero_jangofett", 1,2},
                officer = { "cis_hero_grievous",    1,2},
                special = { "imp_hero_emperor", 1,2},

        },
    }   
    AddUnitClass(IMP, "rep_hero_anakin",1,2)
    AddUnitClass(IMP, "cis_hero_countdooku",1,2)
This section tells the game when making the sides, those characters go on those sides (villains/heroes or whatever you want to name them). That segment is also from the Mos Eisley Assault script. If you want to prevent the bots from spawning as any of the characters, simply change the numbers after each character (ie. (IMP, "rep_hero_anakin",[bold]1,2[/bold])) to "0,0" which will set the minimum and maximum number of bots who will spawn as those characters. As for finding out the names of all the heroes in game, they're all right there in the code above :) So Count Dooku is "cis_hero_countdooku" and Yoda is "rep_hero_yoda."

As for getting the characters in the normal game maps, I'm not sure. It can probably be done, but I don't know how :\
merlineater

Post by merlineater »

OK Thanks...will give it a try :P
merlineater

Post by merlineater »

OK...that doesn't seem to be working...have i missed something.

What I thought I'd try is to replace the Clone War space marines on Kashyyyk with Anakin and Dooku. I did the two above steps, but nothing changes upon playing the game.

Could anybody help please?

Many Thanks.
LordofEntropy

Post by LordofEntropy »

@ Merlin: When adding character classes not originally on the side you're spawning them as (ie, CIS heroes to the Republic Side) , you have to add them to the .req files in C:\BF2_ModTools\data_ModID\Sides\SideName. The names would be "SideName.req" and "SideNameShell.req." So simply add your character names/classes to the lists of characters already in there.
merlineater

Post by merlineater »

OK thanks LordofEntropy...

However, I may have been a bit unclear. On Space Kashyyyk, i want to replace the clone marine with Anakin, and the droid marine with Dooku. So I wouldn't actually be placing any character classes on any other sides than their original.

Cheers
Post Reply