DirkScripts
Character States
Character states are admin-defined flags attached to a character. They can be purely visual (a status icon + message on the multichar selector) or fully blocking (disable the character entirely so the player can't pick it).
Common use cases: Coma, In Hospital, Detained, Banned, AFK β anything where you want to show or restrict a character's availability.
#Defining a State
In the configurator's States tab, each state has:
| Field | Purpose |
|---|---|
| Icon | FontAwesome icon shown next to the character on the selector. |
| Colour | Tint applied to the icon + status pill. |
| Message | Short text shown to the player ("Currently in hospital β back in 15 minutes"). |
| Disabled toggle | When on, the character can't be selected. The slot greys out. |
#Applying a State to a Character
Two ways:
1. From the configurator (admin)
The States tab has an Online Players sub-panel. Search any online character β pick a state from the dropdown β apply. Useful for moderation actions (Detained, Coma).
2. From a Lua resource (programmatic)
Use the setCharacterState export. Useful for jobs / scripts (e.g. ambulance script applying "In Hospital" automatically):
luaexports.dirk_multichar:setCharacterState(charId, 'in_hospital', { -- optional payload, e.g. timer / extra data shown to the player endsAt = os.time() + 900, })
#State Visibility
States are visible to the player when they next open the multichar selector β they see exactly why a character is unavailable and the configured message. No cryptic "you can't play this character right now".
#Live Editing
lib.scriptConfig.on('characterStates', ...) keeps Lua-side and React-side in sync. The React copy reads from useScriptConfig.characterStates directly (no parallel hardcoded store) so admin saves propagate everywhere live.
