Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
zombie.qc File Reference
#include "zombie.qh"
Include dependency graph for zombie.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool M_Zombie_Attack (int attack_type, entity actor, entity targ,.entity weaponentity)
void M_Zombie_Attack_Leap_Touch (entity this, entity toucher)
bool M_Zombie_Defend_Block (entity this)
void M_Zombie_Defend_Block_End (entity this)
 spawnfunc (monster_zombie)

Variables

float autocvar_g_monster_zombie_attack_leap_damage
float autocvar_g_monster_zombie_attack_leap_delay
float autocvar_g_monster_zombie_attack_leap_force
float autocvar_g_monster_zombie_attack_leap_speed
float autocvar_g_monster_zombie_attack_melee_damage
float autocvar_g_monster_zombie_attack_melee_delay
float autocvar_g_monster_zombie_damageforcescale = 0.55
float autocvar_g_monster_zombie_health
string autocvar_g_monster_zombie_loot = "health_medium"
float autocvar_g_monster_zombie_speed_run
float autocvar_g_monster_zombie_speed_stop
float autocvar_g_monster_zombie_speed_walk
vector moveto

Function Documentation

◆ M_Zombie_Attack()

bool M_Zombie_Attack ( int attack_type,
entity actor,
entity targ,
.entity weaponentity )

Definition at line 64 of file zombie.qc.

65{
66 switch(attack_type)
67 {
69 {
70 if(random() < 0.3 && GetResource(actor, RES_HEALTH) < 75 && GetResource(actor.enemy, RES_HEALTH) > 10)
71 return M_Zombie_Defend_Block(actor);
72
73 float anim_chance = random();
74 vector chosen_anim;
75
76 if(anim_chance < 0.33)
77 chosen_anim = actor.anim_melee1;
78 else if(anim_chance < 0.66)
79 chosen_anim = actor.anim_melee2;
80 else
81 chosen_anim = actor.anim_melee3;
82
83 return Monster_Attack_Melee(actor, actor.enemy, (autocvar_g_monster_zombie_attack_melee_damage), chosen_anim, actor.attack_range, (autocvar_g_monster_zombie_attack_melee_delay), DEATH_MONSTER_ZOMBIE_MELEE.m_id, true);
84 }
86 {
87 makevectors(actor.angles);
89 }
90 }
91
92 return false;
93}
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
vector v_forward
float random(void)
#define makevectors
Definition post.qh:21
vector
Definition self.qh:92
bool Monster_Attack_Melee(entity this, entity targ, float damg, vector anim, float er, float animtime, int deathtype, bool dostop)
bool Monster_Attack_Leap(entity this, vector anm, void(entity this, entity toucher) touchfunc, vector vel, float animtime)
const int MONSTER_ATTACK_MELEE
const int MONSTER_ATTACK_RANGED
void M_Zombie_Attack_Leap_Touch(entity this, entity toucher)
Definition zombie.qc:19
float autocvar_g_monster_zombie_attack_melee_delay
Definition zombie.qc:8
float autocvar_g_monster_zombie_attack_leap_delay
Definition zombie.qc:12
float autocvar_g_monster_zombie_attack_melee_damage
Definition zombie.qc:7
bool M_Zombie_Defend_Block(entity this)
Definition zombie.qc:51
float autocvar_g_monster_zombie_attack_leap_speed
Definition zombie.qc:11

References autocvar_g_monster_zombie_attack_leap_delay, autocvar_g_monster_zombie_attack_leap_speed, autocvar_g_monster_zombie_attack_melee_damage, autocvar_g_monster_zombie_attack_melee_delay, entity(), GetResource(), M_Zombie_Attack_Leap_Touch(), M_Zombie_Defend_Block(), makevectors, Monster_Attack_Leap(), MONSTER_ATTACK_MELEE, Monster_Attack_Melee(), MONSTER_ATTACK_RANGED, random(), v_forward, and vector.

◆ M_Zombie_Attack_Leap_Touch()

void M_Zombie_Attack_Leap_Touch ( entity this,
entity toucher )

Definition at line 19 of file zombie.qc.

20{
21 if (GetResource(this, RES_HEALTH) <= 0)
22 return;
23
24 vector angles_face;
25
26 if(toucher.takedamage)
27 {
28 angles_face = vectoangles(this.moveto - this.origin);
29 angles_face = normalize(angles_face) * (autocvar_g_monster_zombie_attack_leap_force);
30 Damage(toucher, this, this, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(this), DEATH_MONSTER_ZOMBIE_JUMP.m_id, DMG_NOWEP, toucher.origin, angles_face);
31 settouch(this, Monster_Touch); // instantly turn it off to stop damage spam
32 this.state = 0;
33 }
34
36 {
37 this.state = 0;
39 }
40}
float trace_dphitcontents
vector origin
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition damage.qc:503
#define DMG_NOWEP
Definition damage.qh:104
int state
vector vectoangles(vector v)
vector normalize(vector v)
entity entity toucher
Definition self.qh:72
#define settouch(e, f)
Definition self.qh:73
void Monster_Touch(entity this, entity toucher)
#define MONSTER_SKILLMOD(mon)
float autocvar_g_monster_zombie_attack_leap_damage
Definition zombie.qc:9
float autocvar_g_monster_zombie_attack_leap_force
Definition zombie.qc:10
vector moveto
Definition zombie.qc:17

