Raised This Month: $32 Target: $400
 8% 

Solved TF2 Get entity of fired projectile


Post New Thread Reply   
 
Thread Tools Display Modes
Cieniu97
Junior Member
Join Date: Sep 2021
Location: Poland
Old 10-14-2021 , 05:07   Re: TF2 Get entity of fired projectile
Reply With Quote #11

Wouldn't OnEntityCreated fire hundreds of thousands times during the game? Using OnTakeDamage it fires only when I need the info, and its much simpler as u dont have to track the entities, you just take entity for &inflictor, check if it has m_hOriginalLauncher and be done with it
Thanks for the offer, I don't want to bother u personally. If any troubles arise over the horizon I will post it on forum so the knowledge is spread to new generation like me :>
Cieniu97 is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 10-14-2021 , 06:31   Re: TF2 Get entity of fired projectile
Reply With Quote #12

Quote:
Originally Posted by Cieniu97 View Post
Wouldn't OnEntityCreated fire hundreds of thousands times during the game? Using OnTakeDamage it fires only when I need the info, and its much simpler as u dont have to track the entities, you just take entity for &inflictor, check if it has m_hOriginalLauncher and be done with it
Thanks for the offer, I don't want to bother u personally. If any troubles arise over the horizon I will post it on forum so the knowledge is spread to new generation like me :>
Hundreds of thousands of times no in fact I would think ontakedamage fires alot more than onentitycreated...I don't imagine most of the weapons in TF2 actually shoot projectile entities. That would be inefficient as all hell on their part. You can test it by hooking both and creating counters in each just to see. which fires more in a match. i'm betting its ontakedamage. Good Luck.

Last edited by MasterMind420; 10-14-2021 at 06:37.
MasterMind420 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-14-2021 , 12:15   Re: TF2 Get entity of fired projectile
Reply With Quote #13

funny, I just noticed.

On OnTakeDamage callback, inflictor can return as weapon entity index or projectile entity index.

For example medic shoot tf_projectile_syringe, inflictor is tf_weapon_syringegun_medic
Demoman shoot tf_projectile_pipe and inflictor tf_projectile_pipe
__________________
Do not Private Message @me
Bacardi is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 10-14-2021 , 12:45   Re: TF2 Get entity of fired projectile
Reply With Quote #14

Quote:
Originally Posted by Bacardi View Post
funny, I just noticed.

On OnTakeDamage callback, inflictor can return as weapon entity index or projectile entity index.

For example medic shoot tf_projectile_syringe, inflictor is tf_weapon_syringegun_medic
Demoman shoot tf_projectile_pipe and inflictor tf_projectile_pipe
good catch...i never really used inflictor from ontakedamage other than maybe getting the entity on a map that inflicts fire damage in l4d2. if ontakedamage works better for u, u could try ontakedamage post or alive hook, just a thought.
MasterMind420 is offline
Cieniu97
Junior Member
Join Date: Sep 2021
Location: Poland
Old 10-14-2021 , 13:03   Re: TF2 Get entity of fired projectile
Reply With Quote #15

Quote:
Originally Posted by Bacardi View Post
funny, I just noticed.

On OnTakeDamage callback, inflictor can return as weapon entity index or projectile entity index.

For example medic shoot tf_projectile_syringe, inflictor is tf_weapon_syringegun_medic
Demoman shoot tf_projectile_pipe and inflictor tf_projectile_pipe
Yeah and it can return multiple other things as well. Its a hot mess. You even have tf_projectile_sentryrocket. And it doesnt really returns weapon entity, more like player when it comes to hitscan weapons.
Cieniu97 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode