I was a bit off with what I said, the death thing I was thinking about is actually a task set called TASK_DIE and it handles the wait cycle for the NPC while it does its death animation.
Find this function in ai_basenpc_schedule void CAI_BaseNPC::RunDieTask() { AutoMovement(); if ( IsActivityFinished() && GetCycle() >= 1.0f ) { m_lifeState = LIFE_DEAD; SetThink ( NULL ); StopAnimation(); ............... You will notice IsActivityFinished() there, that is how it waits for the death animation to complete. It will run this task until the time in which it is safe to stop thinking. You can see there the think is set to NULL, overriding this function should help you set a new think instead of nothing which you can add your timer too. Also keep in mind if the NPC turns into a ragdoll on the client, the NPC itself will be destroyed along with the chance to think. On Fri, Jul 3, 2009 at 2:36 AM, Biz <b...@cs-dsf-clan.de> wrote: > Heya, > > > When an NPC becomes a ragdoll it is essentially an independent object to > the > > npc and generally one that is generated client-side versus server-side. > If > > you are trying to remove the corpse after 5 seconds then you may need to > be > > looking for the ragdoll entity then. > > > > Chris > > > Thanks for the hint, but my NPC is not becoming a ragdoll. I think a > ragdoll would cost too much performance as i'm working with many NPCs. > That's why i only have them play simple death animations. > > > Instead of removing the npc go to the client side ragdoll in > > c_baseanimating and have it remove itself after 5s. If you aren't > > using a ragdoll and just animations, then you need to look in > > combatcharacter for a deadthink function or something similar and add > > your timer there. By setting the think on your npc, you are taking > > away the natural thinking process that contains the wait for death > > animation completion stuff. Hope this helps. > > > > ~Ryan / skidz > Ryan: What you described with the death-think function is exactly what > i'm trying to figure out. I'm looking for what you called the "natural > thinking process that contains the wait for death animation completion > stuff". I need to find exactly that function, but i'm having trouble > with it ;) Thanks for the hint though. > > Regards from Germany > xs57 > > > -----Original Message----- > > From: hlcoders-boun...@list.valvesoftware.com > > [mailto:hlcoders-boun...@list.valvesoftware.com] On Behalf Of Biz > > Sent: Thursday, July 02, 2009 10:41 AM > > To: hlcoders@list.valvesoftware.com > > Subject: [hlcoders] Remove corpse 5s after NPC death > > > > Hi list, > > > > i've ported my mod to ob-engine and now my NPC corpse fade after 5 > > seconds isn't working anymore. Does anyone have an idea what the last > > function that is called after NPC death is? When i try to define a new > > think-function Dying() at the end of the Event_Killed() function like: > > SetThink( &Bla::Dying ); > > SetNextThink( gpGlobals->curtime + 5.0f ); > > > > void Dying() > > { > > UTIL_Remove(this); > > } > > > > This works, but my death animation won't play anymore then. That is if i > > kill an NPC it just freezes and disappears after 5s. > > > > So i would either need a command that resumes my animation or i would > > have to know which function is called after death. I've tried figuring > > it out myself, but i didn't find it. > > > > Any help greatly appreciated :-) > > > > > > Greets from Germany > > xs57 > > > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view the list archives, > > please visit: > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > > > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > -- ~Ryan ( skidz ) _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders