Page 1 of 1

Any way that only one unit spawns?

Posted: Tue Jun 02, 2020 5:27 pm
by gtgamtemp
.

Re: Any way that only one unit spawns?

Posted: Tue Jun 02, 2020 8:15 pm
by kiprobin
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.

Re: Any way that only one unit spawns?

Posted: Wed Jun 03, 2020 3:23 am
by Benoz
from my experience if you set the unit count to 0,1 this particular unit only spawns if you are in the opposing team.

Re: Any way that only one unit spawns?

Posted: Wed Jun 03, 2020 5:27 am
by Sporadia
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:

Code: Select all

SetupTeams{
	all = {
		team = ALL,
		units = 1,
		reinforcements = 150,
		soldier = {"all_inf_rifleman", 0, 1},
	}
}
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:

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},
	}
}
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:

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},
	}
}
To have 6 classes on a team, where there will always be exactly 1 unit of each class spawned (human or AI).

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)