[Solved] NPC doesn't inflict damage on attacks (npc_antlion)

Grab your favourite IDE and tinker with the innards of game engines

[Solved] NPC doesn't inflict damage on attacks (npc_antlion)

Postby Botolf on Fri May 24, 2013 7:13 am

So I've been poking around with this swarm-sdk-template 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 Botolf on Tue Jun 11, 2013 6:41 am, edited 1 time in total.
User avatar
Botolf
Regular
Regular
 
Joined: Sat Jan 16, 2010 7:38 am

Re: NPC doesn't inflict damage on attacks (npc_antlion)

Postby TechieUK on Fri May 24, 2013 2:59 pm

Maybe add it to skill.cfg?
Code: Select all
//Antlion
sk_antlion_health         "30"
sk_antlion_swipe_damage      "5"
sk_antlion_jump_damage      "5"
Also know as WILLAM; TechieUK is my old name. If you see WILLAM on Steam or ModDB, it's me.
User avatar
TechieUK
Regular
Regular
 
Joined: Sat Apr 13, 2013 4:29 pm

Re: NPC doesn't inflict damage on attacks (npc_antlion)

Postby Botolf on Fri May 24, 2013 4:36 pm

One of the lower hanging fruits already plucked, m'fraid. No damage with skill.cfg inactive or active (no damage with the values hardcoded as well).
User avatar
Botolf
Regular
Regular
 
Joined: Sat Jan 16, 2010 7:38 am

Re: NPC doesn't inflict damage on attacks (npc_antlion)

Postby TechieUK on Fri May 24, 2013 4:39 pm

Hmm... Can you make two of your antlions hate each other and see if they can kill each other?
Also know as WILLAM; TechieUK is my old name. If you see WILLAM on Steam or ModDB, it's me.
User avatar
TechieUK
Regular
Regular
 
Joined: Sat Apr 13, 2013 4:29 pm

Re: NPC doesn't inflict damage on attacks (npc_antlion)

Postby Botolf on Fri May 24, 2013 7:31 pm

Good idea. I have taught them how to hate, but they can't kill each other. Definitely seems like something I bungled on the animation or client/server end.
User avatar
Botolf
Regular
Regular
 
Joined: Sat Jan 16, 2010 7:38 am

Re: NPC doesn't inflict damage on attacks (npc_antlion)

Postby Botolf on Fri May 24, 2013 8:38 pm

Making some progress with the debugger, turning up some interesting spew in the console:

Code: Select all
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?).
User avatar
Botolf
Regular
Regular
 
Joined: Sat Jan 16, 2010 7:38 am

Re: NPC doesn't inflict damage on attacks (npc_antlion)

Postby [Steve] on Sat May 25, 2013 11:17 am

works okay for me, possibly your skill cfg isn't loading correctly try setting the skill values in game using their corresponding convars.
Also what do you mean about using nav meshes? the antlion uses the node based navigation system.
User avatar
[Steve]
Interlopers Staff
Interlopers Staff
 
Joined: Fri Mar 06, 2009 11:25 pm

Re: NPC doesn't inflict damage on attacks (npc_antlion)

Postby Botolf on Sun May 26, 2013 2:51 am

Same problem with the newest SFM models, confirmed via the debugger that CNPC_Antlion::MeleeAttack fails to meet its conditions, specifically at:
Code: Select all
if ( pHurt )


The definition for that check being
Code: Select all
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.


As to the second point, I thought that swarm NPCs used nav meshes, but I guess I'm mistaken.
User avatar
Botolf
Regular
Regular
 
Joined: Sat Jan 16, 2010 7:38 am

Re: NPC doesn't inflict damage on attacks (npc_antlion)

Postby Botolf on Tue Jun 11, 2013 6:41 am

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.
User avatar
Botolf
Regular
Regular
 
Joined: Sat Jan 16, 2010 7:38 am

Return to Programming

Who is online

Users browsing this forum: No registered users