Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: spawn items in random locations
spawn items in random locations
Nov 18 2013, 10:27 am
By: DrZygote214  

Nov 18 2013, 10:27 am DrZygote214 Post #1



Hey, thanks for the help so far, I now understand LIDs and prolly will use them, but now a similar issue has come up. I want to spawn crystals at a random point on the map.

I really don't wanna make 64 locations just for this! There is also a limit to the # of locations (128 iirc). Is there a better way?



None.

Nov 18 2013, 2:22 pm Roy Post #2

An artist's depiction of an Extended Unit Death

The location limit is 255 (including the Anywhere location, which is location 64) on Brood War maps (source). If this is going to be a vanilla map, you're limited to 64 locations.

Look into grid systems. A static grid would be the easiest to implement, and you can do it with only a single location.




Nov 18 2013, 3:23 pm TF- Post #3

🤙🏾

There's one cool thing you can do if you want the crystals to be random yet have some control over where they spawn...

Basically you will designate one unit type as being a dummy that's not used for anything else, you can choose a burrowable one for less visual clutter, then you just spread those units all over the map in spots that feel right. Give all these units to say..player 7.
At map start two triggers will run repeatedly each trigger cycle for a few seconds, the first one randomizes a switch and the second one centers a location on a unit of the dummy unit type that's owned by player 7 and checks the switch state, if the switch is set you kill the dummy unit and create a crystal, if the switch is cleared you give the dummy unit to player 8 and don't do anything else.
A third trigger runs if you run out of dummy units owned by player 7 but still don't have enough crystals on the map, it starts spawning crystals using player 8 dummy units until you have enough. You can probably add more randomization here to avoid the last spawned crystals from clumping.
A final trigger removes all dummy units owned by all players.



🤙🏾

Nov 18 2013, 8:24 pm DrZygote214 Post #4



I like Căcox's idea!!!

But in order to reuse it and simplify, I won't remove any placed units. Instead, for a given switch state (say 23, or 010111), the trigger will give 23 lings at anywhere owned by p9 to p10, then center a location on a ling owned by p9, then create crystal at that location, then give all lings of p10 to p9.

However, I'd rather not used a burrowed or cloaked unit. The players on this map need detectors to fight a war, so it will look wierd discovering an invincible unit.

So, will this work for something like map revealers? Are there other odd "units" i could use?



None.

Nov 18 2013, 9:13 pm Roy Post #5

An artist's depiction of an Extended Unit Death

It will not work with Map Revealers, nor Start Locations. You could do it with Nuclear Missiles, but those obviously are visible while being unselectable.

If you can't use static grids (which is what TF described), you can use mobile grids, though they are more complicated over a large area and don't work as expected if there are any other air units in the area.

You can also use a location grid with a low sensitivity (larger gap between sizes), which uses no units but consumes a fair amount of locations upfront. You can get more unique points on the map with a location grid than you can by just hard placing several locations, though, so it may be a viable solution. It takes a lot of setup for a location grid, but it sounds like it might be the best option given your apparent use-case.

For 64 spawn points, you'd need a total of 16 location grid locations (8x8).

Post has been edited 1 time(s), last time on Nov 18 2013, 9:18 pm by Roy.




Nov 19 2013, 1:37 am Azrael Post #6



The best solution available to you is mobile grids. This would be an extremely simple way to accomplish what you want to do, in the exact way you want to do it.

There is a fatal flaw though, as Roy mentioned. This method isn't possible if there are air units on the map.

However, I've developed a method which allows some leniency for this restriction. If you require air units on the map, let us know which air units are used, whether they are controlled by humans/computers/both, the maximum number of each air unit that these players can control at the same time, and how each player creates/gains control/gets the air units in question.

If there are substitute air units you would be alright using (like a Science Vessel instead of an Overlord, for example), please specify that as well.

I can use this information to verify whether it's possible for you to use a mobile grid system. If it is, the implementation will be pretty straightforward.




