Interface INPC.IManagedInterface
Represents the managed interface implemented by its unmanaged counterpart.
public interface INPC.IManagedInterface : IUnmanagedInterface
- Inherited Members
Methods
AimAt(Vector3, bool, int, bool, Vector3, EntityCheckType)
Instructs the NPC to aim at a world position.
void AimAt(Vector3 point, bool shoot, int shootDelay, bool setAngle, Vector3 offsetFrom, EntityCheckType betweenCheckFlags)
Parameters
pointVector3shootboolshootDelayintsetAnglebooloffsetFromVector3betweenCheckFlagsEntityCheckType
AimAtPlayer(IPlayer, bool, int, bool, Vector3, Vector3, EntityCheckType)
Instructs the NPC to aim at a specific player.
void AimAtPlayer(IPlayer atPlayer, bool shoot, int shootDelay, bool setAngle, Vector3 offset, Vector3 offsetFrom, EntityCheckType betweenCheckFlags)
Parameters
atPlayerIPlayershootboolshootDelayintsetAnglebooloffsetVector3offsetFromVector3betweenCheckFlagsEntityCheckType
ApplyAnimation(AnimationData)
Applies an animation. animationData bundles lib + name + flags + duration.
void ApplyAnimation(AnimationData animationData)
Parameters
animationDataAnimationData
ChangeNode(int, ushort)
Changes the active node and seeks to a specific target point.
ushort ChangeNode(int nodeId, ushort targetPointId)
Parameters
Returns
ClearAnimations()
Clears any applied animation.
void ClearAnimations()
EnableInfiniteAmmo(bool)
Enables or disables infinite ammo for the NPC.
void EnableInfiniteAmmo(bool enable)
Parameters
enablebool
EnableReloading(bool)
Enables or disables weapon reloading for the NPC.
void EnableReloading(bool toggle)
Parameters
togglebool
EnterVehicle(IVehicle, byte, NPCMoveType)
Instructs the NPC to enter a vehicle.
void EnterVehicle(IVehicle vehicle, byte seatId, NPCMoveType moveType)
Parameters
vehicleIVehicleseatIdbytemoveTypeNPCMoveType
ExitVehicle()
Instructs the NPC to exit the current vehicle.
void ExitVehicle()
GetAmmo()
Gets ammo for the current weapon.
int GetAmmo()
Returns
GetAmmoInClip()
Gets the ammo count in the current weapon's clip.
int GetAmmoInClip()
Returns
GetAnimation(out int, out float, out bool, out bool, out bool, out bool, out int)
Gets the current foot-sync animation parameters for the NPC.
void GetAnimation(out int animationId, out float delta, out bool loop, out bool lockX, out bool lockY, out bool freeze, out int time)
Parameters
GetArmour()
Gets the NPC's armour.
float GetArmour()
Returns
GetCurrentPathId()
Gets the ID of the path the NPC is currently following, or -1 if none.
int GetCurrentPathId()
Returns
GetCurrentPathPointIndex()
Gets the index of the current waypoint within the active path.
int GetCurrentPathPointIndex()
Returns
GetEnteringVehicle()
Gets the vehicle the NPC is in the process of entering, or a handle with no value if not entering one.
IVehicle GetEnteringVehicle()
Returns
GetEnteringVehicleSeat()
Gets the seat index the NPC is targeting while entering a vehicle.
int GetEnteringVehicleSeat()
Returns
GetFightingStyle()
Gets the NPC's current fighting style.
PlayerFightingStyle GetFightingStyle()
Returns
GetHealth()
Gets the NPC's health.
float GetHealth()
Returns
GetInterior()
Gets the interior id this NPC is recorded in (server-side bookkeeping only).
uint GetInterior()
Returns
GetKeys(out ushort, out ushort, out ushort)
Gets the NPC's current movement keys.
void GetKeys(out ushort upAndDown, out ushort leftAndRight, out ushort keys)
Parameters
GetPlayer()
Gets the underlying IPlayer instance for this NPC.
IPlayer GetPlayer()
Returns
GetPlayerAimingAt()
Gets the player the NPC is currently aiming at, or a handle with no value if not aiming at any player.
IPlayer GetPlayerAimingAt()
Returns
GetPlayerMovingTo()
Gets the player the NPC is currently moving towards, or a handle with no value if not following a player.
IPlayer GetPlayerMovingTo()
Returns
GetPosition()
Gets the NPC's world position.
Vector3 GetPosition()
Returns
GetPositionMovingTo()
Gets the world position the NPC is currently moving to.
Vector3 GetPositionMovingTo()
Returns
GetRotation()
Gets the NPC's rotation as a quaternion.
GTAQuat GetRotation()
Returns
GetSpecialAction()
Gets the current special action for the NPC.
PlayerSpecialAction GetSpecialAction()
Returns
GetSurfingData()
Gets the current surfing data for the NPC.
PlayerSurfingData GetSurfingData()
Returns
GetVehicle()
Gets the vehicle this NPC is currently in, or a handle with no value if not in a vehicle.
IVehicle GetVehicle()
Returns
GetVehicleGearState()
Gets the gear state for the NPC's vehicle.
int GetVehicleGearState()
Returns
GetVehicleHealth()
Gets the health of the NPC's current vehicle.
float GetVehicleHealth()
Returns
GetVehicleHydraThrusters()
Gets the hydra thruster direction for the NPC's vehicle.
int GetVehicleHydraThrusters()
Returns
GetVehicleSeat()
Gets the seat index this NPC occupies in the current vehicle.
int GetVehicleSeat()
Returns
GetVehicleTrainSpeed()
Gets the train speed for the NPC's vehicle.
float GetVehicleTrainSpeed()
Returns
GetVelocity()
Gets the current velocity vector.
Vector3 GetVelocity()
Returns
GetVirtualWorld()
Gets the virtual world this NPC is in.
int GetVirtualWorld()
Returns
GetWeapon()
Gets the current weapon id.
byte GetWeapon()
Returns
GetWeaponAccuracy(byte)
Gets the accuracy of the NPC for the specified weapon.
float GetWeaponAccuracy(byte weapon)
Parameters
weaponbyte
Returns
GetWeaponActualClipSize(byte)
Gets the actual clip size accounting for skill level and infinite ammo.
int GetWeaponActualClipSize(byte weapon)
Parameters
weaponbyte
Returns
GetWeaponActualReloadTime(byte)
Gets the actual reload time accounting for skill level and dual wield.
int GetWeaponActualReloadTime(byte weapon)
Parameters
weaponbyte
Returns
GetWeaponClipSize(byte)
Gets the clip size for the specified weapon.
int GetWeaponClipSize(byte weapon)
Parameters
weaponbyte
Returns
GetWeaponReloadTime(byte)
Gets the reload time (in milliseconds) for the specified weapon.
int GetWeaponReloadTime(byte weapon)
Parameters
weaponbyte
Returns
GetWeaponShootTime(byte)
Gets the shoot time (in milliseconds) for the specified weapon.
int GetWeaponShootTime(byte weapon)
Parameters
weaponbyte
Returns
GetWeaponSkillLevel(PlayerWeaponSkill)
Gets the weapon skill level for the specified weapon skill.
int GetWeaponSkillLevel(PlayerWeaponSkill weaponSkill)
Parameters
weaponSkillPlayerWeaponSkill
Returns
GetWeaponState()
Gets the NPC's current weapon state.
PlayerWeaponState GetWeaponState()
Returns
IsAiming()
Gets a value indicating whether the NPC is currently aiming.
bool IsAiming()
Returns
IsAimingAtPlayer(IPlayer)
Gets a value indicating whether the NPC is currently aiming at the specified player.
bool IsAimingAtPlayer(IPlayer player)
Parameters
playerIPlayer
Returns
IsDead()
True if the NPC has been killed and not yet respawned.
bool IsDead()
Returns
IsInfiniteAmmoEnabled()
Gets a value indicating whether infinite ammo is enabled for the NPC.
bool IsInfiniteAmmoEnabled()
Returns
IsInvulnerable()
True iff the NPC is invulnerable.
bool IsInvulnerable()
Returns
IsMeleeAttacking()
Gets a value indicating whether the NPC is currently performing a melee attack.
bool IsMeleeAttacking()
Returns
IsMoving()
True if the NPC is currently moving (path or direct).
bool IsMoving()
Returns
IsMovingByPath()
Gets a value indicating whether the NPC is currently moving along a path.
bool IsMovingByPath()
Returns
IsMovingToPlayer(IPlayer)
Gets a value indicating whether the NPC is currently moving towards the specified player.
bool IsMovingToPlayer(IPlayer player)
Parameters
playerIPlayer
Returns
IsPathPaused()
Gets a value indicating whether the NPC's path movement is currently paused.
bool IsPathPaused()
Returns
IsPlaybackPaused()
Gets a value indicating whether playback is currently paused.
bool IsPlaybackPaused()
Returns
IsPlayingNode()
Gets a value indicating whether the NPC is currently following a node path.
bool IsPlayingNode()
Returns
IsPlayingNodePaused()
Gets a value indicating whether node-based movement is currently paused.
bool IsPlayingNodePaused()
Returns
IsPlayingPlayback()
Gets a value indicating whether the NPC is currently playing a recording.
bool IsPlayingPlayback()
Returns
IsReloadEnabled()
Gets a value indicating whether weapon reloading is enabled for the NPC.
bool IsReloadEnabled()
Returns
IsReloading()
Gets a value indicating whether the NPC is currently reloading its weapon.
bool IsReloading()
Returns
IsShooting()
Gets a value indicating whether the NPC is currently shooting.
bool IsShooting()
Returns
IsStreamedInForPlayer(IPlayer)
Checks whether this NPC is streamed in for the given player.
bool IsStreamedInForPlayer(IPlayer other)
Parameters
otherIPlayer
Returns
IsVehicleSirenUsed()
Gets a value indicating whether the NPC's vehicle siren is currently active.
bool IsVehicleSirenUsed()
Returns
Kill(IPlayer, byte)
Simulates NPC death, optionally with a killer and weapon.
void Kill(IPlayer killer, byte weapon)
Parameters
MeleeAttack(int, bool)
Starts a melee attack for the specified duration.
void MeleeAttack(int time, bool secondaryMeleeAttack)
Parameters
timeintDuration of the attack in milliseconds.
secondaryMeleeAttackboolIf true, performs the secondary melee attack.
Move(Vector3, NPCMoveType, float, float)
Tells the NPC to walk/jog/sprint/drive to position.
bool Move(Vector3 position, NPCMoveType moveType, float moveSpeed, float stopRange)
Parameters
positionVector3moveTypeNPCMoveTypemoveSpeedfloatstopRangefloat
Returns
MoveByPath(int, NPCMoveType, float, bool)
Instructs the NPC to move along a previously created path.
bool MoveByPath(int pathId, NPCMoveType moveType, float moveSpeed, bool reverse)
Parameters
pathIdintmoveTypeNPCMoveTypemoveSpeedfloatreversebool
Returns
MoveToPlayer(IPlayer, NPCMoveType, float, float, Milliseconds, bool)
Tells the NPC to continuously follow targetPlayer using the specified movement type.
bool MoveToPlayer(IPlayer targetPlayer, NPCMoveType moveType, float moveSpeed, float stopRange, Milliseconds posCheckUpdateDelay, bool autoRestart)
Parameters
targetPlayerIPlayerThe player to follow.
moveTypeNPCMoveTypeThe movement type (walk, jog, sprint, etc.).
moveSpeedfloatThe movement speed (-1 for automatic).
stopRangefloatThe radius within which the NPC stops following.
posCheckUpdateDelayMillisecondsHow often (in milliseconds) the NPC recalculates the target's position.
autoRestartboolIf true, the NPC will restart following after reaching the player.
Returns
PausePath()
Pauses path-based movement temporarily.
void PausePath()
PausePlayback(bool)
Pauses or resumes the current playback.
void PausePlayback(bool paused)
Parameters
pausedbool
PausePlayingNode()
Pauses node-based movement.
void PausePlayingNode()
PlayNode(int, NPCMoveType, float, float, bool)
Starts node-based movement for the NPC.
bool PlayNode(int nodeId, NPCMoveType moveType, float moveSpeed, float radius, bool setAngle)
Parameters
nodeIdintmoveTypeNPCMoveTypemoveSpeedfloatradiusfloatsetAnglebool
Returns
PutInVehicle(IVehicle, byte)
Teleports the NPC directly into a vehicle seat.
bool PutInVehicle(IVehicle vehicle, byte seat)
Parameters
Returns
RemoveFromVehicle()
Removes the NPC from its current vehicle.
bool RemoveFromVehicle()
Returns
ResetAnimation()
Resets the foot-sync animation for the NPC.
void ResetAnimation()
ResetSurfingData()
Resets the NPC's surfing data.
void ResetSurfingData()
Respawn()
Respawns the NPC keeping its current state.
void Respawn()
ResumePath()
Resumes previously paused path-based movement.
void ResumePath()
ResumePlayingNode()
Resumes previously paused node-based movement.
void ResumePlayingNode()
SetAmmo(int)
Sets ammo for the current weapon.
void SetAmmo(int ammo)
Parameters
ammoint
SetAmmoInClip(int)
Sets the ammo count in the current weapon's clip.
void SetAmmoInClip(int ammo)
Parameters
ammoint
SetAnimation(int, float, bool, bool, bool, bool, int)
Sets the foot-sync animation for the NPC.
void SetAnimation(int animationId, float delta, bool loop, bool lockX, bool lockY, bool freeze, int time)
Parameters
SetArmour(float)
Sets the NPC's armour.
void SetArmour(float armour)
Parameters
armourfloat
SetFightingStyle(PlayerFightingStyle)
Sets the NPC's fighting style.
void SetFightingStyle(PlayerFightingStyle style)
Parameters
stylePlayerFightingStyle
SetHealth(float)
Sets the NPC's health.
void SetHealth(float health)
Parameters
healthfloat
SetInterior(uint)
Sets the interior id (server-side bookkeeping only — does not relocate the NPC).
void SetInterior(uint interior)
Parameters
interioruint
SetInvulnerable(bool)
Sets invulnerability.
void SetInvulnerable(bool toggle)
Parameters
togglebool
SetKeys(ushort, ushort, ushort)
Sets the NPC's movement keys.
void SetKeys(ushort upAndDown, ushort leftAndRight, ushort keys)
Parameters
SetPosition(Vector3, bool)
Sets the NPC's position. immediateUpdate=true broadcasts a sync
to streamed-in players right away instead of waiting for the next tick.
void SetPosition(Vector3 position, bool immediateUpdate)
Parameters
SetRotation(GTAQuat, bool)
Sets the NPC's rotation. See SetPosition(Vector3, bool) for the immediate-update flag.
void SetRotation(GTAQuat rotation, bool immediateUpdate)
Parameters
SetSkin(int)
Sets the NPC's skin model id.
void SetSkin(int model)
Parameters
modelint
SetSpecialAction(PlayerSpecialAction)
Sets the special action for the NPC.
void SetSpecialAction(PlayerSpecialAction action)
Parameters
actionPlayerSpecialAction
SetSurfingData(PlayerSurfingData)
Sets the surfing data for the NPC.
void SetSurfingData(PlayerSurfingData data)
Parameters
dataPlayerSurfingData
SetVehicleGearState(int)
Sets the gear state for the NPC's vehicle.
void SetVehicleGearState(int gear)
Parameters
gearint
SetVehicleHealth(float)
Sets the health of the NPC's current vehicle.
void SetVehicleHealth(float health)
Parameters
healthfloat
SetVehicleHydraThrusters(int)
Sets the hydra thruster direction for the NPC's vehicle.
void SetVehicleHydraThrusters(int direction)
Parameters
directionint
SetVehicleTrainSpeed(float)
Sets the train speed for the NPC's vehicle.
void SetVehicleTrainSpeed(float speed)
Parameters
speedfloat
SetVelocity(Vector3, bool)
Sets the velocity vector. update=true forces a sync this tick.
void SetVelocity(Vector3 velocity, bool update)
Parameters
SetVirtualWorld(int)
Sets the virtual world this NPC is in.
void SetVirtualWorld(int vw)
Parameters
vwint
SetWeapon(byte)
Sets the current weapon id.
void SetWeapon(byte weapon)
Parameters
weaponbyte
SetWeaponAccuracy(byte, float)
Sets the accuracy of the NPC for the specified weapon.
void SetWeaponAccuracy(byte weapon, float accuracy)
Parameters
SetWeaponClipSize(byte, int)
Sets the clip size for the specified weapon.
void SetWeaponClipSize(byte weapon, int size)
Parameters
SetWeaponReloadTime(byte, int)
Sets the reload time (in milliseconds) for the specified weapon.
void SetWeaponReloadTime(byte weapon, int time)
Parameters
SetWeaponShootTime(byte, int)
Sets the shoot time (in milliseconds) for the specified weapon.
void SetWeaponShootTime(byte weapon, int time)
Parameters
SetWeaponSkillLevel(PlayerWeaponSkill, int)
Sets the weapon skill level for the specified weapon skill.
void SetWeaponSkillLevel(PlayerWeaponSkill weaponSkill, int level)
Parameters
weaponSkillPlayerWeaponSkilllevelint
SetWeaponState(PlayerWeaponState)
Sets the NPC's weapon state.
void SetWeaponState(PlayerWeaponState state)
Parameters
statePlayerWeaponState
Shoot(int, PlayerBulletHitType, byte, Vector3, Vector3, bool, EntityCheckType)
Triggers a weapon shot from the NPC.
void Shoot(int hitId, PlayerBulletHitType hitType, byte weapon, Vector3 endPoint, Vector3 offset, bool isHit, EntityCheckType betweenCheckFlags)
Parameters
hitIdinthitTypePlayerBulletHitTypeweaponbyteendPointVector3offsetVector3isHitboolbetweenCheckFlagsEntityCheckType
Spawn()
Spawns the NPC at its currently configured position/rotation.
void Spawn()
StartPlaybackById(int, bool, Vector3, GTAQuat)
Starts playing a pre-loaded recording by its record ID.
bool StartPlaybackById(int recordId, bool autoUnload, Vector3 point, GTAQuat rotation)
Parameters
recordIdintThe record ID returned by LoadRecord(string).
autoUnloadboolIf true, the record is unloaded when playback ends.
pointVector3The starting position for playback (zero vector for current position).
rotationGTAQuatThe starting rotation for playback.
Returns
StartPlaybackByName(string, bool, Vector3, GTAQuat)
Starts playing a pre-recorded movement by file name.
bool StartPlaybackByName(string recordName, bool autoUnload, Vector3 point, GTAQuat rotation)
Parameters
recordNamestringThe path to the record file (relative to scriptfiles).
autoUnloadboolIf true, the record is unloaded when playback ends.
pointVector3The starting position for playback (zero vector for current position).
rotationGTAQuatThe starting rotation for playback.
Returns
StopAim()
Stops the NPC from aiming.
void StopAim()
StopMeleeAttack()
Stops the current melee attack.
void StopMeleeAttack()
StopMove()
Stops any active movement.
void StopMove()
StopPath()
Stops path-based movement entirely.
void StopPath()
StopPlayback()
Stops the current playback.
void StopPlayback()
StopPlayingNode()
Stops node-based movement.
void StopPlayingNode()
StreamedForPlayers()
Gets the set of players this NPC is currently streamed in for.
FlatPtrHashSet<IPlayer> StreamedForPlayers()
Returns
UpdateNodePoint(ushort)
Updates the current node point to the specified point ID.
bool UpdateNodePoint(ushort pointId)
Parameters
pointIdushort
Returns
UseVehicleSiren(bool)
Enables or disables the siren on the NPC's vehicle.
void UseVehicleSiren(bool use)
Parameters
usebool