TOGGLE SITTING
An idea I had after filming was to also explain how to toggle sitting rather than have it be an automated wait process that makes the player stand up afterwards.
This written guide will show you how to adjust the "chair" script made in the video to be toggled by a key input instead.
GLOBAL PROPERTY
- Start by opening Game Configuration...

- Create a boolean global property named "sitting" that starts false.

ADJUST "CHAIR" SCRIPT
- Change the "chair" script to the following code:
player.property["put_loc"] = tile[player.coord.x, player.coord.y, player.coord.z];
lock_camera();
set_player_movement_locked(true);
set_player_interaction_locked(true);
put_player("under_map");
attach_object("player_sit", self, "seat");
global.property["sitting"] = true;
Changes:
Line 1:
stores the current tile the player is on into a player property, rather than a local variable.
This is because standing up is going to take place in a seperate script so we need the coordinates to be publically available, not just local to this script.
Also, removed the code that detachs object from chair, puts player back into main map and unlocks camera, movement etc..
This code will happen in the second script below.
Line 7:
set the global property to true so the game can track we are currently sitting down
KEYBIND SCRIPT
Explanation:
This script:
- checks if the player is currently sitting
- removes model from chair
- puts the player back using the coordinates stored in the property
- unlocks interaction ability
- unlocks movement ability
- unlocks/resets camera
- sets "sitting" to false so game can track the player is no longer sitting
Because of the if global.property["sitting"]
condition, this script will only do all that if the player is actually sitting.
Any other time the key will be pressed, it will do nothing.
ASSIGN CHAIR ID
- Due to the keybind script not running on the chair directly, thus not being able to use
self
, we have to give the chair an Entity ID.
In the above script, we use the ID "chair_1" so select the chair and assign it that ID to match.

ASSIGN SCRIPT TO KEYBIND
- Finally, go the Input Bindings section of Game Configuration, and add the "stand_up" script to a keybind of your choice.

BONUS IDEAS
- Create a widget that appears while the character is sitting/disappears when key is pressed, that tells the player what key to press.