Forcing AI Characters
Moderator: Moderators
- Fierfek
- High General

- Posts: 805
- Joined: Wed Jul 01, 2009 4:38 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Somewhere in the Galaxy (Most Likely Scrapping Tinnies)
Forcing AI Characters
Is it possible to force AI out of play? Like, if I want a map with only 1 of each unit, is it possible for a human player to kick an AI player out so he can be the desired unit?
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
Re: Forcing AI Characters
You can reserve a certain amount of a units for human players. What you want to do is allow 1 for AI and reserve 1 for humans. When a human spawns as the unit, go through and kill any AI that also has the same unit class.
- Fierfek
- High General

- Posts: 805
- Joined: Wed Jul 01, 2009 4:38 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Somewhere in the Galaxy (Most Likely Scrapping Tinnies)
Re: Forcing AI Characters
How do I do this?[RDH]Zerted wrote:You can reserve a certain amount of a units for human players. What you want to do is allow 1 for AI and reserve 1 for humans.
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
Re: Forcing AI Characters
I can't tell you exactly offhand. It has to do with the numbers on the AddUnit functions. The Getting Started document goes over it. Reread it.
- Fierfek
- High General

- Posts: 805
- Joined: Wed Jul 01, 2009 4:38 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Somewhere in the Galaxy (Most Likely Scrapping Tinnies)
Re: Forcing AI Characters
Okay, I reread it, but couldn't find what I need. I went over the lua guides as well, and still nothing. I also looked through my own luas for the addunit function, but couldn't find it. Now what?[RDH]Zerted wrote:I can't tell you exactly offhand. It has to do with the numbers on the AddUnit functions. The Getting Started document goes over it. Reread it.
- hunting shadow
- Private First Class
- Posts: 79
- Joined: Sun Jan 18, 2009 11:37 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Somewhere in the wilderness of Mandalore
- Contact:
Re: Forcing AI Characters
I'm not really sure if this is right, i'm actually not really experienced with .lua, but maybe it's this?:
special = { "cis_inf_droideka",1, 4},
Because for me it looks like the last number is the max and maybe the first number is the reserved for player thing? I read somewhere about it, but i'm not sure. Going to test it in half an our, then i cann tell you.
-edit: Sorry, I misread your question. Thought you wanted the ai out of game for one team. Anyways, what I suggestefd was wrong, I didn't notce any change after testing.
special = { "cis_inf_droideka",1, 4},
Because for me it looks like the last number is the max and maybe the first number is the reserved for player thing? I read somewhere about it, but i'm not sure. Going to test it in half an our, then i cann tell you.
-edit: Sorry, I misread your question. Thought you wanted the ai out of game for one team. Anyways, what I suggestefd was wrong, I didn't notce any change after testing.
- Battleffront_Conquer
- Master Sergeant

- Posts: 160
- Joined: Sat Apr 04, 2009 2:44 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: InDooRs
Re: Forcing AI Characters
I have also wanted to be able to have the AI be removed when a player comes into that units slot. IE, lets say you want to have the AI play as a commander unit, but you want to beable to play when you wish, but if you were to try, either the AI uses the slot and you have to wait for it to die, or the Ai never even uses the unit...
This can be very frustrating, I know, but I don not believe there is anyway around this.
sorry
This can be very frustrating, I know, but I don not believe there is anyway around this.
sorry
- Par3210
- Jedi

- Posts: 1033
- Joined: Sun Jun 14, 2009 10:31 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Owning people in SWBF2
- Contact:
Re: Forcing AI Characters
im sure mav used this in his wave mode maps...
- Fierfek
- High General

- Posts: 805
- Joined: Wed Jul 01, 2009 4:38 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Somewhere in the Galaxy (Most Likely Scrapping Tinnies)
Re: Forcing AI Characters
Is it possible to set a maximum amount of AI units? If it was, I would just set the maximum total units to one more than the AI maximum, meaning there could be one human unit and one AI unit of each class.
Does anyone know if it is possible to do this?
Does anyone know if it is possible to do this?
-
MercuryNoodles
- Jedi

