You mean something like this?
-
Set <point variable> = (Center of <region variable>[(Random integer number between X and Y)])
If so, first thing you need is a Region Array Variable (with your desired regions assigned to different indexes of that variable). Then you go:
- Set Variable action
- Choose your point variable as the variable that's being set
- As for the Value field: click it, choose Center of Region, click on the (Playable Map Area), use your region variable here
- As for the Index field: the function you're looking for is "Math - Random Number"
---
Though, as a personal recommendation - I'd suggest using a Point Array Variable instead.
Like this:
1) Set your points at map initialization (or better yet, during the first execution of the spawning trigger):
-
Set <Point Variable>[0] = (Center of <Region 1>)
-
Set <Point Variable>[1] = (Center of <Region 2>)
-
Set <Point Variable>[2] = (Center of <Region 3>)
-
Set <Point Variable>[3] = (Center of <Region 4>)
2) And then when you want to create an item:
-
Item - Create <Item Type> at <Point Variable>[(Random integer number between 0 and 3)]
3) Once you
permanently turn off your item spawning trigger, you can destroy the points:
-
Custom script: call RemoveLocation(udg_<Point Variable>[0])
-
Custom script: call RemoveLocation(udg_<Point Variable>[1])
-
Custom script: call RemoveLocation(udg_<Point Variable>[2])
-
Custom script: call RemoveLocation(udg_<Point Variable>[3])
Since you're struggling with scripts, here's a clarification - let's say you call your Point Variable "SpawnPoint", then the custom scripts above should look like this:
-
Custom script: call RemoveLocation(udg_SpawnPoint[0])
P.S. You might ask - does this leak? No, it doesn't. A leak happens when you create an "object" that is stored inside the memory despite no longer being useful. Here your set of points is being reused, so for as long as your item spawning trigger is running, that's not a leak.
--- BONUS ---
If you'd like, you could have it all in a single trigger - for example, like this:
-
Events
-

Time - Every 30.00 seconds of game time
-
Conditions
-
Actions
-

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-


If - Conditions
-



(Execution count of (This trigger)) Equal to 1
-


Then - Actions
-



Set ExecutionCount = (Random integer number between 1 and 10)
-



Set SpawnPoint[0] = (Center of SpawnArea1 <gen>)
-



Set SpawnPoint[1] = (Center of SpawnArea2 <gen>)
-



Set SpawnPoint[2] = (Center of SpawnArea3 <gen>)
-



Set SpawnPoint[3] = (Center of SpawnArea4 <gen>)
-


Else - Actions
-



-------- Do Nothing --------
-

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-


If - Conditions
-



(Execution count of (This trigger)) Less than or equal to ExecutionCount
-


Then - Actions
-



Item - Create Orb of Frost at SpawnPoint[(Random integer number between 0 and 3)]
-


Else - Actions
-



Trigger - Turn off (This trigger)
-



Custom script: call RemoveLocation(udg_SpawnPoint[0])
-



Custom script: call RemoveLocation(udg_SpawnPoint[1])
-



Custom script: call RemoveLocation(udg_SpawnPoint[2])
-



Custom script: call RemoveLocation(udg_SpawnPoint[3])