Tremulous Forum
General => Troubleshooting => Topic started by: MJ on June 10, 2007, 10:02:10 am
-
I am currently developing a mod and have run into a slight glitch/error.
I changed the HP of a goon to 300.
Now, whenever the goon receives damage while its HP > 200, all clients except the goon hear the <25% pain sound.
That might be a little confusing...so...
If I'm attacking a goon and it has full health, when I deal damage to it, I hear <25% pain sound. Once its health gets below 200 you hear normal pain sounds again.
On the other hand, if I'm the goon I hear all the appropriate sounds for pain.
I don't get why this is happening because the client qvm is built with the correct defines. i.e. LEVEL3_HEALTH AHM(300)
Help is appreciated. :)
-
I think this is not because it is above its usual health, but because it has more than 256 health. This used to happen to tyrants if I remember correctly, but I can't remember what the fix is.
Start with CG_PainEvent in src/cgame/cg_event.c
It's called once in that same file and once in cg_playerstate.c
Trace where it is called and with what parameters.
-
g_active.c (http://svn.icculus.org/tremulous/trunk/src/game/g_active.c?rev=859&view=diff&r1=859&r2=858&p1=trunk/src/game/g_active.c&p2=/trunk/src/game/g_active.c)
-
client side?
-
Well, I fixed it.
In the g_active.c file, rather than using the SVN code, I patched it myself a little.
float percent = ( float )player-> health / ( float )player->client->pers.maxHealth * 100.0;
player->pain_debounce_time = level.time + 700;
G_AddEvent( player, EV_PAIN, ( int )percent );
This method actually works better than the SVN code, IMO. But, eh, what do I know? :P
Thanks for the help.