Rage through 32 single player levels and 6 deathmatch levels of sheer terror and fully immersive sound and lighting. Arm yourself against the cannibalistic Ogre, fiendish Vore and indestructible Schambler using lethal nails, fierce Thunderbolts and abominable Rocket and Grenade Launchers.

Post tutorial Report RSS Mecha Explosive Puppy

Very simple tutorial aimed at people looking to begin learning Quake-C. Makes the rottweilers explode and deal damage when they attack or are attacked.

Posted by on - Basic Client Side Coding

[page=Mecha Explosive Puppy Tutorial]
Step One:

Open up 'Dog.qc'.
Head down to line 43. You should see "void() Dog_Bite = ".
Alright, now just erase all of the code inside it, and add the new line, so that it looks like this:

void() dog_bite =
{
T_Damage(self,self,self,80); [color=red]//This is the line I added.

};[/color]

Basically what we just did was make it so that when the dog tries to bite someone, it is damaged and dies.

Step Two:

Now to line 65, where you should find "void() Dog_JumpTouch = ". We're going to do the same thing here as we did in the previous step.. so erase all of the coding inside Dog_JumpTouch, and add the line which calls the Dog_die function:

void() Dog_JumpTouch =
{
T_Damage(self,self,self,80); [color=red]//This is the line I added.

};[/color]

So now whenever the dog tries to attack, it is damaged and dies.

Step Three:

Haha, you still with me? Hope that didn't put you to sleep. It starts to get a "little" more interesting now. Let's make them puppies explode!
Go to line 229, where you will find "void() dog_die =". Erase all of the coding inside of this function. Now add the new bits:

void() dog_die =
{
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM); [color=red]//Added these line. Plays the gibbing sound.

ThrowGib ("progs/gib3.mdl", -50); //Throws a gib of the model 'gib3.mdl'.
ThrowGib ("progs/gib3.mdl", -50); //The second integer, "-50", affects the speed that the gib will fly.
ThrowGib ("progs/gib3.mdl", -50);
ThrowHead ("progs/h_dog.mdl", -50); //The same, but a head rather than a chunk of meat.
T_RadiusDamage(self, self, 50, self); //An area where damage is inflicted. In this order, the integers affect:
//(location of damage, inflictor, radius and how much damage is inflicted, person who's immune)

WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte(MSG_BROADCAST, TE_EXPLOSION);
WriteCoord(MSG_BROADCAST, self.origin_x);
WriteCoord(MSG_BROADCAST, self.origin_y);
WriteCoord(MSG_BROADCAST, self.origin_z);
BecomeExplosion (); //The first two of the above lines say "Make a temporary entity. Make the temporary entity an explosion.".
//The next three lines give the location of the explosion, and the "BecomeExplision ();" part tells our puppy to be invisible and unable to interact with anything (check it out in weapons.qc if you're interested).

};[/color]

Step Four:
Now to line 352, where you should find "self.health = 25". Change 25 to 1.
If you can't work out what that does, don't try and code a noose for yourself; the chances are, you won't be able to do that properly either. Ask me, and I'll send you one.

Well, that's just about it. Congratulations on completing your very first Mecha Explosive Puppy.

Conclusion:

They need to be fed twice a day, toast in the morning and canned food at night. You'll need to walk them occasionally, but watch that they don't blow themselves up on something.
Do NOT give them chew toys, as when they try to bite they blow up.

Kakesar Serion.

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: