View unanswered posts | View active topics It is currently Tue Sep 29, 2020 3:56 am

 Page 1 of 1 [ 13 posts ]
 Print view Previous topic | Next topic
Set number of troops in AI dropship (?)
Author Message
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
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
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
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
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
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

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
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
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
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

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
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
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
Display posts from previous:  Sort by
 Page 1 of 1 [ 13 posts ]

#### Who is online

Users browsing this forum: No registered users

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ Cortex Command    Dev Log    Wiki    Game Discussion    Game and Licensing Support    Mod Making       Lua Scripting       Requests    Mod Releases       Older Mods    Scene Releases       Scene Making Planetoid Pioneers    Game Discussion    Pioneer Program Lounge Data Realms Off-Topic    Off Topic Chat       Gaming       Forum Games    Site Support & Feedback