Custom Interaction
This will add a custom interaction to the game using BeardLib's InteractionModule, to use with InteractionElements or custom units.
XML structure
XML (Custom XML)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)Add addional interaction tags if you need more:
XML (Custom XML)If you add your lootbag using Beardlib's XML Module, the module tag needs to be capitalized like this:
XML (Custom XML)id
StringThe 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
StringLocks 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
NumberThe 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
NumberTime (in seconds) it takes to complete the interaction. (Hold to interact)
If not specified, the interaction will be instant. (Press to interact)
special_equipment
StringID 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
StringThe string ID for if you don't have the required special equipment. For example "You need a keycard". Needs to be localized.
blocked_hint
StringThe string ID for when something is blocking the interaction. For example "You already have a keycard". Needs to be localized.
sound_start
StringThe 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
StringThe 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
StringThe 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
StringLike special_equipment but requires a deployable instead.
deployable_consume
BooleanLike equipment_consume but for deployables.
force_update_position
BooleanDetermines if the interaction should constantly check for position to update. Useful if the interaction moves around
start_active
BooleanIf 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:
tweak_data
String The interaction ID to use for this unit.
XML_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_special_equipment
String
The special equipment ID the player should get from interacting.
Requires the SpecialEquipmentInteractionExt class in the interaction extension.
_remove_on_interact
Boolean If the unit should be removed from the level after interacting.
_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.
_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.