So I want to bring a unit to a location and it will randomly spawn another unit.
I made the trigger so that whenever a unit goes to the location, another unit spawns immediately.
I want to make it somewhat of a 'tall grass' in Pokemon.
Attachments:
None.
An artist's depiction of an Extended Unit Death
Is your question how to do randomization? We have a wiki article covering the subject:
http://www.staredit.net/starcraft/RandomizationJust have a trigger with different switch combinations in the conditions for each unit you want to include in the randomization. You can also use a DC as the condition, as described near the bottom of the article (and you can even make the DC increment based on randomized switches if you want to go a step further); this is useful for when you have a number of outcomes that doesn't fit into 2^n combinations.
Do you want it so that there is a certain chance of a unit being spawned, or a unit spawns every time but the particular unit is random?
None.
@Roy Yes, I'll look into it, thankyou
@MetalGear I want to have a random certain chance of the same unit being spawned
None.
I'm not so sure, maybe 60%
None.
Okay and at what refresh rate? 60% chance every second? Every 5 seconds? 10?
None.
Every time that unit dies, there will be a chance that it will spawn again
So I guess the refresh rate is after it dies?
None.
How will the unit spawn in the first place if the spawn trigger requires a non-existing unit to die?
Think about the logic. You walk into an area, and your triggers say, "has a spawned unit unit died? no, then i won't spawn". So units will never spawn by that logic.
None.
Zzz you have a point. How do I make it when a unit walks in, theres a chance to spawn, and then the trigger can only be refreshed when the spawn dies?
None.
So you want it to check once, and if the 40% odds happen and it doesn't spawn, then it'll never check again? Or it waits until the person leaves the area and reenters? Or, like in Pokemon, it waits until the person moves? Or if they stand there, will it keep trying every X seconds until something spawns? I think those are pretty much all the options.
How will the unit spawn in the first place if the spawn trigger requires a non-existing unit to die?
By checking for when the unit doesn't exist; not having spawned and being dead are the same thing
I want to make when you are just standing there and wait for the spawn to appear
None.
I want to make when you are just standing there and wait for the spawn to appear
Right, so you just stand there, and the 40% chance happens so it doesn't spawn. Will it never spawn now, or will it try again after X seconds?
It will try again after X seconds
None.
How many seconds is X? This is the refresh rate that MetalGear mentioned.
I guess 2 seconds would do
None.
What you'll need to do is randomize a number of switches, and then check their outcomes. For a 40% chance of failure, what you'll probably want to do is randomize 3 switches. This has 8 possible outcomes, and you'll want to map 3 of them to failure (37.5% chance; if you want it closer to 40%, you'll need to use more switches and map more of their outcomes).
You can do it like this (using Hydralisk for the spawning unit).
Player 1Player 2Player 3Player 4Current Player has suffered exactly 0 deaths of Cantina.Current Player brings at least 1 [men] to Spawn Location.Player 8 brings exactly 0 Hydralisk to Spawn Vicinity.Randomize Switch 1.Randomize Switch 2.Randomize Switch 3.Preserve Trigger. Player 1Player 2Player 3Player 4Switch 1 is Set.Switch 2 is Clear.Switch 3 is Clear.Current Player has suffered exactly 0 deaths of Cantina.Set deaths of Cantina to 24 for Current Player.Preserve Trigger. Player 1Player 2Player 3Player 4Switch 1 is Clear.Switch 2 is Set.Switch 3 is Clear.Current Player has suffered exactly 0 deaths of Cantina.Set deaths of Cantina to 24 for Current Player.Preserve Trigger. Player 1Player 2Player 3Player 4Switch 1 is Clear.Switch 2 is Clear.Switch 3 is Set.Current Player has suffered exactly 0 deaths of Cantina.Set deaths of Cantina to 24 for Current Player.Preserve Trigger. Player 1Player 2Player 3Player 4Current Player has suffered exactly 0 deaths of Cantina.Current Player brings at least 1 [men] to Spawn Location.Player 8 brings exactly 0 Hydralisk to Spawn Vicinity.Create 1 Hydralisk for Player 8 at Spawn Location.Preserve Trigger. Player 1Player 2Player 3Player 4Current Player has suffered at least 1 deaths of Cantina.Subtract 1 death of Cantina for Current Player.Clear Switch 1.Clear Switch 2.Clear Switch 3.Preserve Trigger. This assumes you're checking separately for each player. If you want a single timer that checks for everyone simultaneously, just make these triggers for Player 8 (or whichever player is the computer), and have it checking for when "Force 1 brings at least 1 [men] to Spawn Location" instead of Current Player.
Post has been edited 1 time(s), last time on Jul 7 2013, 2:16 am by Azrael.
Hmm I see, so lets say I want to increase the % to 50, I should just use 2 switches instead right?
None.
You can just use one switch for 50%.
Hmm I see, so lets say I want to increase the % to 50, I should just use 2 switches instead right?
A switch has two settings: set and cleared. You can use the "Set Switch" action to randomize the switch, making it either become cleared or set (aka 50%). Adding a second switch would change the chance to 25%. You should really read the page that Roy linked about randomization.