Raised This Month: $51 Target: $400
 12% 

Solved "Post" suffix - what's the difference??? (TraceAttack vs TraceAttackPost)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jlp1528
Junior Member
Join Date: Oct 2017
Old 10-13-2017 , 15:23   "Post" suffix - what's the difference??? (TraceAttack vs TraceAttackPost)
Reply With Quote #1

I have my suspicions as to the answer of this question, but would like some clarification. Currently I am reworking a suicide bomber plugin for Insurgency and using TraceAttack to get damage types and hitgroups. I would also like to use it to detect if you killed the bomber by comparing the damage done to him vs his health *before he was hit* for the "explode on death" chance. However, in testing, damage returned some ridiculous number. Yes, it was a headshot, but it was still stupidly high, like millions, clearly not the correct damage that was *actually* done. Would using TraceAttackPost instead return the *actual damage done* accurately? If not, what is the difference with the "Post" suffix? I see this on OnTakeDamage (which I used to use until I discovered TraceAttack) and other things as well...

Last edited by jlp1528; 10-18-2017 at 18:40.
jlp1528 is offline
NgBUCKWANGS
Senior Member
Join Date: Dec 2014
Old 10-13-2017 , 15:57   Re: "Post" suffix - what's the difference??? (TraceAttack vs TraceAttackPost)
Reply With Quote #2

TrackAttackPost comes after TraceAttack. It should be the very next thing to fire. It's up to you and what you're doing to figure it out but anything Post should literally fire right after anything else of the same name. You need to experiment to understand it but keep this in mind and you shouldn't be completely in the dark about it.
NgBUCKWANGS is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-13-2017 , 15:59   Re: "Post" suffix - what's the difference??? (TraceAttack vs TraceAttackPost)
Reply With Quote #3

As a general rule, you use the normal or Pre version if you need to change something and/or block something from happening. You use the Post version if you just need to know when it successfully occurred.

OnTakeDamage also has a third version, OnTakeDamageAlive which happens after damage adjustments have been done (armor in CSS/CSGO, critical hits in TF2) but before the damage is actually dealt. The Pre version of OnTakeDamage is before damage adjustment has happened.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 10-13-2017 at 16:02.
Powerlord is offline
jlp1528
Junior Member
Join Date: Oct 2017
Old 10-13-2017 , 16:15   Re: "Post" suffix - what's the difference??? (TraceAttack vs TraceAttackPost)
Reply With Quote #4

Okay, further testing revealed that post made no difference, but somehow it worked correctly anyway, despite the damage being reported incorrectly in a debug chat message. I'll just use the normal version in case I decide to modify anything. I doubt I will, but I guess you never know.

Great that I can use this one function in conjunction with others inside to do literally anything I want with checking damage type, amount, and hitgroup!
jlp1528 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-13-2017 , 16:41   Re: "Post" suffix - what's the difference??? (TraceAttack vs TraceAttackPost)
Reply With Quote #5

Quote:
Originally Posted by jlp1528 View Post
Okay, further testing revealed that post made no difference, but somehow it worked correctly anyway, despite the damage being reported incorrectly in a debug chat message. I'll just use the normal version in case I decide to modify anything. I doubt I will, but I guess you never know.

Great that I can use this one function in conjunction with others inside to do literally anything I want with checking damage type, amount, and hitgroup!
Were you trying to print it using the wrong type? If you try to print a float using %d or %i, you'll get a number that is way off.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 10-13-2017 at 16:41.
Powerlord is offline
jlp1528
Junior Member
Join Date: Oct 2017
Old 10-13-2017 , 16:48   Re: "Post" suffix - what's the difference??? (TraceAttack vs TraceAttackPost)
Reply With Quote #6

LOL, oops, yeah, tried %d. So %f?
jlp1528 is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 10-14-2017 , 16:08   Re: "Post" suffix - what's the difference??? (TraceAttack vs TraceAttackPost)
Reply With Quote #7

Quote:
Originally Posted by jlp1528 View Post
LOL, oops, yeah, tried %d. So %f?
Use %d/%i to print out 'int' values and %f (or %.xf where x are the numbers after the '.') to print out 'float' values
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!
Papero 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 11:51.


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