[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.