News:

Come Chat with us live! Learn how HERE!

Main Menu

Cutsom HP Problem

Started by MJ, June 10, 2007, 10:02:10 AM

MJ

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.  :)
-MJ

benmachine

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

Undeference

Need help? Ask intelligently. Please share solutions you find.

Quote from: tuple on February 15, 2008, 11:54:10 PMThats what we need, helpful players, not more powerful admins.

.f0rqu3


MJ

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