Nuclide
Software Development Kit for id Technology (BETA)
ncMonster Class Reference

About this class

This entity class represents non-player characters.

QUAKED ncMonster (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.
Inheritance diagram for ncMonster:
ncActor monster_furniture ncSquadMonster ncTalkMonster ambient_generic monster_generic speaker

Public Member Functions

void ncMonster (void)
 
virtual void Save (float)
 Handles saving a copy of this entity to a given filehandle. More...
 
virtual void Restore (string, string)
 Similar to ncIO::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 (entity, entity, int, vector, vector, int)
 Called whenever the entity receives damage. More...
 
virtual void Death (entity, entity, int, vector, vector, int)
 Called when the health is equal or below 0. More...
 
virtual void Physics (void)
 
virtual void Gib (int, vector)
 
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...
 
nonvirtual void PerformAttack (string)
 
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...
 
virtual void SeenPlayer (ncActor)
 Called when a player is seen by the monster. More...
 
virtual void SeenEnemy (ncActor)
 Called when an enemy is seen by the monster. More...
 
virtual void SeenFriend (ncActor)
 Called when a friend is seen by the monster. 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 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 ncMonster changes. More...
 
nonvirtual void SetState (monsterState_t)
 Sets the current state of this ncMonster. More...
 
nonvirtual monsterState_t GetState (void)
 Returns the current state of this ncMonster. 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...
 
nonvirtual vector GetHeadAngles (void)
 
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...
 

Constructor & Destructor Documentation

◆ ncMonster()

void ncMonster::ncMonster ( void  )

Member Function Documentation

◆ AlertNearby()

void ncMonster::AlertNearby ( void  )
virtual

FIXME: Same as WarnAllies/StartleAllies? WTF?

◆ AlertNoise()

void ncMonster::AlertNoise ( void  )
virtual

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

◆ AnimationUpdate()

void ncMonster::AnimationUpdate ( void  )
virtual

Internal use only.

Run every frame to update animation parameters.

◆ AnimIdle()

int ncMonster::AnimIdle ( void  )
virtual

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

◆ AnimPlay()

void ncMonster::AnimPlay ( float  seq)
virtual

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

◆ AnimReset()

void ncMonster::AnimReset ( void  )

◆ AnimRun()

int ncMonster::AnimRun ( void  )
virtual

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

◆ AnimWalk()

int ncMonster::AnimWalk ( void  )
virtual

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

◆ AttackDraw()

void ncMonster::AttackDraw ( void  )
virtual

Overridable: Called when they're drawing a weapon.

◆ AttackHolster()

void ncMonster::AttackHolster ( void  )
virtual

Overridable: Called when they're holstering a weapon.

◆ AttackMelee()

int ncMonster::AttackMelee ( void  )
virtual

Overridable: Called when attempting to melee attack.

Return 0 if impossible.

◆ AttackRanged()

int ncMonster::AttackRanged ( void  )
virtual

Overridable: Called when attempting to attack from a distance.

Return 0 if impossible.

◆ AttackThink()

void ncMonster::AttackThink ( void  )
virtual

Overridable: Called when aiming their weapon.

◆ customphysics()

virtual void ncMonster::customphysics ( void  )
virtual

overrides

◆ Death()

void ncMonster::Death ( entity  inflictor,
entity  attacker,
int  damage,
vector  dir,
vector  absImpactPos,
int  hitBody 
)
virtual

Called when the health is equal or below 0.

Reimplemented from ncSurfacePropEntity.

◆ EvaluateEntity()

void ncMonster::EvaluateEntity ( void  )
virtual

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

Reimplemented from ncSurfacePropEntity.

Reimplemented in ambient_generic, and speaker.

◆ FallNoise()

void ncMonster::FallNoise ( void  )
virtual

Overridable: Called when they start falling.

◆ FreeState()

void ncMonster::FreeState ( void  )
virtual

Internal use only.

Called when a sequence is done.

◆ FreeStateDead()

void ncMonster::FreeStateDead ( void  )
virtual

Internal use only.

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

◆ FreeStateMoved()

void ncMonster::FreeStateMoved ( void  )
virtual

Internal use only.

Called when a sequence is done.

◆ GetChaseSpeed()

float ncMonster::GetChaseSpeed ( void  )
virtual

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

◆ GetHeadAngles()

vector ncMonster::GetHeadAngles ( void  )

◆ GetRunSpeed()

float ncMonster::GetRunSpeed ( void  )
virtual

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

◆ GetSequenceState()

int ncMonster::GetSequenceState ( void  )

Returns the type of sequence they're currently in.

◆ GetState()

monsterState_t ncMonster::GetState ( void  )

Returns the current state of this ncMonster.

◆ GetTriggerCondition()

int ncMonster::GetTriggerCondition ( void  )

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

◆ GetWalkSpeed()

float ncMonster::GetWalkSpeed ( void  )
virtual

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

◆ GetYawSpeed()

float ncMonster::GetYawSpeed ( void  )
virtual

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

◆ Gib()

void ncMonster::Gib ( int  damage,
vector  dir 
)
virtual

◆ HasBeenAlerted()

void ncMonster::HasBeenAlerted ( void  )
virtual

◆ HasBeenGibbed()

void ncMonster::HasBeenGibbed ( void  )
virtual

◆ HasBeenHit()

void ncMonster::HasBeenHit ( void  )
virtual

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

◆ HasBeenKilled()

void ncMonster::HasBeenKilled ( void  )
virtual

Overridable: Called once, when the monster has died.

◆ IdleNoise()

void ncMonster::IdleNoise ( void  )
virtual

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

◆ InAnimation()

bool ncMonster::InAnimation ( void  )

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

◆ Input()

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

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

Reimplemented from ncActor.

Reimplemented in ambient_generic.

◆ InSequence()

bool ncMonster::InSequence ( void  )

Returns if they're currently in a scripted sequence.

◆ IsAlive()

bool ncMonster::IsAlive ( void  )
virtual

Returns if they're considered alive.

Reimplemented from ncSurfacePropEntity.

◆ IsFriend()

bool ncMonster::IsFriend ( int  al)
virtual

Returns whether they are allied with the type in question.

◆ IsOnRoute()

bool ncMonster::IsOnRoute ( void  )
virtual

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

◆ IsValidEnemy()

bool ncMonster::IsValidEnemy ( entity  enny)

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

◆ MeleeCondition()

bool ncMonster::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 ncMonster::MeleeMaxDistance ( void  )
virtual

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

◆ Pain()

void ncMonster::Pain ( entity  inflictor,
entity  attacker,
int  damage,
vector  dir,
vector  absImpactPos,
int  hitBody 
)
virtual

Called whenever the entity receives damage.

Reimplemented from ncSurfacePropEntity.

◆ PerformAttack()

void ncMonster::PerformAttack ( string  attackDef)

◆ Physics()

void ncMonster::Physics ( void  )
virtual

◆ predraw()

virtual float ncMonster::predraw ( void  )
virtual

Reimplemented from ncSurfacePropEntity.

Reimplemented in ambient_generic, and ncTalkMonster.

◆ ReceiveEntity()

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

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

Reimplemented from ncSurfacePropEntity.

Reimplemented in ambient_generic, speaker, and ncTalkMonster.

◆ Respawn()

void ncMonster::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 ncSurfacePropEntity.

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

◆ Restore()

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

Similar to ncIO::SpawnKey() but for save-game fields.

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

Reimplemented from ncActor.

Reimplemented in ambient_generic, speaker, ncSquadMonster, and ncTalkMonster.

◆ RouteEnded()

void ncMonster::RouteEnded ( void  )
virtual

Internal use only.

Called when a movement route is done.

Reimplemented from ncActor.

◆ RunAI()

void ncMonster::RunAI ( void  )
virtual

Internal use only.

Run every frame to go through the main AI loop.

Reimplemented in ncTalkMonster.

◆ Save()

void ncMonster::Save ( float  handle)
virtual

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

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

Reimplemented from ncActor.

Reimplemented in ambient_generic, speaker, ncSquadMonster, and ncTalkMonster.

◆ SeeFOV()

float ncMonster::SeeFOV ( void  )
virtual

Overridable: Returns the field of view in degrees.

◆ SeenEnemy()

void ncMonster::SeenEnemy ( ncActor  theActor)
virtual

Called when an enemy is seen by the monster.

◆ SeenFriend()

void ncMonster::SeenFriend ( ncActor  theActor)
virtual

Called when a friend is seen by the monster.

Reimplemented in ncTalkMonster.

◆ SeenPlayer()

void ncMonster::SeenPlayer ( ncActor  theActor)
virtual

Called when a player is seen by the monster.

Reimplemented in ncTalkMonster.

◆ SeeThink()

void ncMonster::SeeThink ( void  )
virtual

Internal use only.

Called every frame to simulate vision.

◆ SendEntity()

float ncMonster::SendEntity ( entity  ,
float   
)
virtual

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

Reimplemented from ncSurfacePropEntity.

Reimplemented in ambient_generic, speaker, and ncTalkMonster.

◆ SetState()

void ncMonster::SetState ( monsterState_t  newState)

Sets the current state of this ncMonster.

◆ Sound()

void ncMonster::Sound ( string  msg)
virtual

◆ Spawned()

void ncMonster::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 ncActor.

Reimplemented in ambient_generic, speaker, and ncSquadMonster.

◆ SpawnKey()

void ncMonster::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 ncIO.

Reimplemented from ncActor.

Reimplemented in monster_furniture, ambient_generic, speaker, ncSquadMonster, and ncTalkMonster.

◆ StateChanged()

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

Called whenever the state of this ncMonster changes.

◆ Touch()

void ncMonster::Touch ( entity  eToucher)
virtual

Called whenever we're touching another entity.

Reimplemented from ncTrigger.

Reimplemented in ncTalkMonster.

◆ Trigger()

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

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

Reimplemented from ncTrigger.

Reimplemented in speaker.

◆ TriggerTargets()

void ncMonster::TriggerTargets ( void  )
virtual

Call to trigger their targets manually.

◆ WalkRoute()

void ncMonster::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: