Skip to content

Adding startingunits

Phoib edited this page Jan 20, 2013 · 1 revision

Adding starting units is (currently) not possible.

However, with careful use of SpawnActor, and a modified MCV, you can set a series of units, each of which spawns the next unit.

Before you edit the code, make sure that the map.yaml of the shellmap does not have the following code:
-SpawnMPUnits:
-MPStartLocations:
Having these lines will make the shellmap crash on startup, if different starting units are specified.

Next, in rules/system.yaml, different starting units can be specified per faction, but only 1 per faction. Replace the line SpawnMPUnits with the following, per faction:
SpawnMPUnits@[factionName]:
InitialUnit: [factionMCV]
Faction: [factionName]
Where [factionName] is the Race name, referenced earlier in rules/system.yaml, and [factionMCV] is a specially prepared MCV.

The MCV must be specially prepared. It must not be buildable, have the right art, and spawn another unit. This can be done with the following code:
[factionMCV]
Inherits: [mcvName]
-Buildable:
RenderUnit:
Image: [mcvName]
FreeActor: Actor: [firstSpawnedUnit]
SpawnOffset: 2,3
Facing: 130
Where [factionMCV] is the name of the unit, referenced in rules/system.yaml, [mcvName] is the name of the standard MCV, and [firstSpawnedUnit] is the first unit to be spawned. This unit also consists of such code, where a standard template is inherited, buildoptions are turned off, the unit is given a name, and, if desired, a new unit is spawned. The new unit is spawned at the SpawnOffset, which is relative to the spawning unit. To create a ring of 9 units around your MCV, use the following SpawnOffsets:

  1. (on MCV) 2,3
  2. -2,0
  3. -2,0
  4. 0,-3
  5. 0,-2
  6. 2,0
  7. 2,0
  8. 0,2

You can extend this with more units if necassery. Due to the code behind SpawnOffset, a group of 5 infantry at one cell is currently not possible. All SpawnOffsets must be integers.

It is very important that no unit should spawn itself. This will cause the game to crash at startup.

Clone this wiki locally