Quake 2 is another classic from id software.While not modded quite as much as it's predecessor or Q3A, it is still a blast to play and the mod's on offer are bundles of fun. Just step into Quake 2 Rocket Arena, armed with the new and almighty rocket and rail gun and you will be gibbing for hours on end.If you dig fast paced action, then load up the good ole Quake 2, fire up a mod or two and have some fun!

Post tutorial Report RSS Suck the life out of them, literally

This mini-mod will show you how to use the parasite's drain life attack. This tutorial also shows you that monster attacks work with players, too!

Posted by on - Basic Client Side Coding

[page=Starting]
Open your compiler, and get open your source files!

[page=Command]

Open g_cmds.c, and head right to the bottom.

After

else if (Q_stricmp (cmd, "wave") == 0)
        Cmd_Wave_f (ent);

Add:

else if (Q_stricmp (cmd, "drop") == 0)
        Suck (ent);

Also, at the top of the page after the includes, add:

void parasite_drain_attack (edict_t *self);

Now, add this before void ClientCommand:

void Suck(edict_t *ent) 
{
        vec3_t end,forward;
        trace_t tr;
 
        VectorCopy(self->s.origin,end);
        AngleVectors (ent->client->v_angle, forward, NULL, NULL);
        end[0]=end[0]+forward[0]*250;
        end[1]=end[1]+forward[1]*250;
        end[2]=end[2]+forward[2]*250;
 
        tr = gi.trace (ent->s.origin, NULL, NULL, end, ent, MASK_SHOT);
        if(tr.ent != NULL) 
        {
               ent->enemy=tr.ent;
               parasite_drain_attack(ent);
        }
}

Also, another thing you may want to do is get health for the attack. Head to the function parasite_drain_attack, and under T_Damage, add:

self->health=self->health+damage;

Mind you, It's something I threw together, I have not tested it myself. Check it and mail me the results, I will test it in a days time.

Post a comment

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