Menu
Lumberyard
Developer Guide (Version 1.11)

ScriptBind_Vehicle

CryLua is deprecated and will be removed in a future version of Lumberyard.

Lists C++ vehicle system functions that you can call from Lua script.

AddSeat

Adds a seat to the vehicle.

Syntax

Copy
Vehicle.AddSeat(SmartScriptTable paramsTable)

Parameter Description
paramsTable The seat parameters in SmartScriptTable format.

ChangeSeat

Makes the actor change the seat inside the vehicle.

Syntax

Copy
Vehicle.ChangeSeat(ScriptHandle actorHandle, int seatId, bool isAnimationEnabled)

Parameter Description
actorHandle The actor identifier.
seatId The seat identifier.
isAnimationEnabled True if animation is enabled; otherwise, false.

Destroy

Destroys the vehicle.

Syntax

Copy
Vehicle.Destroy()

DisableEngine

Disables or enables the engine of the vehicle.

Syntax

Copy
Vehicle.DisableEngine(bool disable)

Parameter Description
disable True to disable the engine; false to enable.

EnableMovement

Enables or disables the movement of the vehicle.

Syntax

Copy
Vehicle.EnableMovement(bool enable)

Parameter Description
enable True to enable movement; false to disable.

EnterVehicle

Makes the specified actor enter the vehicle.

Syntax

Copy
Vehicle.EnterVehicle(ScriptHandle actorHandle, int seatId, bool isAnimationEnabled)

Parameter Description
actorHandle The actor identifier.
seatId The seat identifier.
isAnimationEnabled True if animation is enabled; otherwise, false.

ExitVehicle

Makes the actor leave the vehicle.

Syntax

Copy
Vehicle.ExitVehicle(ScriptHandle actorHandle)

Parameter Description
actorHandle The actor identifier.

GetComponentDamageRatio

Gets the damage ratio of the specified component.

Syntax

Copy
Vehicle.GetComponentDamageRatio(const char* pComponentName)

Parameter Description
pComponentName The name of the component.

GetHelperDir

Gets the helper direction.

Syntax

Copy
Vehicle.GetHelperDir(const char* name, bool isInVehicleSpace)

Parameter Description
name The name of the helper.
isInVehicleSpace True if the helper is in the vehicle space; otherwise, false.

GetHelperPos

Gets the helper position.

Syntax

Copy
Vehicle.GetHelperPos(const char* name, bool isInVehicleSpace)

Parameter Description
name The name of the helper.
isInVehicleSpace True if the helper is in the vehicle space; otherwise, false.

GetHelperWorldPos

Gets the helper position in the world coordinates.

Syntax

Copy
Vehicle.GetHelperWorldPos(const char* name)

Parameter Description
name The name of the helper.

GetSeatForPassenger

Returns a vehicle seat ID for the specified passenger.

Syntax

Copy
Vehicle.GetSeatForPassenger(ScriptHandle passengerId)

Parameter Description
passengerId The passenger ID.

GetVehicle

Gets the vehicle identifier.

Syntax

Copy
Vehicle.GetVehicle()

HasHelper

Checks if the vehicle has the specified helper.

Syntax

Copy
Vehicle.HasHelper(const char* name)

Parameter Description
name The name of the helper.

IsDestroyed

Checks if the vehicle is destroyed.

Syntax

Copy
Vehicle.IsDestroyed()

IsInsideRadius

Checks if the vehicle is inside the specified radius.

Syntax

Copy
Vehicle.IsInsideRadius(Vec3 pos, float radius)

Parameter Description
pos The {x,y,z} position vector.
radius The radius, expressed as a float.

IsUsable

Checks if the vehicle is usable by the user.

Syntax

Copy
Vehicle.IsUsable(ScriptHandle userHandle)

Parameter Description
userHandle The user identifier.

MultiplyWithWorldTM

Multiplies with the world transformation matrix.

Syntax

Copy
Vehicle.MultiplyWithWorldTM(Vec3 pos)

Parameter Description
pos The {x,y,z} position vector.

OnHit

Triggers an event that occurs after the vehicle is hit.

Syntax

Copy
Vehicle.OnHit(ScriptHandle targetId, ScriptHandle shooterId, float damage, Vec3 position, float radius, int hitTypeId, bool explosion)

Parameter Description
targetId The target identifier.
shooterId The shooter identifier.
damage The amount of damage, expressed as a float.
position The {x,y,z} position vector.
radius Radius of the hit, expressed as a float.
hitTypeId The type of damage, expressed as an integer.
explosion True if the hit causes an explosion, otherwise false.

OnSpawnComplete

Calls back into the game code for when vehicle spawn has been completed.

Syntax

Copy
Vehicle.OnSpawnComplete()

OnUsed

Triggers an event when the user uses the specified vehicle.

Syntax

Copy
Vehicle.OnUsed(ScriptHandle userHandle, int index)

Parameter Description
userHandle The user identifier.
index The seat identifier.

ProcessPassengerDamage

Processes passenger damages.

Syntax

Copy
Vehicle.ProcessPassengerDamage(ScriptHandle passengerId, float actorHealth, float damage, int hitTypeId, bool explosion)

Parameter Description
passengerId The passenger identifier.
actorHealth The health of the actor.
damage The amount of damage.
hitTypeId The type of damage.
explosion True if there is an explosion; otherwise, false.

Reset

Resets the vehicle.

Syntax

Copy
Vehicle.Reset()

ResetSlotGeometry

Syntax

Copy
Vehicle.ResetSlotGeometry(int slot, const char* filename, const char* geometry)

Parameter Description
slot The number of the slot.
filename The filename.
geometry The slot geometry.