Custom elevators

This guide will describe the steps necessary to add new native elevator, using Object Spawner

Requirements

Tools

Knowledge

  • You need to have a basic understanding of:

    • Working with WolvenKit

    • Using Object Spawner (Spawning things and importing into WolvenKit)

Spawning nodes

Overview

  • In this guide, we will build a simple elevator with 2 floors

  • For this we will need 3 device nodes:

    • An elevator object

    • Two elevator terminals

  • Additionally, we will need two markers:

    • One per floor

    • These determine the position to which the elevator drives

Spawning Devices

Make sure to spawn the elevator and floor terminals as Device(Entity -> Device in Object Spawner)

  • For the elevator, we will use base\gameplay\devices\elevators\megabuilding_elevator\megabuilding_lift_1.ent

    • Spawn it as Device, and place it somewhere

  • For the terminals we will use base\gameplay\devices\elevators\terminals\elevator_floor_terminal_1.ent

    • Spawn two of them as Device, and place one per stop

Spawning Markers

  • For the markers, select Meta -> Static Markerin Object Spawner

  • Spawn two markers

  • In order to properly position them, do as follows for each marker / floor:

    • Move the elevator device spawned earlier to the position you want it to stop in

    • Right-Click the position (Under the Transform header) of the elevator device, and select Copy position and rotation

    • Select one marker, right click its position field, and select `Paste position and rotation`

    • Now you will have moved the marker into the same spot as the elevator

    • Repeat for each marker / floor

Assigning NodeRef's

  • In order to link and reference all the spawned object, each one will need its own, unique NodeRef

  • Expand the World Nodeheader and fill the NodeRef field with a unique string

  • In the end, we will have assigned 5 NodeRef's

  • For example:

    • $/terminal_top, $/terminal_bottom, $/marker_top, $/marker_bottom, $/elevator

Linking Devices

  • Next we need to tell the elevator which floors it can use

  • To do this, we will go to the Device -> Device Connections header of the elevator

  • Add one entry for each floor / terminal

    • Fill the device class name field (On the left), with the device class name of the terminal

      • In our case this would be ElevatorFloorTerminalControllerPS, which can also be found under the device header of the terminals

    • Fill the NodeRef field with the NodeRef of the terminal that you are linking

    • Keep in mind that the elevator will see the floors in the order in which you add them, so the first one in the list should be the lowest floor

Setting up persistency

  • In order for the elevator to be fully functional, the terminals must be set to be persistent

  • Do this by checking the Persistentcheckbox of each terminal

Setting up instance data

  • In order for each terminal to know which floor marker to use, and what its name is supposed to be, we will use entity instance data

  • For each terminal, navigate to:

    • Entity Instance Data / ElevatorFloorTerminalController / persistentState / elevatorFloorSetup

    • In there, set floorDisplayNameto the LocKey that you want to be used as name (E.g. LocKey#49237

    • Set floorMarkerto the NodeRef of the floor's static marker (E.g. $/marker_bottom)

    • Optionally, use the checkboxes under doorShouldOpenFrontLeftRightto determine which doors of the elevator should open on this floor

  • Optionally change the elevator speed and inital starting floor by modifying:

    • Entity Instance Data / LiftController / persistentState / liftSetup

Finishing up

  • Let's recap what you should have now:

    • A elevator, spawned as Device, with its own NodeRef, and linked to both terminals (Make sure you use the terminals NodeRefs, not the markers)

    • Two terminals, spawned as Device, set to be persistent, with their own NodeRefs, and properly setup instance data (Linking them to the floor markers and with names)

    • Two static markers, each with their own NodeRef, positioned correctly

  • Once you have all this, you are ready to export, and import into WKit using the Object Spawner import script

Last updated