REGISTER_MONSTER(
/* MON_##id */ ZOMBIE,
/* function */ m_zombie,
-/* spawnflags */ 0,
+/* spawnflags */ MON_FLAG_MELEE,
/* mins,maxs */ '-18 -18 -25', '18 18 47',
/* model */ "zombie.dpm",
/* netname */ "zombie",
self.touch = MonsterTouch;
}
+void zombie_blockend()
+{
+ if(self.health <= 0)
+ return;
+
+ self.frame = zombie_anim_blockend;
+ self.armorvalue = 0;
+ self.m_armor_blockpercent = autocvar_g_monsters_armor_blockpercent;
+}
+
+float zombie_block()
+{
+ self.frame = zombie_anim_blockstart;
+ self.armorvalue = 100;
+ self.m_armor_blockpercent = 0.9;
+ self.state = MONSTER_STATE_ATTACK_MELEE; // freeze monster
+ self.attack_finished_single = time + 2.1;
+
+ defer(2, zombie_blockend);
+
+ return TRUE;
+}
+
float zombie_attack(float attack_type)
{
switch(attack_type)
else
chosen_anim = zombie_anim_attackstanding3;
- if(monster_melee(self.enemy, MON_CVAR(zombie, attack_melee_damage), chosen_anim, self.attack_range, MON_CVAR(zombie, attack_melee_delay), DEATH_MONSTER_ZOMBIE_MELEE, TRUE))
- return TRUE;
-
- return FALSE;
+ if(random() < 0.3 && self.health < 75 && self.enemy.health > 10)
+ return zombie_block();
+
+ return monster_melee(self.enemy, MON_CVAR(zombie, attack_melee_damage), chosen_anim, self.attack_range, MON_CVAR(zombie, attack_melee_delay), DEATH_MONSTER_ZOMBIE_MELEE, TRUE);
}
case MONSTER_ATTACK_RANGED:
{
makevectors(self.angles);
- if(monster_leap(zombie_anim_attackleap, zombie_attack_leap_touch, v_forward * MON_CVAR(zombie, attack_leap_speed) + '0 0 200', MON_CVAR(zombie, attack_leap_delay)))
- return TRUE;
-
- return FALSE;
+ return monster_leap(zombie_anim_attackleap, zombie_attack_leap_touch, v_forward * MON_CVAR(zombie, attack_leap_speed) + '0 0 200', MON_CVAR(zombie, attack_leap_delay));
}
}
}
case MR_DEATH:
{
- monsters_setframe((random() > 0.5) ? zombie_anim_deathback1 : zombie_anim_deathfront1);
+ self.armorvalue = 0;
+ self.m_armor_blockpercent = autocvar_g_monsters_armor_blockpercent;
+ self.frame = ((random() > 0.5) ? zombie_anim_deathback1 : zombie_anim_deathfront1);
return TRUE;
}
case MR_SETUP:
self.monster_loot = spawnfunc_item_health_medium;
self.monster_attackfunc = zombie_attack;
- monsters_setframe(zombie_anim_spawn);
+ self.frame = zombie_anim_spawn;
self.spawn_time = time + 2.1;
self.spawnshieldtime = self.spawn_time;
self.respawntime = 0.2;
return TRUE;
}
- case MR_INIT:
+ case MR_PRECACHE:
{
- // nothing
+ precache_model ("models/monsters/zombie.dpm");
return TRUE;
}
case MR_CONFIG:
{
switch(req)
{
- case MR_DEATH:
- {
- // nothing
- return TRUE;
- }
- case MR_INIT:
+ case MR_PRECACHE:
{
precache_model ("models/monsters/zombie.dpm");
return TRUE;