Squeekems
TH.net Regular
- Reaction score
- 11
I am making a map that randomly generates itself at start. I am going to have 6 villages owned by players 7-12 and I want them to spawn in random locations on the map, but not near each other. Any ideas on how I could do this?
This trigger sets the points of the villages, clears the areas of trees, and spawns the town halls. Regions are centered on the points of the villages.
The problem with this is the villages can spawn next to each other.
This trigger sets the points of the villages, clears the areas of trees, and spawns the town halls. Regions are centered on the points of the villages.
The problem with this is the villages can spawn next to each other.
Trigger:
- Set Villages
- Events
- Conditions
- Actions
- Set TempPoint[0] = (Center of (Playable map area))
- For each (Integer A) from 0 to 5, do (Actions)
- Loop - Actions
- For each (Integer B) from 0 to 1, do (Actions)
- Loop - Actions
- Set TempReal[(Integer B)] = (Random real number between -5000.00 and 5000.00)
- Loop - Actions
- Set VillagePoint[(Integer A)] = (TempPoint[0] offset by (TempReal[0], TempReal[1]))
- Region - Center Village[(Integer A)] on VillagePoint[(Integer A)]
- Destructible - Pick every destructible in Village[(Integer A)] and do (Destructible - Remove (Picked destructible))
- Unit - Create 1 Village Hall for (Player(((Integer A) + 7))) at VillagePoint[(Integer A)] facing Default building facing degrees
- For each (Integer B) from 0 to 1, do (Actions)
- Loop - Actions
- Custom script: call RemoveLocation(udg_TempPoint[0])