Staredit Network

Staredit Network -> UMS Assistance -> picking random units within an area
Report, edit, etc...Posted by Zwo on 2006-09-08 at 15:26:34
I'm making a map similar to larva dodgers. For my map I want a few units to "explode" every few seconds, killing everyone near the larva.

When triggering this the larva will always explode near the same location, but I want it to be more spread over the map.

I've thought up a few ways to do this:

1) Moving a location over the larva and make it "explode" every few seconds.
2) Placing a location over the area where the larva are and make the trigger so to "explode" the larva at that location.
3) Placing lots of locations over the area where the larva are and randomly (using switches) pick a location where to "explode" a larva.

I haven't tried them yet, but the first 2 ways will most likely not work. Moving a location over the larva will result in "exploding" the larva closest to the topleft (more or less) corner of the map.
Placing a location over the larva area will just let the larva "explode" nearest to the center in the location.

The third way will probably work, but it requires a lot of triggering (since i want more than 1 unit at random locations to "explode" at the same time)


I want to know if there's an easy and quick way to "explode" the larva at random locations.
Report, edit, etc...Posted by Mini Moose 2707 on 2006-09-08 at 16:04:27
Trigger must be in order.

Trigger
Conditions:
¤ Player commands at least 1 "I MAKE LARVA EXPLODE"
Actions:
¤ Random all involved switches.
¤ Preserve Trigger

I'm assuming you won't be using a "I MAKE LARVA EXPLODE" unit, but just change the trigger to suit whatever's making it explode.
You need to make the judgement call on how many switches you need. Each one will represent a power of 2 later on.

Trigger
Conditions:
¤ Player commands at least 2^x larva
¤ Switch X is set
Actions:
¤ Clear Switch X
¤ Give 2^x larva at "Anywhere" from Player to Unrelated Player
¤ Preserve Trigger

You need to make these triggers substituting for x starting at 1. Start wherever the trigger does not excded the numebr of larva... let's use 50 larva for an example. We want the closest number 2^x < 50. Thus we would start at 32. THESE TRIGGERS MUST RUN FROM GREATEST TO LEAST, so our example would have triggers for 32, 16, 8, 4, 2, and 1.

Trigger
Conditions:
¤ Player commands at least 1 "I MAKE LARVA EXPLODE"
Actions:
¤ Center location "this larva explodes" on Larva owned by Player
¤ Larva explosion triggers
¤ Give ALL larva at "Anywhere" from Unrelated Player to Player
¤ Kill all "I MAKE LARVA EXPLODE"
¤ Preserve Trigger
Next Page (1)