Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Making a unit appear anywhere on a map
Making a unit appear anywhere on a map
Apr 18 2014, 11:23 pm
By: DoomDoomDoom  

Apr 18 2014, 11:23 pm DoomDoomDoom Post #1



How do I make a unit constantly move around a map randomly, stays for about 5 minutes at one spot then randomly teleport to another area of a map?



None.

Apr 19 2014, 12:47 am Sand Wraith Post #2

she/her

I believe their is an AI action in units.dat that involves roaming. See the neutral critters as a guideline. This will cause the unit to roam about like a Kakaru or other critter when not performing an explicit order.

As for stopping and then teleporting elsewhere: that will almost certainly require plugin work. You can set up a timer, count 5 minutes worth of frames, and then order the unit to Place COP at some random point on the map. I am not sure how effective this brute method would work though.




Apr 19 2014, 3:48 pm DoomDoomDoom Post #3



Ok I'll give that a try then.



None.

Apr 19 2014, 3:49 pm DoomDoomDoom Post #4



AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAck.
I meant to put this into the UMS assistance sorry.



None.

Apr 19 2014, 3:59 pm Roy Post #5

An artist's depiction of an Extended Unit Death

This would require a grid system of some sort. If you have a limited number of positions you want the unit to appear in, using regular locations or a static grid (depending on how many positions you have) would be the simplest thing to implement.

Location grids will give you the most control, but they take a lot of work to get up and running, and use up a ton of locations, so you'd probably have to convert your entire map to use the system as opposed to just this one thing.

A hybrid approach would be to have a large static grid set up across the map, and then use a mobile grid to move randomly away from a randomly selected static point.

Randomization article: http://www.staredit.net/starcraft/Randomization




Apr 19 2014, 5:01 pm lil-Inferno Post #6

Just here for the pie

Alternatively you could use observers that randomly move around the map, and then move the unit to the observer's location. It's not completely random, but it's an approach that doesn't use grids or anything beyond Starcraft's native limitations. With the 5 minute time limit, it could work pretty well.

For increased randomness, you could have more than one observer roaming around, and use random switches to select one.




Apr 19 2014, 8:19 pm DoomDoomDoom Post #7



Right now the map doesnt have a lot of triggs all the units are balenced and terrain is all done. So the grid wouldnt be too much problems. Thanks roy



None.

Apr 19 2014, 9:03 pm Leeroy_Jenkins Post #8



It seems like you've already got a solution here, but I figured I'd chime in with my solution. Basically I would just have however many burrowed units across the map at all the predefined "random" locations you would like to move a unit to. Then, when you would want to randomly select a location to move to, you could use random switches while cycling through the different spawn locations to chose one. This has many benefits to a grid system, which might require half the locations in your map. Theoretically you could do the entire system with just one mobile grid and possibly just one location, however the complexity of such a system would be intense. So if you have some extra units to spare in your map, and you could settle on a less than truly 'random' system, I would recommend doing it this way. Let me know if I didn't explain any of the topics fully enough.

This method is similar to Inferno's, although differs slightly, as Inferno's method would actually replicate true randomness quite nicely, however the clear drawback to Inferno's system is having 100 blurred units roaming your map.



None.

Apr 20 2014, 1:02 am DoomDoomDoom Post #9



I dont really know how to randomize the switch stuff.



None.

Apr 20 2014, 2:07 am lil-Inferno Post #10

Just here for the pie

If you don't know how to randomize switches then you probably shouldn't be attempting to use any sort of grid system. To randomize a switch you simply do the Set Switch action, and do Randomize.




Apr 20 2014, 2:13 am Roy Post #11

An artist's depiction of an Extended Unit Death

You're going to have to be more specific on what you don't understand. As Inferno says, The "Set Switch" action has a "Randomize" option, which is how you can randomize switches. This is mentioned in the randomization wiki article:
Quote from Wiki
Switches have two states, CLEAR (0) and SET (1).
Switch randomization is a built-in function of the Set Switch trigger action.
If two different outcomes is not be enough for you, there are ways of generating higher random numbers using switches.

For a static grid, you'd be giving a random number of units to a different player before centering the location onto one of the grid units. You can accomplish this by assigning each switch a number of units to give, such that if Switch 1 is set, you give 1 unit, if Switch 2 is set, you give 2 units, and if Switch 3 is set, you give 4 units. In that example, if Switch 1 is cleared and Switches 2 and 3 are set, you would end up giving 6 units to another player, and the static grid location would be centered onto the 7th unit. See the binary countoffs article for more information on this sort of arithmetic.

Did you go over the examples in the randomization wiki article? They explain several methods and how they work.




Apr 20 2014, 2:34 am DoomDoomDoom Post #12



I get it now. :O thanks



None.

Apr 20 2014, 12:47 pm Sacrieur Post #13

Still Napping

What kind of distribution do you need?

I can make you a system that's totally random or an algebraically defined distribution. For simplicity's sake, let's limit the resolution to one matrix square, although greater resolution can be achieved if desired.



