Inside3D tutorials.
Created By: MaNiAc
eMail: stevet@thevision.net
Difficulty Scale: Easy


Step 1
This is a VERY simple tutorial on how to make a "Vampire Axe." A "Vampire Axe" gives the amount of damage it deals to its owner. Now that the into is over with, lets get started!

Find the beginning of the function for swinging your axe.(This line is very near the beginning of weapons.qc) The line should be:

void() W_FireAxe =

Step 2
Scroll down from there until you find the following lines: (starting at line 50)
        if (trace_ent.takedamage)
        {
                trace_ent.axhitme = 1;
                SpawnBlood (org, '0 0 0', 20);
                T_Damage (trace_ent, self, self, 20);
        }
};

Step 3
Change the lines listed above to the following: (Note that the line "T_Damage (trace_ent, self, self, 20);" from the original has been changed to "T_Damage (trace_ent, self, self, 15);" because the "Vampire Axe" should be weaker than the original due to its new "power.")
        if (trace_ent.takedamage)
        {
                trace_ent.axhitme = 1;
                SpawnBlood (org, '0 0 0', 20);
                T_Damage (trace_ent, self, self, 15);   //Do only 15 damage.
                //ADD THE NEXT 8 LINES!!!!
                if(trace_ent.classname == "door")      
                        return;                         //Don't give life for secret doors.
                if (self.health >= 100)
                        return;                         //Don't give life over 100.
                else
                        self.health = self.health + 15; //Give 'em +15 health.
                if (self.health > 100)
                        self.health = 100;              //Make sure they don't go above 100 health.
        }

Thats it! As they say, "just compile it and yer ready!" Prepare to have hours o' fun with your new "Vampire Axe"!