I decided to start mapmaking with SC2... and I must say the triggers are strange. I am remaking the arena map I was going to make prior to SC2 coming out.
For the trigger(s): I have 51 respawn points, and want to make it randomly respawn you at one of them. After messing around with triggers for a while, I don't even know how to make it respawn a unit at one point.
Anyone have an example of this sort of thing or instructions for it?
None.
An artist's depiction of an Extended Unit Death
The "Create Unit" actions take a unit type and a point. To make this a random point in your group of respawn points, you're going to need to put these points into an array and then randomly select one to use.
Make a global point variable of array size 50. Set point[0] to your first point, point[1] to your second point... point[50] to your 51st point.
To pick a random point in this array, randomize an integer value between 0 and 50. Then use this random number as the index for the array. Here's an example:
SpawnAtRandomPoint
Events
------- Spawn Event
Local Variables
RandomPoint = My_Global_Point_Array[(Random integer between 0 and 50)] <Point>
Conditions
Actions
Unit - Create 1 My_Spawning_Unit for player 1 at RandomPoint facing 270.0 degrees (No Options)
The "Random Integer" function can be found under the Math label.
If you're not understanding all of this, you may get some help from the GalaxyWiki. Here's some useful links:
Variables (and arrays)TriggersHope this helps!
I can't figure out how to set the variable portion of it
None.
An artist's depiction of an Extended Unit Death
There's a "Set Variable" action, but you can also set it inline (like I did above). To do this, create a point variable and click on it. Just below the trigger box there is a section to set "Initial Value." Double-click on this and you can set the initial point.
I got it to -almost- work... It respawns the unit, but it's not random at all and spawns them at the initial point.
None.
An artist's depiction of an Extended Unit Death
I could point out the error if you post the trigger and/or the map.
It's either that you aren't setting up your array correctly, or you didn't set up the randomization correctly.
Not sure how to type the trigger into chat... and i can't upload it because my upload space is a rather large negative number.
I have the variable type as Point, and the initial value as the first point of the array, then i have it set underneath Point to Array with the first number as 1, and the second as 50.
None.
An artist's depiction of an Extended Unit Death
You can upload files to sites like
http://www.filedropper.com/ and
http://www.mediafire.com/ for free.
Did you fill the array variable's indexes with all of your points?
Here we go, managed to get it to let me upload the map.
Attachments:
None.
An artist's depiction of an Extended Unit Death
Alright, so you did a couple of things wrong. First, you never created a global variable point array to hold all your points. Second, your local variable wasn't random (you made it an array, which it shouldn't be, and filled all values with point 00).
Attached is the corrected trigger setup. In the Initialization trigger, you can see how each point is placed into an index in the global variable. In the Spawn_At_Random_Point trigger, you can see how a point is selected randomly from the array, and that randomly selected point is used when creating the unit.
Attachments: