For the complete documentation index, see llms.txt. This page is also available as Markdown.

Spawning Vehicles via Scriptable Buttons

Learn how to use object references and the Spawn Mode Object node to spawn vehicles via scripts, bypassing the limitations of vehicle pads.

Cover image

When designing game modes that use button-triggered vehicle spawns, developers may encounter difficulties attempting to reference vehicle pads directly within a script brain. This article outlines why this approach is restricted and provides an alternative method for spawning vehicles using object references.

Constraints of Vehicle Pads

Vehicle pads are classified as Forge Kit Objects, which means they cannot be referenced within a script brain. Furthermore, even if a reference to a pad could be established in a script, the internal spawning logic of those pads is not accessible via scripting to trigger spawns on command.

Spawning Vehicles via Object References

The recommended approach for triggering vehicle spawns—such as through a Scriptable Button press—is to use direct vehicle object references combined with the Spawn Mode Object node. This method allows you to duplicate an existing vehicle instance at a specific position in the level.

Implementation Workflow

To implement this setup, follow these steps:

  • Place the desired vehicle (such as a Wasp) on the map and create a reference for that object within your script.

  • Place a Spawn Mode Object node and feed the vehicle object reference into the node along with a position where the new vehicle instance should be created.

This method provides more flexibility than pads, as it allows you to spawn vehicles at arbitrary coordinates or via various custom triggers.


Source Data

Contributors

Alex Okom

Last updated