Darthfett
Aerospace/Cybersecurity Software Engineer
- Reaction score
- 615
I have another question, and this is totally theoretical at this point: If it wasn't a one time spawn, but say every time a unit respawned after dying it would go to one of the random locations, how would you change the trigger?
Try this:
This way it preserves all the regions, and resets the availableRegionCount to 9.
Trigger:
- Map Init
- Events
- Map initialization
- Conditions
- Actions
- Set Places[1] = Region 000 <gen>
- Set Places[2] = Region 000 Copy <gen>
- Set Places[3] = Region 000 Copy 2 <gen>
- Set Places[4] = Region 000 Copy 3 <gen>
- Set Places[5] = Region 000 Copy 4 <gen>
- Set Places[6] = Region 000 Copy 5 <gen>
- Set Places[7] = Region 000 Copy 6 <gen>
- Set Places[8] = Region 000 Copy 7 <gen>
- Set Places[9] = Region 000 Copy 8 <gen>
- Set availableRegionCount = 9
- For each (Integer A) from 1 to 9, do (Actions)
- Loop - Actions
- Set tempInt = (Random integer number between 1 and availableRegionCount)
- Set PlayersStartRegions[(Integer A)] = Places[tempInt]
- Set tempRegion = Places[tempInt]
- Set Places[tempInt] = Places[availableRegionCount]
- Set Places[availableRegionCount] = tempRegion
- Set availableRegionCount = (availableRegionCount - 1)
- Loop - Actions
- Set availableRegionCount = 9
- Events
Trigger:
- Start Players
- Events
- Conditions
- Actions
- Set tempInt = (Random integer number between 1 and availableRegionCount)
- Unit - Create 1 Footman for (Owner of (Dying unit)) at (Center of PlayersStartRegions[tempInt]) facing Default building facing degrees
- Set tempRegion = Places[tempInt]
- Set Places[tempInt] = Places[availableRegionCount]
- Set Places[availableRegionCount] = tempRegion
- Set availableRegionCount = (availableRegionCount - 1)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- availableRegionCount is equal to 0
- Then - Actions
- Set availableRegionCount = 9
- Else - Actions
- If - Conditions
This would automatically randomly distribute units to the regions, is this what you wanted?