Spawn Units

From HIVE
Revision as of 12:50, 22 November 2010 by DevliN (talk | contribs) (Created page with "There are various cases where a mapper may want to spawn units when specific actions happen. Commonly you will see spawned units in "Defense" maps, "Nexus Wars" maps, "DotA" maps...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

There are various cases where a mapper may want to spawn units when specific actions happen. Commonly you will see spawned units in "Defense" maps, "Nexus Wars" maps, "DotA" maps, or anything else where units need to be automatically created at point or region. This page lists some of the more common situations.

Spawn with the Data Editor

There are various ways one can make units spawn using the Data Editor.

Spawn Unit Ability

This section is a stub. You can help out by adding more information.

Spawn Unit Upon Death

This can be done by creating a new Buff Behavior. In the Modifications + field, click the "Combat" tab and find the Death Response section. Now set the Effect field to a Create Unit effect.

Spawn with Triggers

The idea is pretty simple: place Points where you want your units to spawn and then use random integers to randomize the spawn.

Trigger Reference

Spawn system
 Events
 Timer - Every 15.0 seconds of Game Time
       ------- This is the interval of time at which the units will be spawned.
   Local Variables
       Unit Type = 0 <Integer>
       Random Point = 0 <Integer>
       Selected Point = No Point <Point>
   Conditions
   Actions
       Variable - Set Random Point = (Random integer between 1 and 5)
       General - If (Conditions) then do multiple (Actions)
           If Then Else
               General - Else if (Conditions) then do (Actions)
                   Else If
                       Random Point == 1
                   Then
                       Variable - Set Selected Point = Point 001
               General - Else if (Conditions) then do (Actions)
                   Else If
                       Random Point == 2
                   Then
                       Variable - Set Selected Point = Point 002
               General - Else if (Conditions) then do (Actions)
                   Else If
                       Random Point == 3
                   Then
                       Variable - Set Selected Point = Point 003
               General - Else if (Conditions) then do (Actions)
                   Else If
                       Random Point == 4
                   Then
                       Variable - Set Selected Point = Point 004
               General - Else if (Conditions) then do (Actions)
                   Else If
                       Random Point == 5
                   Then
                       Variable - Set Selected Point = Point 005
       Variable - Set Unit Type = (Random integer between 1 and 6)
       ------- The use of If-Then-Else is just to show that both methods work.
       General - If (Conditions) then do (Actions) else do (Actions)
           If
               Unit Type == 1
           Then
               Unit - Create 1 Zealot for player 0 at Selected Point using point facing (Ignore Placement)
               ------- Notice the point at which the unit is created is the "Selected Point" Point variable.
           Else
               General - If (Conditions) then do (Actions) else do (Actions)
                   If
                       Unit Type == 2
                   Then
                       Unit - Create 1 Sentry for player 0 at Selected Point using point facing (Ignore Placement)
                   Else
                       General - If (Conditions) then do (Actions) else do (Actions)
                           If
                               Unit Type == 3
                           Then
                               Unit - Create 1 Baneling for player 0 at Selected Point using point facing (Ignore Placement)
                           Else
                               General - If (Conditions) then do (Actions) else do (Actions)
                                   If
                                       Unit Type == 4
                                   Then
                                       Unit - Create 1 Roach for player 0 at Selected Point using point facing (Ignore Placement)
                                   Else
                                       ------- Notice I am not using the integers 5 and 6. This is simply because I wanted those two integers to represent a "No spawn" situation. More empty integers you'll have like this, less chances the spawn system will actually spawn a unit. This is just a personnal choice.

Please take note that there are comments within the trigger above.

See Also