🛋️Sit on couch interaction (workspot)
Add an "Sit" interaction.
Last updated
Was this helpful?
Add an "Sit" interaction.
Last updated
Was this helpful?
Published: Feb 24, 2025 by Last update: Feb 24, 2025 by Credits: @keanuWheeze for creating 90% of the scripts shared in this pages.
This page is a subsection of the Scripted interactions guide. It will teach you how to add an interaction to sit.
The logic shown here also applies to other similar workspot interactions.
Object Spawner (World Editor: entSpawner)
Most recent from Feb 09, 2025
Visual Studio Code or any IDE to edit lua files
Knowledges required :
You know how to create a mod using Wolvenkit.
You know how to spawn objects using entSpawner
You downloaded the template that contains all the necessary files
Find the place where you want to add the interaction, this can be anything, an existing couch, a new mesh you add, a case, a parapet, or even in the middle of nowhere.
Using entSpawner, add and position 2 Meta > Static Marker:
Position the 1st marker where the Sit icon will be displayed ;
Copy the X Y Z position of the marker ;
Position a 2nd marker where the animation will be played, it is usually placed lower than the icon, almost at the ground level ;
Copy the X Y Z position of the 2nd marker.
(Optional) You can save the markers in a group to more easily change the position later if you're not happy with where the icon appears or where the animation is played. But we won't need to export it.
In the interactions.lua
file, add your new device interaction inside the interactions.setupInteractions()
function :
The require contains the path to the workspot. Its instantiation takes 4 parameters:
An ID which must be unique accross all interactions
The icon and interaction coordinates
The animation coordinates
The animation rotation
Paste the X Y Z of the first marker into the first Vector4
, the fourth parameter must be ignored and set to 0.0
.
Do the same with the 2nd marker coordinates.
For the animation rotation, the axe you want to change is the 3rd parameter of the EulerAngles
. You will have to find the correct angle, this might require multiple tries to get it right.
The last line append the interaction to the workspots list of the file, this will ensure animations work properly.
If you're working with hot reload, you can change the interactions.lua
file from within your game folder and then directly press Reload all mods in the CET menu to see the result, without having to restart your game. Otherwise, redeploy your mod.
Not happy with the interaction range? or the icon visibility range? or the text label? Each interaction workspot comes with some parameters that you can change to your will.
Default couch parameters :
To change these, you can set their value before initializing the interaction, like so :
enterSounds
and exitSounds
both contain a list of sound effect names, only one will be played each time, the sound is selected ramdomly in the corresponding list.
For localizations 🇬🇧🇫🇷🇷🇺 -> Open the LocKey browser inside Wolvenkit.
You want to regroup your localizations? Use the utils/localizedText.lua
to give your localizations more meaningful names.
You want to add you own translations? Use the utils/lang.lua
file and take the time to translate your action in the other languages, all players will appriciate it! 😉
For icons ⁉️ -> Open the Asset browser inside Wolvenkit and search for the mappin_icons.inkatlas
. The Part Mapping tab will help you choose the appropriate icon, then simply adapt the icon name as such : hide_weapon -> HideWeaponIcon. (You have a doubt on the name ? Search for it in the Tweak browser)
For sounds 🎺 -> You can search for it in the SoundDB, or by using entSpawner Deco > Static Audio Emitter.