Author Topic: Cutsom HP Problem  (Read 2843 times)

MJ

  • Posts: 2
  • Turrets: +0/-0
Cutsom HP Problem
« 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.  :)
-MJ

benmachine

  • Posts: 915
  • Turrets: +99/-76
    • ben's machinery
Cutsom HP Problem
« Reply #1 on: June 10, 2007, 01:34:32 pm »
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

  • Tremulous Developers
  • *
  • Posts: 1254
  • Turrets: +122/-45
Cutsom HP Problem
« Reply #2 on: June 10, 2007, 04:37:49 pm »
Need help? Ask intelligently. Please share solutions you find.

Thats what we need, helpful players, not more powerful admins.

.f0rqu3

  • Guest
Cutsom HP Problem
« Reply #3 on: June 10, 2007, 07:12:45 pm »
client side?

MJ

  • Posts: 2
  • Turrets: +0/-0
Cutsom HP Problem
« Reply #4 on: June 11, 2007, 09:14:46 am »
Well, I fixed it.
In the g_active.c file, rather than using the SVN code, I patched it myself a little.
Code: [Select]

    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