Back To Guides

Custom Interaction

This will add a custom interaction to the game using BeardLib's InteractionModule, to use with InteractionElements or custom units.

Shortcuts:

  • interactiontweakdata.lua
  • equipmentstweakdata.lua
  • missionmanager.lua

  • XML structure

    XML (Custom XML)
    <interactions> <interaction id="" interact_distance=""/> </interactions>

    Put the interactions module inside your level tag in your main.xml file to make sure it's only loaded when playing your heist:

    XML (Custom XML)
    <level ...> <interactions> <interaction .../> </interactions> </level>

    Add addional interaction tags if you need more:

    XML (Custom XML)
    <level ...> <interactions> <interaction .../> <interaction .../> <interaction .../> </interactions> </level>

    If you add your lootbag using Beardlib's XML Module, the module tag needs to be capitalized like this:

    XML (Custom XML)
    <Interactions> <interaction id="" interact_distance=""/> </Interactions>

    id

    String

    The ID for your interaction. Has to be unique.

    based_on

    String

    Will base your interaction on an already existing interaction.
    All tags, parameters and values will carry over, but can be overwritten.

    Check the interactiontweakdata.lua for interaction IDs to use.

    axis

    String

    Locks the interaction to a specific axis ( x, y or z), meaning a player can only interact when looking at it from the specified direction.

    Useful for example if the interaction should not be accessable from behind a wall.

    interact_distance

    Number

    The distance (in centimeters) it can be interacted from.

    text_id

    String

    The string ID for the text that appears on screen when looking at the interaction. For example "Press [F] to interact". Needs to be localized.
    Defaults to hud_interaction id.

    Use &BTN_INTERACT in your localization file to get the interaction keybind, as people might rebind the key.

    action_text_id

    String

    The string ID for the text that appears over other players when they interact. For example "Placing drill". Needs to be localized.

    timer

    Number

    Time (in seconds) it takes to complete the interaction. (Hold to interact)

    If not specified, the interaction will be instant. (Press to interact)

    special_equipment

    String

    ID of the special equipment the player needs to interact.

    Equipment IDs can be found in the equipmentstweakdata.lua.
    You can also create a Custom Special Equipment for this.

    equipment_consume

    Boolean

    Set to true if the special equipment should be removed from a player after interacting.
    Set to false if the special equipment should stay in the inventory.

    equipment_text_id

    String

    The string ID for if you don't have the required special equipment. For example "You need a keycard". Needs to be localized.

    blocked_hint

    String

    The string ID for when something is blocking the interaction. For example "You already have a keycard". Needs to be localized.

    sound_start

    String

    The sound ID of the sound that should be playing when starting the interaction.

    Sound IDs can be found in the Sound IDs sheet. They usually start with "bar_".

    You can also create a Custom Sound for this.

    sound_interupt

    String

    The sound ID of the sound that should be playing when interupting or canceling the interaction.

    Sound IDs can be found in the Sound IDs sheet. They are usually the sound ID for sound_start but with "_cancel" at the end.

    You can also create a Custom Sound for this.

    sound_done

    String

    The sound ID of the sound that should be playing when finishing the interaction.

    Sound IDs can be found in the Sound IDs sheet. They are usually the sound ID for sound_start but with "_finished" at the end.

    You can also create a Custom Sound for this.

    required_deployable

    String

    Like special_equipment but requires a deployable instead.

    deployable_consume

    Boolean

    Like equipment_consume but for deployables.

    force_update_position

    Boolean

    Determines if the interaction should constantly check for position to update. Useful if the interaction moves around

    start_active

    Boolean

    If the interaction should be active on startup. Defaults to true.

    If set to false, the interaction needs to be enabled using the sequence manager.

    additional parameters

    special_equipment_block
    upgrade_timer_multipliers
    dont_need_equipment
    possible_special_equipment

    Unit file

    These are some variables we can use in the unit file of your interactable unit, to further control the interaction.
    Put them into the interaction extension as a var tag:

    XML
    <extension name="interaction" class=""> <var name="" value="" /> </extension>

    tweak_data

    String The interaction ID to use for this unit.

    XML
    <var name="tweak_data" value="" />

    _interact_object

    String A object from the model which will be the interaction point. If not specified, the root point of the unit is used.

    XML
    <var name="_interact_object" value=""/>

    _special_equipment

    String The special equipment ID the player should get from interacting.
    Requires the SpecialEquipmentInteractionExt class in the interaction extension.

    <var name="_special_equipment" value="" />

    _remove_on_interact

    Boolean If the unit should be removed from the level after interacting.

    <var name="_remove_on_interact" value="" />

    _global_event

    String The ID for a global event to trigger GlobalEventTrigger elements when interacting. A list with base game global events can be found in missionmanager.lua.
    To make a custom global event simply write whatever you want in the value. Put that same string into a GlobalEventTrigger element and it will recognize it when interacting.

    <var name="_global_event" value=""/>

    _ray_object_names

    Table A table of objects from the model. Creates a ray cast between the player and the specified object. If anything is obstructing that ray, the interaction is blocked. Can be used to prevent interacting through walls.
    If possible, use axis instead as it's better for performance.

    <var name="_ray_object_names" type="table" > <var value=""/> </var>