Nov 19 2013, 4:34 am Kaias Post #7



Quote from Roy
It will not work with Map Revealers, nor Start Locations. You could do it with Nuclear Missiles, but those obviously are visible while being unselectable.

If you can't use static grids (which is what TF described), you can use mobile grids, though they are more complicated over a large area and don't work as expected if there are any other air units in the area.

You can also use a location grid with a low sensitivity (larger gap between sizes), which uses no units but consumes a fair amount of locations upfront. You can get more unique points on the map with a location grid than you can by just hard placing several locations, though, so it may be a viable solution. It takes a lot of setup for a location grid, but it sounds like it might be the best option given your apparent use-case.

For 64 spawn points, you'd need a total of 16 location grid locations (8x8).

Location grids can take fewer locations by using units for one axis, which is often called a "Hybrid Location Grid" (in the wiki its mentioned under Static and Location). I wrote a tutorial on location grids many years ago, which I think explains them well. If you want to avoid potential lag issues of cycling through units with gives, there's an easy way to cycle without it.

I recommend a sort of pseudo hybrid location grid. Line the bottom of the map with static units and create a bunch of locations of varying heights (as many or few as you want). Center a tall location on a random static unit and spawn your item. You can specify location/static-unit combinations when you trigger it; or you can randomize both the unit and the location, spawn the item at a offsite location and then try to move it there (avoiding any implacable terrain errors).



None.

Nov 19 2013, 4:57 am DrZygote214 Post #8



The problem with Kaias's idea is that it will only spawn crystals on the bottom half of the map. The problem with dynamic grids is that, yes, I will be needing several air units owned by players/computers fighting onthe map.

The problem with static grids seems to be the same as the problem with Cacox's method---choosing the best unit to preplace around the map.

There must be something I could use. Scanner sweep? "Unused Buillding"? Alan Turret? "Protoss Unused"? Won't any of these work? (be persistent and allow giving between P9 and P10). I prefer it to be something in the air so that players can still build anywhere, but I'm also considering invincible and neutral spider mines in addition to air cacoons.



None.

Nov 19 2013, 5:02 am Kaias Post #9



Quote from DrZygote214
The problem with Kaias's idea is that it will only spawn crystals on the bottom half of the map.
To access the top half of the map: create a location that is twice the height of the map, center that location on the static unit and then center the varying tall locations on the 2x map height location. See the Location Shifting section in the tutorial I linked- its the same thing except for the y axis.



None.

Nov 19 2013, 7:38 am TF- Post #10

🤙🏾

You need to constantly spawn crystals I see, thought it was just on map init.
I guess I would recommend something like the Tom Kazansky Wraith unit, cloaked, invincible and with a trigger that sets their energy to 100% every once in a while.



🤙🏾

Nov 19 2013, 7:26 pm MetalGear Post #11



I already have an experimental map made which uses this kind of system. Do you want a unique location to appear over each crystal? Also, how many crystals do you want spawned?



None.

Nov 20 2013, 12:38 am Azrael Post #12



Quote from DrZygote214
The problem with Kaias's idea is that it will only spawn crystals on the bottom half of the map. The problem with dynamic grids is that, yes, I will be needing several air units owned by players/computers fighting onthe map.

The problem with static grids seems to be the same as the problem with Cacox's method---choosing the best unit to preplace around the map.

There must be something I could use.

For being seemingly desperate for an answer, you seem to not care enough to read the entirety of the replies in your thread.

I specifically stated that it's possible for mobile grids to be used even if you have air units on the map, and asked for a few basic bullet points regarding their usage.

Post has been edited 2 time(s), last time on Nov 20 2013, 12:45 am by Azrael.




Nov 20 2013, 5:58 am Lanthanide Post #13



