vehicle.grant
Overview
- Registers a vehicle to a Zoi as its owned vehicle, free of charge. This is ownership, not a spawn: the vehicle exists as a simulation entity but is normally not standing in the world until something asks for it - the SpawnVehicle interaction inside a driving bag puts it on the nearest road, and a garage pad near the Zoi will place it immediately. So a successful grant followed by an empty street is the expected state, not a failure. A Zoi holds AT MOST ONE vehicle. Granting a second one fails by default rather than silently doing nothing, which is what the underlying helper does; pass replace=true to destroy the old one first. Ships are the exception: they attach as a rental instead of as the owned vehicle, so as_rental true comes back and vehicle.get_owned will keep reporting has_owned false. To then drive it, queue the MoveWithVehicle interaction bag with interaction.execute and a target site as target_entity_id; that bag walks the Zoi to a road, spawns the vehicle, gets in and drives.
Metadata
| Field | Value |
|---|---|
| Display | Grant Vehicle |
| Category | vehicle |
| Access | ScriptCheat |
| Scope | B2Authority |
| Tags | — |
| Aliases | — |
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| vehicle_dt_id | name | yes | — | Vehicle data table row name, e.g. Sedan or ElectricScooter01 (see vehicle.list_purchasable) |
| entity_id | entityId | no | — | Character entity ID (default: possessed) |
| color_id | name | no | — | Colour variant row name; omit for the data table default |
| replace | bool | no | false | Destroy the currently owned vehicle first. Refused while the Zoi is inside a vehicle |
Returns
- Freeform result (shape is not fixed).
{ granted, as_rental, vehicle{entity_id,vehicle_dt_id,vehicle_type,color_id,owner_entity_id,driver_entity_id,pos{x,y,z},rot_yaw,rot_pitch,rot_roll,speed,lane_index} }
Usage
await inzoi.cli.execute('vehicle.grant', {
vehicle_dt_id: '',
entity_id: 0, // optional
color_id: '', // optional
replace: false, // optional
});