Gem-Editor/Manual/Chapter 4: Scripting/Chapter 4.4: Spawn enemies

Intro
Spawning can be used to pop up entities on the map. Either to increase or to reduce the length or difficulty  of the played map. It also helps to reduce the number of units thus reducing the lag that could come up (Depends on the scale of the map).

The ACTION/COMMAND in this chapter is to “spawn” entities/objects.

Create type spawn
Create the Spawn entity

This can be an soldier/group of soldiers or an object (rock for example) both of these items will be explained.

To "spawn", the entities have to be hidden from sight until the players triggers a condition (Gem-Editor/Manual/Chapter 4: Scripting/Chapter 4.2: Triggers).

To “hide” the soldiers from view place soldiers in F3 mode.

Select all the soldiers and go to tags. Enter hidden to make the soldiers invisible if the script is not triggered. Give this soldier also group 1 so this group is a group on its own.




 * Note: If entities (soldiers in this case) are marked with "HIDDEN" the entities will not move around/shoot on enemies. They remain in “dormant” until triggered.

If a player triggered a condition you want to:

2: Move from its location to the desired place.

3: Delay the action for a couple of seconds/minutes to create “waves” of attacking forces/reinforcements.


 * Note that the scripts will be executed from the “up to down” approach.

To move an group of soldiers/vehicles in a fashion you have to create a “squad”(Gem-Editor/Manual/Chapter 4: Scripting/Chapter 4.3: Squad Creation).

To change the mood of a spawning entity create a command with: Actor_state



Select the tag given (group 1 in this case) wich entities will be affected, then the mode it will move to the waypoint. If a vehicle is added to the group it is wise to limit the max_speed_kph so the vehicle will actually drive with the group instead of speeding ahead.

Then create a “Squad_to_waypoint” (located in “OTHER”). (Gem-Editor/Manual/Chapter 4: Scripting/Chapter 4.1: Waypoints)

If the player triggers a condition, the entities will now be set in a mood and move. Because the entity moves the tag: “HIDDEN” will be removed, thus the player can now shoot/interact with them.