View unanswered posts | View active topics It is currently Sun Jul 21, 2019 8:30 pm



Reply to topic  [ 13 posts ] 
 Set number of troops in AI dropship (?) 
Author Message
Banned
User avatar

Joined: Sat Aug 16, 2008 7:17 pm
Posts: 282
Reply with quote
Post 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
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post 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
Profile
Banned
User avatar

Joined: Sat Aug 16, 2008 7:17 pm
Posts: 282
Reply with quote
Post 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
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post 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
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3134
Location: A little south and a lot west of Moscow
Reply with quote
Post 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
Profile WWW
Banned
User avatar

Joined: Sat Aug 16, 2008 7:17 pm
Posts: 282
Reply with quote
Post 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
Profile
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post 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
Profile
Banned
User avatar

Joined: Sat Aug 16, 2008 7:17 pm
Posts: 282
Reply with quote
Post 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
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Set number of troops in AI dropship (?)
Oh durr. Of course, Grif explains it perfectly.


Wed Aug 10, 2011 2:34 pm
Profile
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post Re: Set number of troops in AI dropship (?)
That's exactly what I said though. :sad:


Wed Aug 10, 2011 4:56 pm
Profile
Banned
User avatar

Joined: Sat Aug 16, 2008 7:17 pm
Posts: 282
Reply with quote
Post 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
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3134
Location: A little south and a lot west of Moscow
Reply with quote
Post 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
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 13 posts ] 

Who is online

Users browsing this forum: No registered users


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

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.017s | 14 Queries | GZIP : Off ]