HLFX.Ru Forum
Показать все 5 сообщений этой темы на одной странице

HLFX.Ru Forum (https://hlfx.ru/forum/index.php)
- Half-Life SDK (https://hlfx.ru/forum/forumdisplay.php?forumid=8)
-- Problem with frags (https://hlfx.ru/forum/showthread.php?threadid=3000)


Отправлено MisterDeath 14-09-2011 в 22:50:

Problem with frags

Well guys the problem is that what happens is that when I kill a zombie this gives me a point but if I keep shooting the zombie that still gives me point ... until it falls down and gets quiet

Someone fix the code to make it work well?

Sorry bad english...


C++ Source Code:
1
void CZombie :: Killed( entvars_t *pevAttacker, int iGib )
2
{
3
  ClientPrint( pevAttacker, HUD_PRINTCENTER, "Killed zombie, you win 1 point!" );
4
 
5
  CBaseEntity * ep = CBaseEntity:: Instance (pevAttacker);
6
  CBasePlayer * PK = (CBasePlayer *) ep;
7
 
8
  PK-> AddPoints (1, false); // give one fuck point
9
 
10
  CBaseMonster::Killed( pevAttacker, iGib );
11
}


__________________
hl 4 ever


Отправлено Ku2zoff 15-09-2011 в 08:31:

MisterDeath try to add checking for deadflag.

C++ Source Code:
1
void CZombie :: Killed( entvars_t *pevAttacker, int iGib )
2
{
3
  if (pev->deadflag == DEAD_DEAD)
4
    return;
5
 
6
  // blah blah blah
7
}

or for pev->health level
C++ Source Code:
1
void CZombie :: Killed( entvars_t *pevAttacker, int iGib )
2
{
3
  if (pev->health <= 0)
4
    return;
5
 
6
  // blah blah blah
7
}


Добавлено 15-09-2011 в 15:31:

I think pev->health checking is right way. If I'm not mistaking, pev->deadflag DEAD_DEAD is installed when the monster's "die" animation is finished.


Отправлено MisterDeath 15-09-2011 в 13:45:

Works but...

points if he continues to follow while giving the animation shooting death

__________________
hl 4 ever


Отправлено Ku2zoff 15-09-2011 в 14:31:

MisterDeath well, try to move your "Point giving" code into another function in CZombie class... HandleAnimEvent maybe? Add new event for "die" animations in zombie's model at frame 1, for example and call your code from HandleAnimEvent. But you'll need to get a killer's edict somehow from that function...


Отправлено MisterDeath 15-09-2011 в 14:36:

i solved, used UTIL_Remove and added bodysplat effect... is other alternative...

__________________
hl 4 ever


Временная зона GMT. Текущее время 16:02.
Показать все 5 сообщений этой темы на одной странице

На основе vBulletin версии 2.3.0
Авторское право © Jelsoft Enterprises Limited 2000 - 2002.
Дизайн и программирование: Crystice Softworks © 2005 - 2024