Pilot creation

From Naevwiki
Jump to: navigation, search


The pilot creation process has 3 important steps: spawning, equipping and AI. Each of these steps is handled by a separate set of Lua scripts.

To create a pilot it first must be part of a fleet (dat/fleet.xml). The fleet consists basically of a group of pilots and their associated AI. These can then be created from Lua with pilot.add(). During the Lua creation you can set their position and override their AI.


Spawning is determined by faction presence and the faction's spawn script. This script is defined in dat/faction.xml and should be unique to each faction. It handles when, where and how many pilots should be created through the use of timers. It aims to maintain a constant presence through reaction to leaving and entering pilots.


Equipping is done once the pilot is spawned through the ai/equip/* scripts. It runs ai/equip/equip.lua on the pilot which then chooses what exactly to give him. This allows ultimate flexibility when it comes to equipping the pilots.


After the pilot is spawned and equipped, the pilot's ai is initialized. This is in charge of choosing how the pilot will behave and what it will do. It does this through setting the memory of the pilot which will determine it's characteristics (when it runs, when it engages, etc...).