Jump to content
johnnyboy

Agent HandleDamage eventhandlers don't return Source (who shot them)

Recommended Posts

UPDATE:

  • Agent Killed event handlers DO return source (unit who killed them).
  • Agent HandleDamange handlers DO NOT return source (unit who caused damage).


I can use the Killed EventHandler, so my problem is solved.

 

Original problem statement:

Goddamn chickens are pissing me off.  I have a scenario where player and AI unit are hunting chickens in a field, and I want to keep score of  how many flying chickens were killed by each.   Here's the problem:

  • Chickens created as Agents, play walking and pecking animations so look natural.  That is good!  But their HandleDamage and Killed eventhandlers do not return a value in Source, so I can't credit the unit who killed it.  Bad!
  • Chickens created as Vehicles do NOT play walking and pecking animations.  Bad!  But their HandleDamage and Killed eventhandlers DO return a value in Source.  Good!

 

My workaround was to attach a vehicle chicken to the walking Agent chicken, and use the vehicle chicken's eventhandler for crediting shooter.  That works about 70% of the time.  But the other 30%, the Agent chicken is killed and attached vehicle chicken is not killed, so shooter does not get credit for the kill.

 

Is there a way to play the chicken Agent  behavior FSM on  the Vehicle chicken, so it has the same brain as an Agent chicken?  How would I do that?

 

I may end up recording timestamps for shots fired per units, and compare with Agent Killed timestamps and credit unit with closest timestamp.  But if I can get a vehicle chicken to behave like an agent chicken that would be cleaner.

Share this post


Link to post
Share on other sites

Sorry I can't help here JB, but that is one surreal post. ^^ Awesome dude!

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, johnnyboy said:

But if I can get a vehicle chicken to behave like an agent chicken that would be cleaner.

 

Mmmm.....

 

Spoiler

b88d02ea10cbece743c018205ed0d3c1--weird-

 

  • Like 1
  • Haha 2

Share this post


Link to post
Share on other sites

Do their handledamage EHs at least return the projectile ? If so, you could get the owner of that.

Share this post


Link to post
Share on other sites

I wonder how the zombies in Ravage work?  I believe they are created as agents.  It shows you how many you've killed in the score table when you've died.  (Maybe its just because they aren't chickens?)

Share this post


Link to post
Share on other sites

@Tajin and  @FireWalker thanks for your thoughts on this.  But I was WRONG!  (first time that has ever happened to me).

 

Killed EventHandler DOES include source (shooter) for Agents so my  problem is solved.  Damaged EventHandler does NOT return source/shooter, but I only use that for the "poof of feathers" effect when hit.  Yay, I can move on.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×