SimCharacter
General game-character, properties & functions are derived from SimObject.
Properties:
FactionClass
integer
FightingClass
integer
Gender
integer
Heading
float
Direction of facing
Health
integer
(0 to 400)
HealthMax
integer
-
Invulnerable
boolean
-
TakingDamage
boolean
-
Tired
boolean
-
Static Functions:
.Create
SimCharacter.Create(model: Hash, coords: Vector3, heading: float)
: SimCharacter
model
Hash
coords
Vector3
Position of new character
heading
float
Heading of new character
Returns SimCharacter object when successfully created. Note: certain models can crash game!
.Get
SimCharacter.Get(object: SimObject)
: SimCharacter
object
SimObject
Valid SimObject
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).
Functions:
.SetAttackRights
SimCharacter.SetAttackRights(toggle: boolean)
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.
.GetTarget
SimCharacter.GetTarget(type: TargetType)
: SimObject
type
-
.SetTarget
SimCharacter.SetTarget(type: TargetType, object: SimObject)
type
-
object
SimObject
-
.SetTargetLock
SimCharacter.SetTargetLock(type: TargetType, lock: boolean, modifycollision: boolean)
type
-
lock
boolean
-
modifycollision
boolean
Set true if interacting with physics object
.ClearTarget
SimCharacter.ClearTarget(type: TargetType)
type
-
ActionNodes Functions:
.PlayActionNode
SimCharacter.PlayActionNode(id: integer)
: boolean
id
integer
Returns true if action was found and successfully queued for play.
.PlayActionNodeByName
SimCharacter.PlayActionNodeByName(name: string)
: boolean
name
string
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.
AI Functions:
.SetAIObjective
SimCharacter.SetAIObjective(type: AIObjective)
type
-
Sets a current AI Objective for SimCharacter.
Bones Functions:
.GetBonesCount
SimCharacter.GetBonesCount()
: integer
Returns number of bone count for SimCharacter. If character for some reason has no bone data it returns -1.
.GetBoneName
SimCharacter.GetBoneName(index: integer)
: string
index
integer
-
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
bone
Hash
-
Returns world position of the desired bone, if this fails return value is [0, 0, 0
].
.GetBoneRotation
SimCharacter.GetBoneRotation(bone: Hash)
: Vector3
bone
Hash
-
Returns rotation of the desired bone, if this fails return value is [0, 0, 0
].
Prop Functions:
.AttachProp
SimCharacter.AttachProp(prop: SimObjectProp, bone: CharacterBone, propbone: PropBone)
: boolean
prop
-
bone
(Optional)
propbone
(Optional)
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.
.DetachProp
SimCharacter.DetachProp(prop: SimObjectProp)
: boolean
prop
-
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
vehicle
-
seatindex
integer
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!
.ExitVehicle
SimCharacter.ExitVehicle()
Removes SimCharacter from current vehicle. Note: This will teleport character straight out of the vehicle, there is no animation!
Last updated