Nuclide
Software Development Kit for id Tech
NSMonster Class Reference

This entity class represents non-player characters. More...

#include <NSMonster.h>

Inheritance diagram for NSMonster:
NSNavAI NSSquadMonster monster_furniture NSTalkMonster ambient_generic monster_generic speaker

Public Member Functions

void NSMonster (void)
 
virtual void Save (float)
 Handles saving a copy of this entity to a given filehandle. More...
 
virtual void Restore (string, string)
 Similar to ::SpawnKey but for save-game fields. More...
 
virtual void EvaluateEntity (void)
 Run each tic after physics are run to determine if we need to send updates over the network. More...
 
virtual float SendEntity (entity, float)
 Called by the engine whenever we need to send a client an update about this entity. More...
 
virtual void Touch (entity)
 Called whenever we're touching another entity. More...
 
virtual void Spawned (void)
 Called when the entity is fulled initialized. More...
 
virtual void Respawn (void)
 Server: Called when the entity first spawns or when game-logic requests the entity to return to its original spawn state. More...
 
virtual void Input (entity, string, string)
 Called when we are being prompted by another object/function with an input message. More...
 
virtual void Pain (void)
 Called whenever the entity receives damage. More...
 
virtual void Death (void)
 Called when the health is equal or below 0. More...
 
virtual void Physics (void)
 
virtual void Gib (void)
 
virtual void Sound (string)
 
virtual void SpawnKey (string, string)
 This method handles entity key/value pairs on map load. More...
 
virtual void RunAI (void)
 Internal use only. More...
 
virtual void IdleNoise (void)
 Overridable: Called after a while when they've got nothing to do. More...
 
virtual void FallNoise (void)
 Overridable: Called when they start falling. More...
 
virtual void AlertNoise (void)
 Overridable: Called when this monster gets 'alerted' to something new. More...
 
virtual bool IsAlive (void)
 Returns if they're considered alive. More...
 
virtual bool IsFriend (int)
 Returns whether they are allied with the type in question. More...
 
virtual void HasBeenKilled (void)
 Overridable: Called once, when the monster has died. More...
 
virtual void HasBeenHit (void)
 Overridable: Called every time the monster is hurt, while still alive. More...
 
virtual void HasBeenGibbed (void)
 
virtual void HasBeenAlerted (void)
 
virtual void SeeThink (void)
 Internal use only. More...
 
virtual float SeeFOV (void)
 Overridable: Returns the field of view in degrees. More...
 
virtual void AlertNearby (void)
 FIXME: Same as WarnAllies/StartleAllies? WTF? More...
 
virtual float GetWalkSpeed (void)
 Overridable: Returns the walking speed in Quake units per second. More...
 
virtual float GetChaseSpeed (void)
 Overridable: Returns the chase speed in Quake units per second. More...
 
virtual float GetRunSpeed (void)
 Overridable: Returns the running speed in Quake units per second. More...
 
virtual float GetYawSpeed (void)
 Overridable: Returns the turning speed in euler-angle units per second. More...
 
virtual void AttackDraw (void)
 Overridable: Called when they're drawing a weapon. More...
 
virtual void AttackHolster (void)
 Overridable: Called when they're holstering a weapon. More...
 
virtual void AttackThink (void)
 Overridable: Called when aiming their weapon. More...
 
virtual int AttackMelee (void)
 Overridable: Called when attempting to melee attack. More...
 
virtual int AttackRanged (void)
 Overridable: Called when attempting to attack from a distance. More...
 
virtual float MeleeMaxDistance (void)
 Overridable: Returns the distance in qu of what'll be a successfull melee attack. More...
 
virtual bool MeleeCondition (void)
 Returns whether or not we should attempt a melee attack. More...
 
nonvirtual bool IsValidEnemy (entity)
 Returns TRUE if 'enemy' should be considered a valid target for killing. More...
 
virtual bool IsOnRoute (void)
 Returns TRUE if the monster is currently on route to a position. More...
 
virtual void FreeState (void)
 Internal use only. More...
 
virtual void FreeStateMoved (void)
 Internal use only. More...
 
virtual void FreeStateDead (void)
 Internal use only. More...
 
virtual void RouteEnded (void)
 Internal use only. More...
 
virtual void WalkRoute (void)
 Internal use only. More...
 
nonvirtual int GetSequenceState (void)
 Returns the type of sequence they're currently in. More...
 
