Questions regarding spawning AI units.

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
commanderawesome
Field Commander
Field Commander
Posts: 971
Joined: Tue Aug 13, 2013 11:58 pm
Projects :: Skin Changer - Warfront - Other stuff
Games I'm Playing :: SWBF SWTOR KotOR EaW
xbox live or psn: AaTc_CmdrAwesome
Location: The Universe

Questions regarding spawning AI units.

Post by commanderawesome »

I have some questions about AI spawning:

1. This seems like a rather noobish question, but how do you edit the max units for a class, not the max number of AI that can spawn a unit, but the limit seen on the vanilla special classes that will also prevent the player from spawning if there are too many. I can't find any ODF or LUA references to it anywhere, but I know there are mods that use this so it can't be hard-coded.

2. Is it in any way possible to stop the AI from spawning as a certain unit after an in-game event occurs?
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: Questions regarding spawning AI units.

Post by Marth8880 »

commanderawesome wrote:1. This seems like a rather noobish question, but how do you edit the max units for a class, not the max number of AI that can spawn a unit, but the limit seen on the vanilla special classes that will also prevent the player from spawning if there are too many. I can't find any ODF or LUA references to it anywhere, but I know there are mods that use this so it can't be hard-coded.
I believe this is set by the game when the class has a PointsToUnlock value set. With that said, you could try inserting a line for it with its value set to 0 in the class's ODF. If that doesn't work, you could set it to some value greater than 0 and then in the ScriptPostLoad function in your mission script, use SetClassProperty with the class to set the PointsToUnlock value to 0. Not sure if this will retain the 'max spawned units' limit, but it's worth a shot, eh?
Samee3
First Lance Corporal
First Lance Corporal
Posts: 123
Joined: Sun Jul 05, 2015 5:07 pm
Projects :: BF2 Refresh Mod
Games I'm Playing :: Empire at War
xbox live or psn: VaporousFern310
Location: California, USA

Re: Questions regarding spawning AI units.

Post by Samee3 »

commanderawesome wrote:I have some questions about AI spawning:

1. This seems like a rather noobish question, but how do you edit the max units for a class, not the max number of AI that can spawn a unit, but the limit seen on the vanilla special classes that will also prevent the player from spawning if there are too many. I can't find any ODF or LUA references to it anywhere, but I know there are mods that use this so it can't be hard-coded.
I've always noticed that when I add PointsToUnlock to any units odf, there is a limit of how many can spawn. If I remember right (this is off the top of my head), the limit is 4 units. The limit itself is probably hard-coded.
User avatar
Kingpin
Jedi
Jedi
Posts: 1096
Joined: Fri Sep 13, 2013 7:09 pm
Projects :: The Sith Wars II
Location: Denver, CO
Contact:

Re: Questions regarding spawning AI units.

Post by Kingpin »

Samee3 wrote:
commanderawesome wrote:I have some questions about AI spawning:

1. This seems like a rather noobish question, but how do you edit the max units for a class, not the max number of AI that can spawn a unit, but the limit seen on the vanilla special classes that will also prevent the player from spawning if there are too many. I can't find any ODF or LUA references to it anywhere, but I know there are mods that use this so it can't be hard-coded.
I've always noticed that when I add PointsToUnlock to any units odf, there is a limit of how many can spawn. If I remember right (this is off the top of my head), the limit is 4 units. The limit itself is probably hard-coded.
Hidden/Spoiler:
[code] all = {
team = ALL,
units = 32,
reinforcements = 150,
turret = "all_bldg_defensegridturret",
soldier = { "sit_inf_trooper",7, 25},
assault = { "sit_inf_heavy",1, 4},
engineer = { "sit_inf_support",1, 4},
sniper = { "sit_inf_sniper",1, 4},
officer = { "sit_inf_flame",1, 4},
special = { "sit_inf_warrior",1, 4},

}[/code]
I believe the number of units in at a time is determined by the numbers on the right. The first one is the minimum amount of bots using that unit, and the second is the maximum.
Samee3
First Lance Corporal
First Lance Corporal
Posts: 123
Joined: Sun Jul 05, 2015 5:07 pm
Projects :: BF2 Refresh Mod
Games I'm Playing :: Empire at War
xbox live or psn: VaporousFern310
Location: California, USA

Re: Questions regarding spawning AI units.

Post by Samee3 »

Kingpin wrote:
Samee3 wrote:
commanderawesome wrote:I have some questions about AI spawning:

1. This seems like a rather noobish question, but how do you edit the max units for a class, not the max number of AI that can spawn a unit, but the limit seen on the vanilla special classes that will also prevent the player from spawning if there are too many. I can't find any ODF or LUA references to it anywhere, but I know there are mods that use this so it can't be hard-coded.
I've always noticed that when I add PointsToUnlock to any units odf, there is a limit of how many can spawn. If I remember right (this is off the top of my head), the limit is 4 units. The limit itself is probably hard-coded.
Hidden/Spoiler:
[code] all = {
team = ALL,
units = 32,
reinforcements = 150,
turret = "all_bldg_defensegridturret",
soldier = { "sit_inf_trooper",7, 25},
assault = { "sit_inf_heavy",1, 4},
engineer = { "sit_inf_support",1, 4},
sniper = { "sit_inf_sniper",1, 4},
officer = { "sit_inf_flame",1, 4},
special = { "sit_inf_warrior",1, 4},

}[/code]
I believe the number of units in at a time is determined by the numbers on the right. The first one is the minimum amount of bots using that unit, and the second is the maximum.
Come to think of it, you're right. Refer to tat2g_eli.lua
Post Reply