Static Functions:
SimCharacter.Create(model: Hash, coords: Vector3, heading: float): SimCharacter
Position of new character
Returns SimCharacter object when successfully created. Note: certain models can crash game!
SimCharacter.Get(object: SimObject): SimCharacter
This will cast SimObject to SimCharacter use this only if you know what you're doing!
.GetLocalPlayer
SimCharacter.GetLocalPlayer(): SimCharacter
Returns a SimCharacter object of localplayer (Wei Shen).
.SetAttackRights
SimCharacter.SetAttackRights(toggle: boolean)
Toggles attack rights. Note: by default most peds have no Attack Rights which means they cant be attacked by other peds neither they can attack them.
SimCharacter.GetTarget(type: TargetType): SimObject
SimCharacter.SetTarget(type: TargetType, object: SimObject)
SimCharacter.SetTargetLock(type: TargetType, lock: boolean, modifycollision: boolean)
Set true if interacting with physics object
SimCharacter.ClearTarget(type: TargetType)
ActionNodes Functions:
.PlayActionNode
SimCharacter.PlayActionNode(id: integer): boolean
Returns true if action was found and successfully queued for play.
.PlayActionNodeByName
SimCharacter.PlayActionNodeByName(name: string): boolean
Returns true if action was found and successfully queued for play. Note: this requires full path for action name and most of them might not be resolved so I recommend rather playing them by ID.
.StopActionNode
SimCharacter.StopActionNode()
Stop any currently playing action and restore to first action behavior the character started with.
.SetAIObjective
SimCharacter.SetAIObjective(type: AIObjective)
Sets a current AI Objective for SimCharacter.
Bones Functions:
SimCharacter.GetBonesCount(): integer
Returns number of bone count for SimCharacter. If character for some reason has no bone data it returns -1.
SimCharacter.GetBoneName(index: integer): string
Returns name of the bone of desired index, if this fails for some reason the return value will be null.
.GetBonePosition
SimCharacter.GetBonePosition(bone: Hash): Vector3
Returns world position of the desired bone, if this fails return value is [0, 0, 0].
.GetBoneRotation
SimCharacter.GetBoneRotation(bone: Hash): Vector3
Returns rotation of the desired bone, if this fails return value is [0, 0, 0].
Prop Functions:
SimCharacter.AttachProp(prop: SimObjectProp, bone: CharacterBone, propbone: PropBone): boolean
Returns true when prop has been successfully attached to the character, this can fail if character or propr doesn't have default bone or when you specify own bone and it doesn't exist.
SimCharacter.DetachProp(prop: SimObjectProp): boolean
Returns true if prop has been successfully detached from the character.
Vehicle Functions:
.GetOccupantState
SimCharacter.GetOccupantState(): CharacterOccupantState
Returns occupant state if SimCharacter is entering/exiting/sitting in some vehicle.
.GetCurrentVehicle
SimCharacter.GetCurrentVehicle(): SimVehicle
Returns SimVehicle object if SimCharacter is occupant of any vehicle otherwise null.
.GetCurrentVehicleSeatIndex
SimCharacter.GetCurrentVehicleSeatIndex(): integer
Returns seat index if SimCharacter is occupant of any vehicle otherwise -1.
.PlaceInVehicle
SimCharacter.PlaceInVehicle(vehicle: SimVehicle, seatIndex: integer): boolean
0 - Driver, 1...4 - Passenger
Returns true if SimCharacter was successfully placed in vehicle, this can fail when seat is already occupied. Note: This will teleport character straight to the seat, there is no animation!
SimCharacter.ExitVehicle()
Removes SimCharacter from current vehicle. Note: This will teleport character straight out of the vehicle, there is no animation!