nonvirtual bool InSequence (void)
 Returns if they're currently in a scripted sequence. More...
 
virtual int AnimIdle (void)
 DEPRECATED, Overridable: Called when we need to play a fresh idle framegroup. More...
 
virtual int AnimWalk (void)
 DEPRECATED, Overridable: Called when we need to play a fresh walking framegroup. More...
 
virtual int AnimRun (void)
 DEPRECATED, Overridable: Called when we need to play a fresh running framegroup. More...
 
virtual float FramegroupForAct (float)
 Overridable: Returns which framegroup to play for a given ACT. More...
 
nonvirtual void ActPlay (float)
 Call to play an ACT on the given NSMonster. More...
 
virtual void AnimPlay (float)
 Call to play a single animation onto it, which cannot be interrupted by movement. More...
 
virtual void AnimationUpdate (void)
 Internal use only. More...
 
nonvirtual bool InAnimation (void)
 Returns if we're currently in a forced animation sequence. More...
 
nonvirtual void AnimReset (void)
 
virtual void StateChanged (monsterState_t, monsterState_t)
 Called whenever the state of this NSMonster changes. More...
 
nonvirtual void SetState (monsterState_t)
 Sets the current state of this NSMonster. More...
 
nonvirtual monsterState_t GetState (void)
 Returns the current state of this NSMonster. More...
 
nonvirtual int GetTriggerCondition (void)
 Returns the condition under which they'll trigger their targets. More...
 
virtual void TriggerTargets (void)
 Call to trigger their targets manually. More...
 
virtual void Trigger (entity, triggermode_t)
 Called whenever we're legacy triggered by another object or function. More...
 
virtual void customphysics (void)
 overrides More...
 
virtual float predraw (void)
 
virtual void ReceiveEntity (float, float)
 Client: Handles network updates from the server for the associated entity. More...
 

Detailed Description

This entity class represents non-player characters.

QUAKED NSMonster (0 0.8 0.8) (-16 -16 0) (16 16 72) WAITTILLSEEN GAG MONSTERCLIP x PRISONER x IGNOREPLAYER WAITFORSCRIPT PREDISASTER FADECORPSE MULTIPLAYER FALLING HORDE

OVERVIEW

This entity class represents non-player characters. They have the ability to move around (or stand still) but are all capable of fighting if prompted to.

KEYS

  • "targetname" : Name
  • "netname" : Name used for obituaries and debug info.
  • "maxs" : Bounding box mins.
  • "mins" : Bounding box maxs.

KEYS - TRIGGERS

  • "TriggerCondition" : See triggerCondition_t for which numerical values to pick.
  • "TriggerTarget" : Will trigger this entity when TriggerCondition (triggerCondition_t) is met.

KEYS - BEHAVIOUR

  • "health" : Starting health.
  • "dead" : Whether to start the monster in a dead state (0 or 1).
  • "team" : Alliance. See allianceState_t for which numerical values to pick.
  • "speed_walk" : Walk speed in units per second.
  • "speed_run" : Run speed in units per second.
  • "eye_height" : Height in units at which to place the eyes from the origin. Use the cvar r_showViewCone to debug it.
  • "snd_sight" : SoundDef to play upon 'alert'.
  • "snd_idle" : SoundDef to play when the monster is idle.
  • "idle_min" : Min idle delay in seconds.
  • "idle_max" : Max idle delay in seconds.
  • "snd_footstep" : Which soundDef to play when a footstep should occur.
  • "snd_chatter" : An idle type soundDef to play.
  • "snd_chatter_combat" : An idle type soundDef, only during combat.
  • "snd_pain" : SoundDef to play when in pain.
  • "snd_death" : SoundDef to play when death settles in.
  • "snd_thud" : SoundDef to play when the monster falls to the ground.

KEYS - ATTACK (MELEE)

  • "def_attack_melee" : Which entityDef to look into for a melee attack. [CONTINUED]
  • "attack_melee_range" : Range under which melee attacks occur.
  • "snd_melee_attack" : SoundDef to play when melee attacking.
  • "snd_melee_attack_hit" : SoundDef to play when a successful melee attack occurs.
  • "snd_melee_attack_miss" : SoundDef to play when a melee attack misses.

