Author |
Message |
Crow
Banned
Joined: Sat Aug 16, 2008 7:17 pm Posts: 282
|
Set number of troops in AI dropship (?)
As of B25 skirmish activities are decided by Base.rte/Activities/SkirmishDefense.lua.
What is the line/variable in SkirmishDefense.lua that decides the number of troops to be placed in an AI dropship?
|
Tue Aug 09, 2011 9:03 pm |
|
|
Roast Veg
Data Realms Elite
Joined: Tue May 25, 2010 8:27 pm Posts: 4521 Location: Constant motion
|
Re: Set number of troops in AI dropship (?)
Here, line 151: Code: for x = 0, math.ceil(math.random(3)) do
|
Tue Aug 09, 2011 10:02 pm |
|
|
Crow
Banned
Joined: Sat Aug 16, 2008 7:17 pm Posts: 282
|
Re: Set number of troops in AI dropship (?)
So it chooses an integer between 1 and 3?
I could swear I saw four soldiers come out of a dropship.
|
Tue Aug 09, 2011 11:22 pm |
|
|
Roast Veg
Data Realms Elite
Joined: Tue May 25, 2010 8:27 pm Posts: 4521 Location: Constant motion
|
Re: Set number of troops in AI dropship (?)
Shouldn't have. You get a random number between 1 and 3 generated, then it is rounded up for some reason, I'm not sure why that is.
|
Tue Aug 09, 2011 11:25 pm |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
Re: Set number of troops in AI dropship (?)
That was probably left in by accident (the code likely used to be math.random() * 3, which gives decimal values).
|
Tue Aug 09, 2011 11:30 pm |
|
|
Crow
Banned
Joined: Sat Aug 16, 2008 7:17 pm Posts: 282
|
Re: Set number of troops in AI dropship (?)
Ok:
I set it to 0 and no dropships spawned.
I set it to 0.9 and no dropships spawned.
I set it to one, and dropships spawned, but they were carrying two soldiers each.
|
Tue Aug 09, 2011 11:42 pm |
|
|
Coops
Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
|
Re: Set number of troops in AI dropship (?)
I may be wrong with my math here but the x value is set to 0. That could mean it starts at zero and makes a unit in the dropship, then it gets to 1 and makes one more.
See what happens if you make the x value start at 1 instead of 0.
|
Wed Aug 10, 2011 12:16 am |
|
|
Crow
Banned
Joined: Sat Aug 16, 2008 7:17 pm Posts: 282
|
Re: Set number of troops in AI dropship (?)
I tried that earlier, and it didn't work, but I managed to fix it by doing this: Code: for x = 0, math.random() do
|
Wed Aug 10, 2011 12:38 am |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Set number of troops in AI dropship (?)
It spawned two actors because you told the for loop to start at 0, and then go to 1. Meaning it iterated the code exactly twice, meaning you got two actors.
If you want it to be more intuitive, change it to: for x = 1, math.random([soldiercount]) do
|
Wed Aug 10, 2011 4:55 am |
|
|
Roast Veg
Data Realms Elite
Joined: Tue May 25, 2010 8:27 pm Posts: 4521 Location: Constant motion
|
Re: Set number of troops in AI dropship (?)
Oh durr. Of course, Grif explains it perfectly.
|
Wed Aug 10, 2011 2:34 pm |
|
|
Coops
Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
|
Re: Set number of troops in AI dropship (?)
That's exactly what I said though.
|
Wed Aug 10, 2011 4:56 pm |
|
|
Crow
Banned
Joined: Sat Aug 16, 2008 7:17 pm Posts: 282
|
Re: Set number of troops in AI dropship (?)
No it isn't. You didn't say to remove the math.ceil function. On another note, in lists of actors and weapons, e.g.: Code: self.WList = { "Pistol" } how does the script know to which weapon in which ini the term "Pistol" (in this case) refers? What if there is, say, a weapon called SMG in Ronin.rte, and one called SMG in base.rte?
|
Wed Aug 10, 2011 5:39 pm |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
Re: Set number of troops in AI dropship (?)
If you want to specify the RTE, do this: Code: self.WList = { "Base.rte/Pistol" }
|
Wed Aug 10, 2011 6:04 pm |
|
|
|