Mechanics
Mechanics
Interactions on objects and rules in the game world without writing a script. On what, When, If, Then.
A mechanic is one interaction in the game: sit on a chair, pick up a traffic cone, buy a coffee at the counter, open a locker only the police can use. You make it in a form, with no script. It works in the game as soon as you save it, and on a server without the studio too, because it is saved in the project’s studio_scene resource.
Open mechanics from the bar on the left: Mechanics. The list is on the left, the chosen mechanic on the right.
The form
A mechanic reads from top to bottom, like a sentence.
| Row | What you choose | Example |
|---|---|---|
| On what | an object from the scene, a model anywhere in the world (GTA map objects too), one map object, every vehicle, ped or player, a place, a zone, no place | the prop_bench_01a model |
| When | targeting, E nearby, entering a zone, leaving a zone, a key, a command, using an item | E nearby, text [E] Sit down |
| If | conditions: job, gang, item, money, player state, time of day, vehicle state, keys | the player carries nothing |
| Then | steps in order | the GTA “sit on a bench” scenario |
The trigger depends on the target. A zone has only entering and leaving, an item only using it, “no place” a key or a command.
Templates under the When row fill in the rest with one click: pick up and carry, sit on a chair, rubbish bin, car boot and more. Only templates that work in your project are shown.
What is available
Some steps and conditions need a resource that does them: a notification, a progress bar, give an item, a job, money, a shop, a stash, the boss menu. The studio shows them only when an adapter of the project gives that capability (chapter What the project can do).
Without a framework the game engine steps stay: a GTA scenario, an animation, an NPC playing an animation, pick up and hold, put down, vehicle doors and boot, repairing and washing a vehicle, healing, teleport, sound, effect, player state and events for your own scripts.
Targeting (an option when aiming at an object) needs a targeting resource, e.g. ox_target with an adapter. Without one the studio does not show it and puts nothing in its place. Choose E nearby then.
A mechanic saved earlier with something the project can no longer do keeps it, with a warning at that step. The data does not disappear, but that step will not work in the game until the adapter is back or you change the step.
Saving and trying
- Save checks for empty fields and marks them in the form. A saved mechanic works in the game at once, without a restart.
- Enabled turns the mechanic off without deleting it.
- Try on Player 1 walks Player 1 to the target and uses the mechanic the way a player would. The result is under the button: it worked, refused by a condition, or stopped at a step with the reason.
- Uses in the mechanic’s summary shows its latest uses in the game: who, when, with what result.
- ⋯ next to Save has Delete. Ctrl+Z undoes a save and a delete.
In the game
Right-clicking an object in the in-game editor or in the scene tree has Add mechanic…: the form opens with that object as the target.
Write the texts of a mechanic (prompts, notifications, the progress bar) in the project’s language. The studio warns on saving when one mechanic has texts in two languages.
Claude
Claude makes mechanics over MCP: mech_catalog (what this project has), mech_save, mech_try, mech_trace, mech_remove. Saving refuses steps the project cannot do, naming the missing capability.