KEYS - ATTACK (RANGED)

  • "def_attack_ranged_1" : EntityDef that contains primary ranged attack info.
  • "attack_ranged1_range" : Range for the primary ranged attack.
  • "def_attack_ranged_2" : EntityDef that contains secondary ranged attack info.
  • "attack_ranged2_range" : Range for the secondary ranged attack.
  • "snd_ranged_attack" : SoundDef to play upon ranged attack.
  • "reload_count" : how many ranged attacks until reload. Only affects primary ranged attacks.
  • "reload_delay" : Time between reloads in seconds. Requires reload_count to be set > 0.
  • "snd_reload" : SoundDef to play when reloading.
  • "reserve_ammo" : The amount of reserve ammo. -1 is infinite (default)
  • "attack_cone" : Cone in which to attack.
  • "attack_accuracy" : Accuracy (or rather, lack of) multiplier.

KEYS - ATTACK (SPECIAL)

  • "def_attack_special_1" : EntityDef that contains primary special attack info. Intended for projectiles.
  • "attack_special1_range" : Range for the primary special attack.
  • "num_projectiles" : The number of primary special projectiles to shoot.
  • "projectile_spread" : Spread of the projectiles. 0 is none. 1 is the max.
  • "projectile_delay" : Delay in seconds until a special attack projectile is thrown.
  • "weapon_drawn" : Whether or not the weapon is drawn by default. Either 0 or 1.
  • "body_on_draw" : Which bodygroup to switch to when the monster has drawn its weapon.
  • "leap_damage" : Amount of damage appled when the enemy leaps towards you and hits.

SPAWNFLAGS

  • WAITTILLSEEN (1) - Play scripted sequence only once the monster gets seen by a player.
  • GAG (2) - Won't speak.
  • MONSTERCLIP (4) - Interacts with monsterclips?
  • PRISONER (16) - Never used.
  • IGNOREPLAYER (64) - Ignores the player. Like 'notarget'.
  • WAITFORSCRIPT (128) - Does nothing, until a scripted sequence runs on the monster. Then becomes alive.
  • PREDISASTER (256) - Special flag used in Half-Life.
  • FADECORPSE (512) - Corpse will disappear on its own.
  • MULTIPLAYER (1024) - Available in multiplayer.
  • FALLING (2048) - Will not drop to the floor upon level spawn - but fall when in-game.
  • HORDE (4096) - Never used.

Constructor & Destructor Documentation

◆ NSMonster()

void NSMonster::NSMonster ( void  )

Member Function Documentation

◆ ActPlay()

void NSMonster::ActPlay ( float  actName)

Call to play an ACT on the given NSMonster.

◆ AlertNearby()

void NSMonster::AlertNearby ( void  )
virtual

FIXME: Same as WarnAllies/StartleAllies? WTF?

◆ AlertNoise()

void NSMonster::AlertNoise ( void  )
virtual

Overridable: Called when this monster gets 'alerted' to something new.

◆ AnimationUpdate()

void NSMonster::AnimationUpdate ( void  )
virtual

Internal use only.

Run every frame to update animation parameters.

◆ AnimIdle()

int NSMonster::AnimIdle ( void  )
virtual

DEPRECATED, Overridable: Called when we need to play a fresh idle framegroup.

◆ AnimPlay()

void NSMonster::AnimPlay ( float  seq)
virtual

Call to play a single animation onto it, which cannot be interrupted by movement.

◆ AnimReset()

void NSMonster::AnimReset ( void  )

◆ AnimRun()

int NSMonster::AnimRun ( void  )
virtual

DEPRECATED, Overridable: Called when we need to play a fresh running framegroup.

◆ AnimWalk()

int NSMonster::AnimWalk ( void  )
virtual

DEPRECATED, Overridable: Called when we need to play a fresh walking framegroup.

◆ AttackDraw()

void NSMonster::AttackDraw ( void  )
virtual

Overridable: Called when they're drawing a weapon.

◆ AttackHolster()

void NSMonster::AttackHolster ( void  )
virtual

Overridable: Called when they're holstering a weapon.

◆ AttackMelee()

int NSMonster::AttackMelee ( void  )
virtual

Overridable: Called when attempting to melee attack.

Return 0 if impossible.

◆ AttackRanged()

int NSMonster::AttackRanged ( void  )
virtual

Overridable: Called when attempting to attack from a distance.

Return 0 if impossible.

◆ AttackThink()

void NSMonster::AttackThink ( void  )
virtual

Overridable: Called when aiming their weapon.

◆ customphysics()