None.

Apr 20 2014, 5:36 pm DoomDoomDoom Post #14



No I got it now. Thanks anyway.



None.

Apr 20 2014, 5:37 pm Azrael Post #15



Quote from Sand Wraith
I believe their is an AI action in units.dat that involves roaming. See the neutral critters as a guideline. This will cause the unit to roam about like a Kakaru or other critter when not performing an explicit order.

Just wanted to point out that he asked for random movements, and critters don't roam randomly. The randomization article Roy linked to mentions this near the end.




Apr 20 2014, 5:38 pm Sacrieur Post #16

Still Napping

Quote from DoomDoomDoom
No I got it now. Thanks anyway.

Are you sure? The above methods are too limited in scope imo.

It would be a good chance to introduce yourself to some more complex trigger design.



None.

Apr 20 2014, 7:36 pm DoomDoomDoom Post #17



Quote from Sacrieur
Quote from DoomDoomDoom
No I got it now. Thanks anyway.

Are you sure? The above methods are too limited in scope imo.

It would be a good chance to introduce yourself to some more complex trigger design.
Ok then. I wanted 50 spots or around that amount too be scattered around the map. Say the caster ( Zergling ) casted the spell and it randomly teleports the ling to one of the 50 spots. But then after 5 minutes no matter what you are doing again it teleports you to another one of the 50 spots. The spell would be in effect for about 15 minutes. I could make the 5 minute teleport into 3 minutes or less and the total 15 minute duration 10 if its too long or short. The spell can also be used by all other players once reached a certain lvl or exp range. If I wasnt detailed enough tell me please. Thanks. (I should have around 50 extra location spots left.)



None.

Apr 21 2014, 3:43 am NudeRaider Post #18

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Without going into details on the rest of the thread...

The most resource friendly and elegant way to trigger that is to burrow a unit at each of the 50 spots and have them owned by a neutral player, say P11.
Then, every trigger loop center the teleport target location of the spell to [burrowed unit type] owned by P11 at anywhere then give the unit at that location to P10.
When P11 doesn't own any [burrowed unit type] give all [burrowed unit type] back to P11.

That way you only need 1 location and no true randomization.

Keep in mind, however, that cycling through 50 units in the manner described takes roughly 4 seconds on fastest and that this method gives the leftmost [burrowed unit type] first and move on from left to right until none are left.
So if the player is able to see the burrowed units and their owner change (on the mini map) he might be able to time it right so he can roughly choose the place where he'll end up. This could be either a feature or undesireable.
In any case you can add (pseudo-)randomization through dcs or switches to prevent the issue, while still keeping the resource friendly system.




Apr 21 2014, 7:16 pm DoomDoomDoom Post #19



I see I see. thanks



None.

Apr 24 2014, 4:18 am Azrael Post #20



You could also place burrowed units (let's say Zerg Drones) for Player 9 at 64 different positions. Then when you want to teleport to a random position, you'd randomize 6 switches, and have these 6 triggers:

Condition: Switch 1 is Set.
Action: Give 1 Zerg Drone owned by Player 9 at Anywhere to Player 10.

Condition: Switch 2 is Set.
Action: Give 2 Zerg Drone owned by Player 9 at Anywhere to Player 10.

Condition: Switch 3 is Set.
Action: Give 4 Zerg Drone owned by Player 9 at Anywhere to Player 10.

Condition: Switch 4 is Set.
Action: Give 8 Zerg Drone owned by Player 9 at Anywhere to Player 10.

Condition: Switch 5 is Set.
Action: Give 16 Zerg Drone owned by Player 9 at Anywhere to Player 10.

Condition: Switch 6 is Set.
Action: Give 32 Zerg Drone owned by Player 9 at Anywhere to Player 10.

Then you'd just need to move the "teleport" location to "Zerg Drone owned by Player 9 at Anywhere".

This will result in the location being randomly centered on 1 of your 64 burrowed units.

To reset the system, you'd want to add a trigger that clears all 6 switches (or you could clear each one in its own "___ is set" trigger). Also, after moving the location at the end, you'd need to "Give all Zerg Drone owned by Player 10 at Anywhere to Player 9".

This system has the benefit of making the destination unpredictable, and the player cannot manipulate it to get a destination of their choice. Additionally, if two different players use their teleport ability at the same time, they'll both get a unique random destination, as opposed to a global method of randomization which would teleport both players to the same area.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:56 am]
Oh_Man -- cool bit of history, spellsword creator talking about the history of EUD ^
[09:24 pm]
Moose -- denis
[05:00 pm]
lil-Inferno -- benis
[10:41 am]
v9bettel -- Nice
[2024-4-19. : 1:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[2024-4-18. : 10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[2024-4-18. : 10:11 pm]
Ultraviolet -- :P
[2024-4-18. : 10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
Please log in to shout.


Members Online: NudeRaider, Roy