Data Realms Fan Forums
http://forums.datarealms.com/

Set number of troops in AI dropship (?)
http://forums.datarealms.com/viewtopic.php?f=73&t=25061
Page 1 of 1

Author:  Crow [ Tue Aug 09, 2011 9:03 pm ]
Post subject:  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?

Author:  Roast Veg [ Tue Aug 09, 2011 10:02 pm ]
Post subject:  Re: Set number of troops in AI dropship (?)

Here, line 151:
Code:
for x = 0, math.ceil(math.random(3)) do

Author:  Crow [ Tue Aug 09, 2011 11:22 pm ]
Post subject:  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.

Author:  Roast Veg [ Tue Aug 09, 2011 11:25 pm ]
Post subject:  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.

Author:  TheLastBanana [ Tue Aug 09, 2011 11:30 pm ]
Post subject:  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).

Author:  Crow [ Tue Aug 09, 2011 11:42 pm ]
Post subject:  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.

Author:  Coops [ Wed Aug 10, 2011 12:16 am ]
Post subject:  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.

Author:  Crow [ Wed Aug 10, 2011 12:38 am ]
Post subject:  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

Author:  Grif [ Wed Aug 10, 2011 4:55 am ]
Post subject:  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

Author:  Roast Veg [ Wed Aug 10, 2011 2:34 pm ]
Post subject:  Re: Set number of troops in AI dropship (?)

Oh durr. Of course, Grif explains it perfectly.

Author:  Coops [ Wed Aug 10, 2011 4:56 pm ]
Post subject:  Re: Set number of troops in AI dropship (?)

That's exactly what I said though. :sad:

Author:  Crow [ Wed Aug 10, 2011 5:39 pm ]
Post subject:  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?

Author:  TheLastBanana [ Wed Aug 10, 2011 6:04 pm ]
Post subject:  Re: Set number of troops in AI dropship (?)

If you want to specify the RTE, do this:
Code:
self.WList = { "Base.rte/Pistol" }

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/