👗Wardrobe interaction (device)

Add an "Open wardrobe" interaction.

Published: Feb 24, 2025 by Akiway Last update: Feb 24, 2025 by Akiway 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 open the wardrobe menu.

The logic shown here also applies to other similar device like interactions.

Requirements

Tool/Software
Version

Wolvenkit (stable | nightly)

≥ 8.16.1 for Cyberpunk 2.21

Object Spawner ()

Most recent from Feb 09, 2025

Visual Studio Code or any IDE to edit lua files

Knowledges required :

Define the position

  1. Find the place where you want to add the interaction, this can be anything, an existing wardrobe, a new mesh you add, a secret compartment in the wall, or even in the middle of nowhere.

  2. Using entSpawner, add and position a Meta > Static Marker:

    1. Position the marker where the Wardrobe icon will be displayed ;

    2. Copy the X Y Z position of the marker.

    3. (Optional) You can save the marker in a group to more easily change the position later if you're not happy with where the icon appears. But we won't need to export it.

Wardrobe interaction - static marker

Add the interaction

In the interactions.lua file, add your new device interaction inside the interactions.setupInteractions() function :

local wardrobe = require("modules/devices/wardrobeDevice"):new(1, Vector4.new(1779.53, 2257.57, 183.47, 0.0))
wardrobe:init()

The require contains the path to the device. Its instantiation takes 2 parameters:

  1. An ID which must be unique accross all interactions

  2. The icon and interaction coordinates

Paste the X Y Z copied before into the Vector4, the fourth parameter must be ignored and set to 0.0.

Test the result

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.

Wardrobe interaction - result (with french game 🇫🇷)

Fine tune the interaction

Not happy with the interaction range? or the icon visibility range? or the text label? Each interaction device comes with some parameters that you can change to your will.

Default wardrobe parameters :

self.detectionAngle = 80
self.iconRange = 5
self.interactionRange = 1.5
self.iconRecord = "ChoiceIcons.OpenWardrobeIcon"
self.iconColor = HDRColor.new({ Red = 0.15829999744892, Green = 1.3033000230789, Blue = 1.4141999483109, Alpha = 1.0 })
self.name = GetLocalizedText("LocKey#35138")

To change these, you can set their value before initializing the interaction, like so :

local wardrobe = require("modules/devices/wardrobeDevice"):new(1, Vector4.new(1779.53, 2257.57, 183.47, 0.0))
wardrobe.iconRange = 1
wardrobe.interactionRange = 0.5
wardrobe:init()

Looking for something?

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.

Last updated

Was this helpful?