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?
Re: Questions regarding spawning AI units.
Posted: Sat Jul 02, 2016 1:19 am
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?
Re: Questions regarding spawning AI units.
Posted: Sat Jul 02, 2016 1:08 pm
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.
Re: Questions regarding spawning AI units.
Posted: Sat Jul 02, 2016 1:15 pm
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.
Re: Questions regarding spawning AI units.
Posted: Sat Jul 02, 2016 1:29 pm
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