| 05-24-2004, 12:07 AM | #1 |
set a seperation value between a point. That doesn't make sense, this is what I mean: 25 buildings are created at the start of the game at 25 random points. When tested, it turned out that sometimes the buildings were next to yeah other, and that could ruin the fun out of the game. What I want is that there is a distance between each building during the creation, so that the buildings are never to close to each other. I was thinking of doing an if/then/else as an action, but I don't know how to specify distances. Here is the trigger: Start Up Events Conditions Actions For each (Integer A) from 1 to 25, do (Actions) Loop - Actions Set random_point = (Random point in (Playable map area)) Unit - Create 1 Burrow for Player 10 (Light Blue) at random_point facing Default building facing degrees "And some more crap creating destructables nearby the building" So if anyone get's my point, please reply ^_^ (no pun intended) |
| 05-24-2004, 12:24 AM | #2 |
This is, when i think about it, a bit complicated. Hmm, let me think about it for a bit. Hmmmm... Code:
For each integer a from 1 to 25 Run Trigger - Main Building Creation Trigger Code:
[b]Main Building Creation Trigger[/b] Set pos_of_building = random point in (playable map area) if (random unit in (region centered on (pos_of_building) with size (2000,2000)) equal to (your building) then Run - This Trigger Else Create one (your building) at (pos_of_building) facing default building facing degrees End if (not a command, just me signifying there is no more if block) That should be right. Do I get a rep? (Double edited for fixes) |
| 05-24-2004, 12:32 AM | #3 |
I think this will give you the results you want. If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions buildings_placed Equal to 25 Then - Actions -------- Done Placing Buildings -------- Else - Actions Set random_point = (Random point in (Playable map area)) If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions ((Region centered at random_point with size (200.00, 200.00)) contains (Random unit from (Units of type Orc Burrow))) Equal to False Then - Actions Unit - Create 1 Orc Burrow for Player 10 (Light Blue) at random_point facing Default building facing degrees Set buildings_placed = (buildings_placed + 1) Trigger - Run (This trigger) (checking conditions) Else - Actions Trigger - Run (This trigger) (checking conditions) edit: didn't refresh before I posted so I missed the above. They are basicly the same. |
| 05-24-2004, 12:50 AM | #4 | |
Quote:
I would give you some rep if you where more specific: Code:
if (random unit in (region centered on (pos_of_building) with size (2000,2000)) equal to (your building) What condition is that? "End if (not a command, just me signifying there is no more if block)" ??? |
| 05-24-2004, 02:21 AM | #5 |
I would suggest using this condition for your if\then\else: Code:
(Distance between (Position of (Unit)) and (Position of (Unit2))) Less than 500.00 |
| 05-24-2004, 02:34 AM | #6 |
Why not just make it so that it does a "Move location to random point" and then do the if then else. Pseudocode Move -location- to random point in area If ( Building is not within 500 range of -location- ) then create Building-Type at -Location- else run This Trigger That way, if the point is a bad point, it reruns the trigger. Tada! |
| 05-24-2004, 03:10 AM | #7 |
((Region centered at random_point with size (200.00, 200.00)) contains (Random unit from (Units of type Orc Burrow))) Equal to False this is the condition I used for the if statement, it is a boolean comparison using Unit - Unit in region then Conversion - Convert Point with size, containing Random unit from unit group units of type orc burrow |
| 05-24-2004, 10:30 AM | #8 | |
Quote:
CynicalYouth took my idea while I was sleeping... Do I get a rep on his behalf? (Don't ask, I just like reps) |
