http://pastebin.com/m6ef7be4d
And this is main.lua:
http://pastebin.com/m6e13b5e3
Make no comments on the shitty code quality, please.
Moderator: Defcon moderators


Code: Select all
while GetRemainingUnits("AirBase") > 0 do
SendChat("Deploying forces")
while true do
local x = math.random()*360-180
local y = math.random()*360-180
if (IsValidPlacementLocation (x, y, "AirBase")) then
PlaceStructure (x, y, "AirBase")Code: Select all
while GetRemainingUnits("AirBase") > 0 do
while true do
local x = math.random(-16.1,50.1)
local y = math.random(-34.5,37)
if (IsValidPlacementLocation (x, y, "AirBase")) then
PlaceStructure (x, y, "AirBase")Ace Rimmer wrote:Question; is the math.random responsible for the utter slowness of placement?

xander wrote:A faster implementation might be to create a finite list or array of valid location for each continent, and have the computer pick from that list, or to create bounding boxes around each continent so that the choices of locations are more limited (which is what the second code block you have indicates that you have done).




Ace Rimmer wrote:SetActionTartget
Users browsing this forum: No registered users and 0 guests