Quote from Kaias
spawn the item at a offsite location and then try to move it there (avoiding any implacable terrain errors).
Incidentally, if you do go with this method of spawning-then-moving for whatever your eventual solution is, be aware that if a crystal is picked up by a worker and subsequently dropped in an implacable area (eg worker dies on top of a beacon, or worker dies to close to other units / implacable terrain), the crystal will teleport back to the place on the map where it first was first created, and not the place where the worker picked it up from. This applies to all powerup objects, not just crystals. This should be recorded on the Wiki "SC Quirks and Nuances" page, along with other oddities around powerup behaviour that it would be worth reading about if you intend to use them for any significant purpose.



None.

Nov 21 2013, 5:15 pm Azrael Post #14



Quote from Lanthanide
Quote from Kaias
spawn the item at a offsite location and then try to move it there (avoiding any implacable terrain errors).
Incidentally, if you do go with this method of spawning-then-moving for whatever your eventual solution is, be aware that if a crystal is picked up by a worker and subsequently dropped in an implacable area (eg worker dies on top of a beacon, or worker dies to close to other units / implacable terrain), the crystal will teleport back to the place on the map where it first was first created, and not the place where the worker picked it up from. This applies to all powerup objects, not just crystals. This should be recorded on the Wiki "SC Quirks and Nuances" page, along with other oddities around powerup behaviour that it would be worth reading about if you intend to use them for any significant purpose.
Yep, I can definitely confirm this. Unfortunately this screws up so many systems without people ever realizing what's happening, because it's a bunch of counter-intuitive nonsense, like most of the game's inner workings.

I didn't know about this before creating a map titled "StarCraft 2" back in 2002 or thereabouts, which was a heavily modified melee that included a few new races. One of the abilities of a new race involved killing an Ursadon to generate a "Time Bomb" powerup.

Of course, once enough people started playing, there was a plethora of exploits to work out. One tactic that became really popular was running an Ursadon into someone's base (or their base defense) and bringing a small group of extra units to either kill your Ursadon yourself or to distract the units which killed the Ursadon.

Then they would drop a worker (they almost always had an original race ally do it for them due to differences in units cost), have the worker pick up the powerup, then get back into the transport and fly over water. The time bomb always had the same time before detonation, so they'd blow up their own transport over water just before the timer ended, which would put the powerup back where the Ursadon died, making it impossible for the other player to respond in any way before it detonated.

Never ended up changing it because it became considered a valid strategy lol. Just goes to show what people will come up with when things get competitive.

If you make sure your system never creates a powerup when there's already a powerup present (and always removes a powerup if there are 2+ present), it should address this issue. You can take it a step further and make the location where the powerup is moved from only 1x1 pixel, so it can never be occupied by 2 at the same time (though you'd still need a larger location around it for cleanup purposes, in the event a powerup gets sent back there).




Nov 24 2013, 6:08 am Kaias Post #15



Quote from Lanthanide
Quote from Kaias
spawn the item at a offsite location and then try to move it there (avoiding any implacable terrain errors).
Incidentally, if you do go with this method of spawning-then-moving for whatever your eventual solution is, be aware that if a crystal is picked up by a worker and subsequently dropped in an implacable area (eg worker dies on top of a beacon, or worker dies to close to other units / implacable terrain), the crystal will teleport back to the place on the map where it first was first created, and not the place where the worker picked it up from. This applies to all powerup objects, not just crystals. This should be recorded on the Wiki "SC Quirks and Nuances" page, along with other oddities around powerup behaviour that it would be worth reading about if you intend to use them for any significant purpose.
This can be avoided by checking if the spot is available beforehand by creating a unit thats the same size as the powerup at the offsite location and seeing if it can move there. If it can, create the powerup at the spawn point directly instead of at the offsite location.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[05:00 pm]
lil-Inferno -- benis
[10:41 am]
v9bettel -- Nice
[01:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[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
[10:11 pm]
Ultraviolet -- :P
[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
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
Please log in to shout.


Members Online: RIVE, Ultraviolet