- Posts: 1003
- Joined: Sun Mar 12, 2006 7:16 pm
- Projects :: Space - Boarding Action
- xbox live or psn: No gamertag set
Re: Forcing AI Characters
Let's start with this, for the last question. As for the original post, I believe there are threads (I vaguely recall at least one) dealing with human players taking an AI player's spot somewhere on the forums. Perform a search and see what you can find.Battlefront II Mission LUA Guide wrote:The SetupTeams sections will determine a few things. The team specifies which team the team being defined is (1 or 2) which gets it’s value REP from the variable that we defined above. If you recall, we defined REP = 1, therefore, the first team we set up here will be team 1. units = 20 specifies that there will always be 20 units on the field at any given time. You can play with these values if you want to have a huge battle, but be careful, as this will create much more strain on your system. The PC should be able to handle a pretty big load though. 64 on 64, or even higher should be pretty easily doable.
Reinforcements = 150 specifies that there will be 150 reinforcements. These values do not have to be the same for each side, so if you want to start out one team with some kind of disadvantage, you can offset that by giving that side more reinforcements for example. The other lines should be pretty self-explanatory. These specify which units will occupy which slots in the character carousel. You could (if desired) make one of your units a hero that is always available to any player.
The numbers in these lines define min and max numbers for these units. For example, we have 20 units total on the play field. The soldier unit is set to 9 min and 25 max. What this means is that there will ALWAYS be 9 soliders on the field, 1 rocketeer, 1 engineer, 1 sniper, 1 officer, and 1 jet trooper. The second number sets the max, so there will never be MORE than 25 soldiers, 4 rocketeers, 4 engineers, etc. The minimums are filled up first, and then the the game will fill up to the max’s randomly until the 20 unit maximum units on the field is hit. You should never have you minimums exceed your total number of units allowed on the field (in this example, the minimums would never be set to more than 20 in total.)
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},
- Fierfek
- High General

- Posts: 805
- Joined: Wed Jul 01, 2009 4:38 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Somewhere in the Galaxy (Most Likely Scrapping Tinnies)
Re: Forcing AI Characters
Okay, I found a different topic, and have made the nescasary changes. Hoping it works...MercuryNoodles wrote:Let's start with this, for the last question. As for the original post, I believe there are threads (I vaguely recall at least one) dealing with human players taking an AI player's spot somewhere on the forums. Perform a search and see what you can find.Battlefront II Mission LUA Guide wrote:The SetupTeams sections will determine a few things. The team specifies which team the team being defined is (1 or 2) which gets it’s value REP from the variable that we defined above. If you recall, we defined REP = 1, therefore, the first team we set up here will be team 1. units = 20 specifies that there will always be 20 units on the field at any given time. You can play with these values if you want to have a huge battle, but be careful, as this will create much more strain on your system. The PC should be able to handle a pretty big load though. 64 on 64, or even higher should be pretty easily doable.
Reinforcements = 150 specifies that there will be 150 reinforcements. These values do not have to be the same for each side, so if you want to start out one team with some kind of disadvantage, you can offset that by giving that side more reinforcements for example. The other lines should be pretty self-explanatory. These specify which units will occupy which slots in the character carousel. You could (if desired) make one of your units a hero that is always available to any player.
The numbers in these lines define min and max numbers for these units. For example, we have 20 units total on the play field. The soldier unit is set to 9 min and 25 max. What this means is that there will ALWAYS be 9 soliders on the field, 1 rocketeer, 1 engineer, 1 sniper, 1 officer, and 1 jet trooper. The second number sets the max, so there will never be MORE than 25 soldiers, 4 rocketeers, 4 engineers, etc. The minimums are filled up first, and then the the game will fill up to the max’s randomly until the 20 unit maximum units on the field is hit. You should never have you minimums exceed your total number of units allowed on the field (in this example, the minimums would never be set to more than 20 in total.)
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},
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
Re: Forcing AI Characters
Oops, I thought that was from the gutting started doc, not the mission lua guides. I completely forgot about those. If you follow that unit table into setup_teams.lua, you'll see that they ultimately get added to the game through the AddUnitClass() function. Looks like I just went into too much details.
