Healing Zombies... weird heh!!!
Ok, let's get started. First we need to make it so the Zombies
have a very small chance of being the Healer, so we need to open
up the zombie.qc file and find the function... monster_zombie.
At the top of that file you need to add the following line.
local float healchance; // The chance that the zombie will have the healing ability
Find the next part in that function. It should look like this.
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
setmodel (self, "progs/zombie.mdl");
After those lines you need to add the following.
healchance = random(); // Random number for the healchance
if (healchance >= 0.90) // 10 percent chance of having the healing ability
self.skin = 1; // Skin number 0 is the default skin, 1
//is the healer
Next I need you to go find the following lines.
setsize (self, '-16 -16 -24', '16 16 40');
self.health = 60;
After those lines I need you to add the following.
if (self.skin == 0) // if the zombie is the original then...
self.th_stand = zombie_stand1;
self.th_walk = zombie_walk1;
self.th_run = zombie_run1;
self.th_pain = zombie_pain;
self.th_die = zombie_die;
self.th_missile = zombie_missile;
if (self.skin == 1) // if the zombie is a healer then...
self.th_stand = zombie_walk1; // Wonders around
self.th_walk = zombie_walk1; // Walking
self.th_run = zombie_run1; // Running
self.th_pain = zombie_die; // If he is hit by any weapon then gib
self.th_die = zombie_die; // Dieing
self.th_missile = zombie_walk1; // Walking
self.touch = HealPlayer; // If you touch him then he will heal u
Now, for the last bit of coding. Above the monster_zombie function
add the following function.
void() HealPlayer = // Heal the player function
if (other.classname != "player") // if something other than the player touches it then do nothing
if (other.classname == "player") // if the player touches it then...
if (other.health >= 100) // if player's health is greater than or equal to 100 then do nothing
if (other.health <= 95) // If player's health is less than or equal to 95 then add 5 to health
other.health = other.health + 5;
Unzip this model into your project directory under /progs.
Compile, and find a zombie that looks different. Walk up
to them and touch them. They will make your health 100%.