Staredit Network > Forums > SC2 Assistance > Topic: [SOLVED] Respawning for an Arena-type map.
[SOLVED] Respawning for an Arena-type map.
Jul 24 2011, 11:45 pm
By: Project100  

Jul 24 2011, 11:45 pm Project100 Post #1



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.

Jul 24 2011, 11:57 pm Roy Post #2

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)
Triggers

Hope this helps!




Jul 25 2011, 12:17 am Project100 Post #3



I can't figure out how to set the variable portion of it



None.

Jul 25 2011, 12:23 am Roy Post #4

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.




Jul 25 2011, 12:31 am Project100 Post #5



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.

Jul 25 2011, 12:36 am Roy Post #6

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.




Jul 25 2011, 12:55 am Project100 Post #7



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.

Jul 25 2011, 1:22 am Roy Post #8

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?




Jul 25 2011, 1:25 am Project100 Post #9



Here we go, managed to get it to let me upload the map.

Attachments:
ArenaMap.SC2Map
Hits: 3 Size: 103.15kb



None.

Jul 25 2011, 2:13 am Roy Post #10

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:
ArenaMap.SC2Map
Hits: 1 Size: 108.92kb




Jul 25 2011, 2:17 am Project100 Post #11



Awesome. Thanks.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[03:08 pm]
Oh_Man -- example of wat u mean?
[05:59 am]
NudeRaider -- *is
[05:17 am]
NudeRaider -- despite all its flaws the sound design its fantastic
[10:29 pm]
Oh_Man -- homeworld 3 = massive disappointment
[2024-5-14. : 10:05 am]
Moose -- ya
[2024-5-14. : 5:23 am]
zsnakezz -- yes
[2024-5-12. : 8:51 pm]
l)ark_ssj9kevin -- Are you excited for Homeworld 3?
[2024-5-12. : 8:44 pm]
l)ark_ssj9kevin -- Hi Brusilov
[2024-5-12. : 4:35 pm]
O)FaRTy1billion[MM] -- Brusilov
Brusilov shouted: Hey, what happened to EUDDB? Is there a mirror for it somewhere? Need to do a little research.
my server that was hosting it died
[2024-5-10. : 8:46 pm]
NudeRaider -- Brusilov
Brusilov shouted: Hey, what happened to EUDDB? Is there a mirror for it somewhere? Need to do a little research.
https://armoha.github.io/eud-book/
Please log in to shout.


Members Online: 2claudiac812rh0, Ultraviolet, Roy