This member has provided no bio about themself...

Comment History
farbin
farbin - - 3 comments @ Push and Pull

Careful!
Both of your functions for Push and Pull are named void Cmd_Push_f (edict_t *ent), you just changed the VectorScale value.
error C2084: function 'void __cdecl Cmd_Push_f(struct edict_s *)' already has a body

And, no, your laser code does not work:
tr = gi.trace (from, NULL, NULL, end, self, MASK_SHOT);
error C2065: 'from' : undeclared identifier
error C2065: 'self' : undeclared identifier
error C2109: subscript requires array or pointer type
error C2198: 'gi' : too few actual parameters

As for the ammo requirment:
error C2113: pointer can only be subtracted from another pointer.

So, if you don't add any of the additional modifications, the Push/Pull functions work fine.

farbin

Good karma+1 vote
farbin
farbin - - 3 comments @ Ejecting Shells

While I was happy to find this tutorial and enjoy a good challenge,I found that it did not work "Out-Of-The-Box".
So, I though that I would share my findings.

1.) There needs to be the following line in g_local.h so that the function can be found by other parts of the program:

after this ....

//
// g_misc.c
//
void ThrowHead (edict_t *self, char *gibname, int damage, int type);
void ThrowClientHead (edict_t *self, int damage);
void ThrowGib (edict_t *self, char *gibname, int damage, int type);

add this ...

// ejecting shells
void MachShell (edict_t *self, char *gibname, int damage, int type);

2.) In p_weapon.c, in the function void Machinegun_Fire (edict_t *ent), (somewhere near the end of that function) there should be some way to let the program know that you want the machine gun to spew out the shells. I added this (although not sure if the placement is in the exact spot it should be):

after this ...

PlayerNoise(ent, start, PNOISE_WEAPON);

add this ...

// ejecting shells
MachShell (ent, "models/weapons/shell/tris.md2", damage, GIB_ORGANIC);

3.) and since I specified what model to use in the above line, I removed ...

//gibname = "models/weapons/shell/tris.md2";

from the function ...
void MachShell (edict_t *self, char *gibname, int damage, int type

Compile and watch the shells fly.
Thanks for the mental workout. I got to know the code a little better.

farbin

Good karma+2 votes
farbin
farbin - - 3 comments @ Climbing - Hard to reach places?

Hmm, more great code ideas, sadly, this tutorial is missing a few important lines of code. So, I had to go out and get the source for DirtyQ2 and find what was missing.

There needs to be a way to activate the climbing routines when you want to climb.

1.) In g_misc.c, the following should be added:

after the end of this function ...

void ThrowClientHead (edict_t *self, int damage)

add these 2 functions ...

/*
==============
Cmd_Action_On
==============
*/
qboolean Grab_n_Climb (edict_t *ent);

void Cmd_Action_On (edict_t *ent)
{
if (ent->deadflag || (ent->movetype == MOVETYPE_NOCLIP))
return;

// If weapon idle...
if (ent->client->weaponstate == WEAPON_READY)
{
// If jumping/falling etc
if (Grab_n_Climb (ent))
{
//ent->client->hanging = true;
return;
}
}
// On
ent->client->pers.grabbing = 1;
}

/*
==============
Cmd_Action_Off
==============
*/
void Cmd_Action_Off (edict_t *ent)
{
if (ent->client->pers.grabbing != 2)
// Off
ent->client->pers.grabbing = -1;
}

2.) Now, you will have to add the following to g_local.h:

in client_persistant_t (somewhere at the end) add ...

int grabbing;

and in struct gclient_s (again, somewhere near the end) add these:

qboolean hanging;
vec3_t hang_point;
float flip_time;

3.) Now, in g_cmds.c you need to add the commands to activate the climbing (the Action_On and Action_Off added previously). So,at the end of void ClientCommand (edict_t *ent), add these:

before ...

else // anything that doesn't match a command will be a chat
Cmd_Say_f (ent, false, true);

add ...

else if (Q_stricmp(cmd, "action_on") == 0)
Cmd_Action_On(ent);
else if (Q_stricmp(cmd, "action_off") == 0)
Cmd_Action_Off(ent);

4.) And the last peice of this would be to add your binds to your .cfg file (just to make life easier). For example:

add ...
alias action "action_on"
alias action_on "action_on;alias action "action_off"
alias action_off "action_off;alias action "action_on"
bind o "action"

or whatever key you which to use.

Additionally, you can fiddle with the value in the line

check = (260 - plusup);
(located in qboolean Grab_n_Climb (edict_t *ent))

to make your player climb faster/slower (more/less force).

farbin

p.s. Sorry, not trying to be a jerk, it just irritates me when a tutorial doesn't work or parts are missing. On the other hand, it makes me actually look at the source and not just copy-n-paste so, I learn a lot more.

Good karma+1 vote