Problem modifying old code


After borrowing some code from the Alternate Fire mod, I achieved 99% of my current goals.
I re-purposed Niel “Haste” Toronto’s hologram… After carefully familiarizing myself with Niel’s work, the hologram became something else… worked perfectly… except for one small problem.
What I needed it to do at a crucial moment… when the ‘hologram’, now ‘safeplayer’ dies, the original player who spawned it wasn’t supposed to die. The original player dies…
I’ve worked on this for four months, and everything I try does NOTHING.

From the original code I found this snippet…

PlayerProxy_Die( gentity_t *ent, gentity_t *inflictor, gentity_t *attacker, int damage, int mod )

It is supposed to kill the ‘player proxy’ and not the player, but isn’t used… it doesn’t seem to do anything when I try to work the code into my mod. The damage goes through G_Damage, and when the proxy dies, the player dies.
If there’s anyone who is familiar with Alternate Fire source, or thinks they can lend a helping hand to this problem, I’ll be happy to post code.
This project is just a warmup, I’m still learning. The final project will, hopefully, be a new angle concerning protection against Q3 cheaters who are using aimbots and wallhacks, as well as a ‘panic button’ for noobs.
This is, as opposed to coding strategies involving blocking the cheats themselves. I have a couple visions, and would like to see them come to fruition, in hopes of finding out if the community would accept this kind of ‘cheat protection’. But more for my main mod project, which, I feel, will require a ‘panic button’.
Thanks in advance for your consideration.


if the player dies, this means that at some point, G_Damage() gets pointed at the player, and not the hologram / player proxy. (I don’t know anything about the “alternate fire” mod). Go through all the proxy entity code and try to find where something still points towards the original player …


You rock sir. Between you and some gaming buddies in Q3, I just might get something going here.
I’ll give this a go and let you know if it works. THANK YOU!


Over the years, I seemed to develop good instincts as far as changing and manipulating code… it is still a tremendous challenge to write code and even to decipher code into something I can understand.
Going over the code, and bearing in mind what you mentioned… as well as what’s in G_Damage, I’ve found it difficult to make changes that work.
Here is some of the most significant part of the original code.

// create a player proxy so people can shoot it and damage the player
proxy = G_Spawn();
proxy->s.eType = ET_PLAYER_PROXY;
proxy->r.svFlags = SVF_USE_CURRENT_ORIGIN;
proxy->classname = "playerproxy";
proxy->lastthinktime = ent->client->ps.powerups[PW_HOLOGRAM];
proxy->lastthink = LastProxyThink;
proxy->r.ownerNum = ENTITYNUM_WORLD;
proxy->s.otherEntityNum = ent->s.number;
proxy->s.time = level.time;
proxy->parent = NULL;
proxy->takedamage = qtrue;
proxy->health = 100000;
proxy->die = PlayerProxy_Die;

proxy->clipmask = MASK_PLAYERSOLID;
proxy->r.contents = CONTENTS_BODY;
VectorCopy (ent->r.mins, proxy->r.mins);
VectorCopy (ent->r.maxs, proxy->r.maxs);

proxy->physicsObject = qtrue;
proxy->physicsBounce = 0.2f;
proxy->s.pos.trType = TR_GRAVITY;
VectorCopy( ent->r.currentOrigin, proxy->s.pos.trBase );
VectorCopy( ent->r.currentOrigin, proxy->r.currentOrigin );
proxy->s.pos.trBase[2] += 1.0f;
proxy->r.currentOrigin[2] += 1.0f;
VectorCopy( ent->client->ps.velocity, proxy->s.pos.trDelta );
proxy->s.pos.trTime = level.time;

VectorCopy( ent->client->ps.viewangles, proxy->s.apos.trBase );

trap_LinkEntity( proxy );

My first idea was to change ent to self, but selectively. So far, I’m having trouble, and It seemed some parts of the code would still need to point to ent. But it seems like I’m guessing. I broke out the book on MOD programming in Quake 3, but this is new territory, and is unique. There doesn’t seem to be any close examples, it’s not like a created entity like a missile…
I’m not looking for someone to solve this, but maybe just break it down simply, I don’t mind juggling entities and pointers, but it’s good to have a little guidance.


Can you write clearly write down what you want to achieve ? I’m a bit lost.


I think you were right on the nose. There seems to be a tie from the proxy
to the client.

If you could point out which part of the code is the client, and what is ‘pointing’ to it.

I’d like to do as much as I can on my own, to separate the proxy from the client seems
simple… just seems like I’m missing what ties them together.
I suppose what I’m trying to do is have the client unaffected by any attacks on the proxy.
The idea behind this proxy is to protect the client, and yet not be all-powerful like a
client in god mode. Sort of a demigod mode.

In the end, this first stage of the project is just mean’t to protect the user from ‘cheaters’.
The ‘panic’ button can be pushed, the proxy is created, the player can feel ‘safer’,
and face someone in the game who is using an aimbot, and not worry about being

This is in contrast to the failure of most cheat protection schemes that I’ve seen.
Eventually, if this worked, I’d like it to evolve into a way to separate noob’s
and lesser skilled players optionally if they want. I see a game with two games in one,
one with super skilled players and cheaters, and one with the lesser skilled players
protected from the others, as this is difficult to achieve with games as they are.

Hope this makes things clearer.