
Posted by RaVeN on January 14, 1999 at 15:10:35:
this is how we do the
standard off-handed graple in the Viking mod. hope it helps(i used seperate
grapple.c/h files to keep down any confusion)
Here Goes
1st , basically copied over the fire grapple commands to a "new" file
.
I called it grapple.c then added "new commands to fire and release.of
cource you
can do whatever works best for you and your mod.
//grapple
#include "g_local.h"
#include "grapple.h"
void CTFGrappleFire (edict_t *ent, vec3_t g_offset, int damage, int effect);
void firegrapple (edict_t *ent)
{
if ((ent->solid != SOLID_NOT) && (ent->deadflag == DEAD_NO))
{
if (ent->client->pers.weapon != FindItem ("Grapple"))
CTFGrappleFire (ent, vec3_origin, 10, 0);
else gi.cprintf (ent, PRINT_HIGH, "Off-Handed Grapple is not
avaliable.\n");
}
return;
}
void
CTFPlayerResetGrapple(edict_t *ent);
void resetgrapple (edict_t *ent)
{
if ((ent->solid != SOLID_NOT) && (ent->deadflag == DEAD_NO))
{
CTFPlayerResetGrapple(ent);
}
return;
}
-----------------------------------------------------
Then i made a header file for the grapple...thus grapple.h
void grapplefire (edict_t *ent);
void resetgrapple (edict_t *ent);
-----------------------------------------------------
Easy enough so far
.....next we aded to the g_cmds file ...in the client cmds section..
// offhanded hook
else if (Q_stricmp (cmd, "grapplefire") == 0)
grapplefire (ent);
else if (Q_stricmp (cmd, "resetgrapple") == 0)
resetgrapple (ent);
//offhanded hook end
While we are here we need
to add #include "grapple.h" to the begining of the file..
-----------------------------------------------------
Now / in p_client.c right after:
// make sure all view stuff
is valid
ClientEndServerFrame (ent);
but before :
/*
===========
ClientBegin
called when a client has
finished connecting, and is ready
to be placed into the game. This will happen every level load.
============
*/
add the following "stuffcmds"
// commands for offhanded
hook
Stuffcmd (ent, "alias +hook \"grapplefire\"; alias -hook
\"resetgrapple\";");
// end
}
-------------------------------------------------------------------------
have your clients "bind a key" to "+hook" to use ..
Thats about it ...
The grapple will work with but not at the same time as the original grapple.
The reason I like this the best is that it doesn't alter or replace
the original grapple..it just enhances it...If you try to use both grapple's at
the same time it will simply .
print Off-handed grapple not avaliable...it will still use your new grapple
cvars also ....
---------------------------------------------------
laterz
RaVeN