virtual void NSMonster::customphysics ( void  )
virtual

overrides

◆ Death()

void NSMonster::Death ( void  )
virtual

Called when the health is equal or below 0.

Reimplemented from NSSurfacePropEntity.

◆ EvaluateEntity()

void NSMonster::EvaluateEntity ( void  )
virtual

Run each tic after physics are run to determine if we need to send updates over the network.

Reimplemented from NSSurfacePropEntity.

Reimplemented in ambient_generic, and speaker.

◆ FallNoise()

void NSMonster::FallNoise ( void  )
virtual

Overridable: Called when they start falling.

◆ FramegroupForAct()

float NSMonster::FramegroupForAct ( float  actName)
virtual

Overridable: Returns which framegroup to play for a given ACT.

◆ FreeState()

void NSMonster::FreeState ( void  )
virtual

Internal use only.

Called when a sequence is done.

◆ FreeStateDead()

void NSMonster::FreeStateDead ( void  )
virtual

Internal use only.

Called when a sequence is done and we leave a corpse.

◆ FreeStateMoved()

void NSMonster::FreeStateMoved ( void  )
virtual

Internal use only.

Called when a sequence is done.

◆ GetChaseSpeed()

float NSMonster::GetChaseSpeed ( void  )
virtual

Overridable: Returns the chase speed in Quake units per second.

◆ GetRunSpeed()

float NSMonster::GetRunSpeed ( void  )
virtual

Overridable: Returns the running speed in Quake units per second.

◆ GetSequenceState()

int NSMonster::GetSequenceState ( void  )

Returns the type of sequence they're currently in.

◆ GetState()

monsterState_t NSMonster::GetState ( void  )

Returns the current state of this NSMonster.

◆ GetTriggerCondition()

int NSMonster::GetTriggerCondition ( void  )

Returns the condition under which they'll trigger their targets.

◆ GetWalkSpeed()

float NSMonster::GetWalkSpeed ( void  )
virtual

Overridable: Returns the walking speed in Quake units per second.

◆ GetYawSpeed()

float NSMonster::GetYawSpeed ( void  )
virtual

Overridable: Returns the turning speed in euler-angle units per second.

◆ Gib()

void NSMonster::Gib ( void  )
virtual

◆ HasBeenAlerted()

void NSMonster::HasBeenAlerted ( void  )
virtual

◆ HasBeenGibbed()

void NSMonster::HasBeenGibbed ( void  )
virtual

◆ HasBeenHit()

void NSMonster::HasBeenHit ( void  )
virtual

Overridable: Called every time the monster is hurt, while still alive.

◆ HasBeenKilled()

void NSMonster::HasBeenKilled ( void  )
virtual

Overridable: Called once, when the monster has died.

◆ IdleNoise()

void NSMonster::IdleNoise ( void  )
virtual

Overridable: Called after a while when they've got nothing to do.

◆ InAnimation()

bool NSMonster::InAnimation ( void  )

Returns if we're currently in a forced animation sequence.

◆ Input()

void NSMonster::Input ( entity  eAct,
string  strInput,
string  strData 
)
virtual

Called when we are being prompted by another object/function with an input message.

Reimplemented from NSSurfacePropEntity.

Reimplemented in ambient_generic.

◆ InSequence()

bool NSMonster::InSequence ( void  )

Returns if they're currently in a scripted sequence.

◆ IsAlive()

bool NSMonster::IsAlive ( void  )
virtual

Returns if they're considered alive.

Reimplemented from NSSurfacePropEntity.

◆ IsFriend()

bool NSMonster::IsFriend ( int  al)
virtual

Returns whether they are allied with the type in question.

◆ IsOnRoute()

bool NSMonster::IsOnRoute ( void  )
virtual

Returns TRUE if the monster is currently on route to a position.

◆ IsValidEnemy()

bool NSMonster::IsValidEnemy ( entity  enny)

Returns TRUE if 'enemy' should be considered a valid target for killing.

◆ MeleeCondition()

bool NSMonster::MeleeCondition ( void  )
virtual

Returns whether or not we should attempt a melee attack.

FIXME: Should pass a parameter for the enemy in question instead!

◆ MeleeMaxDistance()

float NSMonster::MeleeMaxDistance ( void  )
virtual

Overridable: Returns the distance in qu of what'll be a successfull melee attack.

◆ Pain()

void NSMonster::Pain ( void  )
virtual

Called whenever the entity receives damage.

