Page 1 of 1

Forcing AI Characters

Posted: Tue Jul 07, 2009 3:12 pm
by Fierfek
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?

Re: Forcing AI Characters

Posted: Tue Jul 07, 2009 10:40 pm
by [RDH]Zerted
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.

Re: Forcing AI Characters

Posted: Tue Jul 07, 2009 10:48 pm
by Fierfek
[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.
How do I do this?

Re: Forcing AI Characters

Posted: Tue Jul 07, 2009 11:05 pm
by [RDH]Zerted
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.

Re: Forcing AI Characters

Posted: Wed Jul 08, 2009 12:26 am
by Fierfek
[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.
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?

Re: Forcing AI Characters

Posted: Wed Jul 08, 2009 5:02 am
by hunting shadow
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.

Re: Forcing AI Characters

Posted: Wed Jul 08, 2009 6:23 am
by Battleffront_Conquer
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

Re: Forcing AI Characters

Posted: Wed Jul 08, 2009 7:07 am
by Par3210
im sure mav used this in his wave mode maps...

Re: Forcing AI Characters

Posted: Wed Jul 08, 2009 1:39 pm
by Fierfek
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?

Re: Forcing AI Characters

Posted: Thu Jul 09, 2009 12:03 pm
by MercuryNoodles
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},
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.

Re: Forcing AI Characters

Posted: Thu Jul 09, 2009 12:42 pm
by Fierfek
MercuryNoodles wrote:
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},
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.
Okay, I found a different topic, and have made the nescasary changes. Hoping it works...

Re: Forcing AI Characters

Posted: Thu Jul 09, 2009 9:30 pm
by [RDH]Zerted
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.