Any way that only one unit spawns?
Moderator: Moderators
-
gtgamtemp
- Recruit Womprat Killer
- Posts: 14
- Joined: Fri Apr 24, 2020 6:01 am
- Location: Spain
Any way that only one unit spawns?
.
Last edited by gtgamtemp on Thu Jan 28, 2021 7:21 am, edited 1 time in total.
-
kiprobin
- First Lance Corporal

- Posts: 120
- Joined: Wed Dec 11, 2019 3:52 pm
- Projects :: Trench War
- xbox live or psn: No gamertag set
Re: Any way that only one unit spawns?
You can set the maximum unit spawn via the lua file. Go in the lua file to set up teams, eg:
SetupTeams{
all = {
team = ALL,
units = 100,
reinforcements = 1250,
soldier = { "all_inf_rifleman",50, 80},
assault = { "all_inf_rocketeer",15,50},
engineer = { "all_inf_engineer",5,20},
sniper = { "all_inf_sniper",5,10},
officer = { "all_inf_officer",0,1},
special = { "all_inf_wookiee",1,4},
The number on the left side of each unit class represents the minimum number in play, and the one on the right is the max. So if you want one rifleman, from this example, set the min to 0 and the max to 1. eg:
soldier = { "all_inf_rifleman",0, 1},
You will then have a maximum of 1 rifleman on the map at any given time
You can do this for any of the classes.
SetupTeams{
all = {
team = ALL,
units = 100,
reinforcements = 1250,
soldier = { "all_inf_rifleman",50, 80},
assault = { "all_inf_rocketeer",15,50},
engineer = { "all_inf_engineer",5,20},
sniper = { "all_inf_sniper",5,10},
officer = { "all_inf_officer",0,1},
special = { "all_inf_wookiee",1,4},
The number on the left side of each unit class represents the minimum number in play, and the one on the right is the max. So if you want one rifleman, from this example, set the min to 0 and the max to 1. eg:
soldier = { "all_inf_rifleman",0, 1},
You will then have a maximum of 1 rifleman on the map at any given time
You can do this for any of the classes.
- Benoz
- Corporal

- Posts: 142
- Joined: Tue May 28, 2013 12:34 pm
- Projects :: Clone Wars Era Mod Version 2
- xbox live or psn: No gamertag set
- Location: Germany
Re: Any way that only one unit spawns?
from my experience if you set the unit count to 0,1 this particular unit only spawns if you are in the opposing team.
-
Sporadia
- Corporal

- Posts: 152
- Joined: Thu Jan 24, 2019 11:02 pm
- Projects :: No Mod project currently
- xbox live or psn: No gamertag set
Re: Any way that only one unit spawns?
Also, if you want this to apply to the whole team, I would change the setup teams line from units = 100 to units = 1. Do that and make the specific class parameters 0, 1 or 1, 1 like the people above are saying (first number is the minimum number of that class spawned, second number is the maximum. Human players can spawn as this class so long as they don't go over the max number. The AI will then try to fill in the rest and satisfy these 2 parameters, but the AI will also try to match the total number of units spawned on a team with the units = line). Then there are a few things you can do:
To do what you asked:
To have 6 classes on a team, where there is either 1 human player or 1 AI player spawned at a given time. And, the AI player picks a class at a random:
To have 6 classes on a team, where there is either 1 human player or 1 AI player spawned at a given time. And, the AI player always picks the engineer class:
To have 6 classes on a team, where there will always be exactly 1 unit of each class spawned (human or AI).
Also note that the SetupTeams function isn't the only way to create a team. You could achieve the exact same thing like this:
To do what you asked:
Code: Select all
SetupTeams{
all = {
team = ALL,
units = 1,
reinforcements = 150,
soldier = {"all_inf_rifleman", 0, 1},
}
}Code: Select all
SetupTeams{
all = {
team = ALL,
units = 1,
reinforcements = 150,
soldier = {"all_inf_rifleman", 0, 1},
assault = {"all_inf_rocketeer", 0, 1},
engineer = {"all_inf_engineer", 0, 1},
sniper = {"all_inf_sniper", 0, 1},
officer = {"all_inf_officer", 0, 1},
special = {"all_inf_wookiee", 0, 1},
}
}Code: Select all
SetupTeams{
all = {
team = ALL,
units = 1,
reinforcements = 150,
soldier = {"all_inf_rifleman", 0, 1},
assault = {"all_inf_rocketeer", 0, 1},
engineer = {"all_inf_engineer", 1, 1},
sniper = {"all_inf_sniper", 0, 1},
officer = {"all_inf_officer", 0, 1},
special = {"all_inf_wookiee", 0, 1},
}
}Code: Select all
SetupTeams{
all = {
team = ALL,
units = 6,
reinforcements = 150,
soldier = {"all_inf_rifleman", 1, 1},
assault = {"all_inf_rocketeer", 1, 1},
engineer = {"all_inf_engineer", 1, 1},
sniper = {"all_inf_sniper", 1, 1},
officer = {"all_inf_officer", 1, 1},
special = {"all_inf_wookiee", 1, 1},
}
}Also note that the SetupTeams function isn't the only way to create a team. You could achieve the exact same thing like this:
Code: Select all
SetTeamName(1, "ALL") -- sorry if "ALL" is the wrong name
SetUnitCount(1, 6) -- equivalent to putting units = 6 in the SetupTeams for team 1
SetReinforcementCount(1, 150) -- equivalent to putting reinforcements = 150 in the SetupTeams for team 1
AddUnitClass(1, "all_inf_rifleman", 1, 1) -- equivalent to putting soldier = {"all_inf_rifleman", 1, 1} in the SetupTeams for team 1
AddUnitClass(1, "all_inf_rocketeer", 1, 1)
AddUnitClass(1, "all_inf_sniper", 1, 1) -- the order of classes is important here: soldier, assault, sniper, engineer, officer, special; SetupTeams sorts these automatically
AddUnitClass(1, "all_inf_engineer", 1, 1)
AddUnitClass(1, "all_inf_officer", 1, 1)
AddUnitClass(1, "all_inf_wookiee", 1, 1)