References autocvar_g_monster_zombie_attack_leap_damage, autocvar_g_monster_zombie_attack_leap_force, Damage(), DMG_NOWEP, entity(), GetResource(), MONSTER_SKILLMOD, Monster_Touch(), moveto, normalize(), origin, settouch, state, toucher, trace_dphitcontents, vectoangles(), and vector.

Referenced by M_Zombie_Attack().

◆ M_Zombie_Defend_Block()

bool M_Zombie_Defend_Block ( entity this)

Definition at line 51 of file zombie.qc.

52{
54 this.state = MONSTER_ATTACK_MELEE; // freeze monster
55 this.attack_finished_single[0] = time + 2.1;
57 setanim(this, this.anim_blockstart, false, true, true);
58
60
61 return true;
62}
#define setanim(...)
Definition anim.qh:45
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
float time
RES_ARMOR
Definition ent_cs.qc:130
vector anim_blockstart
Definition monster.qh:28
void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func)
float anim_finished
float attack_finished_single[MAX_WEAPONSLOTS]
void M_Zombie_Defend_Block_End(entity this)
Definition zombie.qc:42

References anim_blockstart, anim_finished, attack_finished_single, entity(), M_Zombie_Defend_Block_End(), MONSTER_ATTACK_MELEE, Monster_Delay(), RES_ARMOR, setanim, SetResourceExplicit(), state, and time.

Referenced by M_Zombie_Attack().

◆ M_Zombie_Defend_Block_End()

void M_Zombie_Defend_Block_End ( entity this)

Definition at line 42 of file zombie.qc.

43{
44 if(GetResource(this, RES_HEALTH) <= 0)
45 return;
46
47 setanim(this, this.anim_blockend, false, true, true);
49}
vector anim_blockend
Definition monster.qh:27
float autocvar_g_monsters_armor_blockpercent

References anim_blockend, autocvar_g_monsters_armor_blockpercent, entity(), GetResource(), RES_ARMOR, setanim, and SetResourceExplicit().

Referenced by M_Zombie_Defend_Block().

◆ spawnfunc()

spawnfunc ( monster_zombie )

Definition at line 95 of file zombie.qc.

95{ Monster_Spawn(this, true, MON_ZOMBIE); }
bool Monster_Spawn(entity this, bool check_appear, Monster mon)

References Monster_Spawn().

Variable Documentation

◆ autocvar_g_monster_zombie_attack_leap_damage

float autocvar_g_monster_zombie_attack_leap_damage

Definition at line 9 of file zombie.qc.

Referenced by M_Zombie_Attack_Leap_Touch().

◆ autocvar_g_monster_zombie_attack_leap_delay

float autocvar_g_monster_zombie_attack_leap_delay

Definition at line 12 of file zombie.qc.

Referenced by M_Zombie_Attack().

◆ autocvar_g_monster_zombie_attack_leap_force

float autocvar_g_monster_zombie_attack_leap_force

Definition at line 10 of file zombie.qc.

Referenced by M_Zombie_Attack_Leap_Touch().

◆ autocvar_g_monster_zombie_attack_leap_speed

float autocvar_g_monster_zombie_attack_leap_speed

Definition at line 11 of file zombie.qc.

Referenced by M_Zombie_Attack().

◆ autocvar_g_monster_zombie_attack_melee_damage

float autocvar_g_monster_zombie_attack_melee_damage

Definition at line 7 of file zombie.qc.

Referenced by M_Zombie_Attack().

◆ autocvar_g_monster_zombie_attack_melee_delay

float autocvar_g_monster_zombie_attack_melee_delay

Definition at line 8 of file zombie.qc.

Referenced by M_Zombie_Attack().

◆ autocvar_g_monster_zombie_damageforcescale

float autocvar_g_monster_zombie_damageforcescale = 0.55

Definition at line 6 of file zombie.qc.

◆ autocvar_g_monster_zombie_health

float autocvar_g_monster_zombie_health

Definition at line 4 of file zombie.qc.

◆ autocvar_g_monster_zombie_loot

string autocvar_g_monster_zombie_loot = "health_medium"

Definition at line 5 of file zombie.qc.

◆ autocvar_g_monster_zombie_speed_run

float autocvar_g_monster_zombie_speed_run

Definition at line 14 of file zombie.qc.

◆ autocvar_g_monster_zombie_speed_stop

float autocvar_g_monster_zombie_speed_stop

Definition at line 13 of file zombie.qc.

◆ autocvar_g_monster_zombie_speed_walk

float autocvar_g_monster_zombie_speed_walk

Definition at line 15 of file zombie.qc.

◆ moveto