Reimplemented from NSSurfacePropEntity.

◆ Physics()

void NSMonster::Physics ( void  )
virtual

◆ predraw()

virtual float NSMonster::predraw ( void  )
virtual

Reimplemented from NSSurfacePropEntity.

Reimplemented in NSTalkMonster.

◆ ReceiveEntity()

virtual void NSMonster::ReceiveEntity ( float  flNew,
float  flChanged 
)
virtual

Client: Handles network updates from the server for the associated entity.

Reimplemented from NSSurfacePropEntity.

Reimplemented in speaker, and NSTalkMonster.

◆ Respawn()

void NSMonster::Respawn ( void  )
virtual

Server: Called when the entity first spawns or when game-logic requests the entity to return to its original spawn state.

Reimplemented from NSSurfacePropEntity.

Reimplemented in monster_furniture, monster_generic, ambient_generic, speaker, and NSTalkMonster.

◆ Restore()

void NSMonster::Restore ( string  strKey,
string  strValue 
)
virtual

Similar to ::SpawnKey but for save-game fields.

Whatever you write into file handles within your ::Save() method needs to be read back in here.

Reimplemented from NSNavAI.

Reimplemented in ambient_generic, speaker, NSSquadMonster, and NSTalkMonster.

◆ RouteEnded()

void NSMonster::RouteEnded ( void  )
virtual

Internal use only.

Called when a movement route is done.

Reimplemented from NSNavAI.

◆ RunAI()

void NSMonster::RunAI ( void  )
virtual

Internal use only.

Run every frame to go through the main AI loop.

Reimplemented in NSTalkMonster.

◆ Save()

void NSMonster::Save ( float  handle)
virtual

Handles saving a copy of this entity to a given filehandle.

Within you want to use the ::SaveFloat() etc. methods to write the internal member attributes to the specified file handle.

Reimplemented from NSNavAI.

Reimplemented in ambient_generic, speaker, NSSquadMonster, and NSTalkMonster.

◆ SeeFOV()

float NSMonster::SeeFOV ( void  )
virtual

Overridable: Returns the field of view in degrees.

◆ SeeThink()

void NSMonster::SeeThink ( void  )
virtual

Internal use only.

Called every frame to simulate vision.

◆ SendEntity()

float NSMonster::SendEntity ( entity  ,
float   
)
virtual

Called by the engine whenever we need to send a client an update about this entity.

Reimplemented from NSSurfacePropEntity.

Reimplemented in ambient_generic, speaker, and NSTalkMonster.

◆ SetState()

void NSMonster::SetState ( monsterState_t  newState)

Sets the current state of this NSMonster.

◆ Sound()

void NSMonster::Sound ( string  msg)
virtual

◆ Spawned()

void NSMonster::Spawned ( void  )
virtual

Called when the entity is fulled initialized.

Any spawn key/value info pairs have already been dealt with. So now we can make full decisions on the entity. Always make sure to call super::Spawned(); inside your method when overriding.

Reimplemented from NSSurfacePropEntity.

Reimplemented in ambient_generic, speaker, and NSSquadMonster.

◆ SpawnKey()

void NSMonster::SpawnKey ( string  strKey,
string  strValue 
)
virtual

This method handles entity key/value pairs on map load.

You can easily convert the strValue parameter using the ReadFloat etc. methods that are part of NSIO.

Reimplemented from NSSurfacePropEntity.

Reimplemented in ambient_generic, speaker, NSSquadMonster, and NSTalkMonster.

◆ StateChanged()

void NSMonster::StateChanged ( monsterState_t  oldState,
monsterState_t  newState 
)
virtual

Called whenever the state of this NSMonster changes.

◆ Touch()

void NSMonster::Touch ( entity  eToucher)
virtual

Called whenever we're touching another entity.

Reimplemented from NSTrigger.

Reimplemented in NSTalkMonster.

◆ Trigger()

void NSMonster::Trigger ( entity  act,
triggermode_t  state 
)
virtual

Called whenever we're legacy triggered by another object or function.

Reimplemented from NSTrigger.

Reimplemented in speaker.

◆ TriggerTargets()

void NSMonster::TriggerTargets ( void  )
virtual

Call to trigger their targets manually.

◆ WalkRoute()

void NSMonster::WalkRoute ( void  )
virtual

Internal use only.

Called every frame to progress through a route.


The documentation for this class was generated from the following files: