How to build towers in random locations?

I am waking an auto builder/commander for different towers, but I cant build more than one at the same location, but I dont know how to make them random.

prob usinga Math.random func or using a array (with all positions u can summon at and yadayadayada)
and using a array sorter (like first: summon at positions[1].x,positions[1].y)

1 Like

Yes. as riticmaster said, doing some random calculations with an array of the possible coords works. For a rather complex example of a randomized level (the terrain chunks) you can look through the code for “Stranded in the desert” one of the levels i crafted. There’s a starting area and an ending area, the bits in between are randomized.

1 Like

Sry for the delay, I haven’t worked on it for a while. So basically, I list all the possible coords, and then make something that randomly picks them? Or do I make something that goes through the list one at a time? @sotonin @Aya

i didn’t quite get what you meant with the other option but i guess this is the better option to try

1 Like

So I was using the level desert delta as my example, and i think it would work, however, if I were to list them like in the example like this

blahblahblah = [blah, blah, blah]

It wouldnt works because with coords you put a comma in between the x coord and the y coord.

possibleChoordinates = [32, 45, 67, 81, 91, 22]

(each highlighted section has x and y coords, and the coords are random numbers)

I am sure you see why it would not work. Please help?

Would I do this?

possibleCoords = { [21,33] , [34, 45] , [56, 67] }

The outside brackets should be square too:
possibleCoords = [[21,33], [34,45], [56,67]]

1 Like

Which squares of the enemy side can you place stuff?

Is this iron and ice or tundra tower? Because then you cant build on the enemy side at all

Iron and ice. I I thought you could?

I dont think so (at least you cant in tundra tower). I guess you have to try it out

1 Like