Sibylus 24 May, 2013 @ 12:14am
[Solved] NPC doesn't inflict damage on attacks (npc_antlion)
So I've been poking around with this swarm-sdk-template[code.google.com] project, with npc_antlion grafted into the mix as a proof-of-concept (on source 2007 atm but eyeing perf improvements, as well as stuff like biohazard's deferred lighting) unit. I've seemingly gotten the important stuff working (model, materials, sounds, hates player, runs around, attacks me) except in two respects:


  • Attacks inflict no damage whatsoever, and the associated view punch is also missing. My first guess is that the code is directing those effects at the wrong given player entity (I lifted it wholesale from HL2 2007), though also possible is that somewhere along the line I messed up animation events or something (though the attack anims play just fine). Also possible I suppose is that the damage/viewpunch aren't being felt at the client level? Could use some suggestions as to adjustments.
  • Doesn't appear to use the navigation meshes (unsure if this is simply the NPC needing to be set up for use of such [being that it originally used a node graph in the hl2 games], or the nav mesh needing special flags for such)

Naturally the first problem is far more game-breaking at this point, but the second is also something I'd like to address one way or another down the line.
Last edited by Sibylus; 10 Jun, 2013 @ 11:41pm
< >
Showing 1-5 of 5 comments
Sandern 24 May, 2013 @ 12:04pm 
For your no damage problem, make sure "sk_antlion_swipe_damage" is set to something else than zero. Normally it's read from skills.cfg. If you think it does no damage because of messed up animation events, just set a breakpoint in CNPC_Antlion::MeleeAttack and see if it's called.

For you second problem, hl2 (and asw) npcs do not use the navigation mesh.
Sibylus 24 May, 2013 @ 1:36pm 
Thanks for the reply, the debugger's turning up some interesting spew in the console:

Unhandled animation event AE_ANTLION_START_JUMP for npc_antlion

With variants for each and every one of the Antlion's animation events (perhaps a problem with the model?). CNPC_Antlion::MeleeAttack is called successfully.


And ah, coulda sworn asw npcs used mesh, but I spose I'm mistaken.
Sibylus 25 May, 2013 @ 7:56pm 
Same problem with the newest SFM models, confirmed via the debugger that CNPC_Antlion::MeleeAttack fails to meet its conditions, specifically at:
if ( pHurt )

The definition for that check being
CBaseEntity *pHurt = CheckTraceHullAttack( distance, -Vector(16,16,32), Vector(16,16,32), damage, DMG_SLASH, 5.0f );

Kinda just going through an en masse include frenzy now to make sure I've left no unturned stones.
Sandern 27 May, 2013 @ 12:09pm 
From looking at that sdk template, you might want to check CSDKPlayer::OnTakeDamage. If that function gets called on being attacked by an antlion, then the problem is in CSDKPlayer. It might filter the damage away.
Sibylus 10 Jun, 2013 @ 11:41pm 
Solved! I stupidly inflicted this on myself by initially being hasty and trying to recreate the old animation event system ( animevent_t event ), instead of moving the antlion over to the newer event system employed in Alien Swarm ( animevent_t Event() ). The Antlion's animation events are no longer unhandled and it inflicts damage as it should.
< >
Showing 1-5 of 5 comments
Per page: 1530 50