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

TF2 Critical Hits Oo


Post New Thread Reply   
 
Thread Tools Display Modes
Tauphi
SourceMod Donor
Join Date: Sep 2004
Location: Germany
Old 11-20-2007 , 15:55   Re: TF2 Critical Hits Oo
Reply With Quote #11

http://www.mrlwork.com/downloads/TFTrue/TFTrue-1.1.rar
here it is

the "default" crit chance seems to be 0.05 ...
Tauphi is offline
Send a message via ICQ to Tauphi Send a message via Skype™ to Tauphi
RedComet
Junior Member
Join Date: Dec 2005
Old 11-22-2007 , 03:03   Re: TF2 Critical Hits Oo
Reply With Quote #12

hey guys, instead of disassembling my plugin to figure out how it works I can just tell you ;p

Bailopan has helped me a lot with misc things here or there and I am a long timer lurker here

So anyway, my plugin does a simple sig scan to find the places in the program that use the crit multipliers. I find the offset of the instruction such as
'fmul flt0985849'
ever since the nov 7 update the crit chances have been moved from cvars to static data memory and this address just references the location. My plugin changes the address it references to a variable I control. So that any change to my variable is reflected in the calculate critical code. The cvars simply set my variable.

As far as your specific problem, I am not 100% but I am PRETTY sure players do not have their own crit chances. But I can offer you a possible solution. If I wanted to do this this is what I would do.

I would first do what I did and find the crit chance variables. Then I would replace those addresses with variables I control, just like in the real plugin. Here is where things get tricky. I would hook the CalcIsAttackCriticalHelper function (this is the function that, among other things, calculates if its a crit) for both melee and weapons and I do believe that DamageInfo variable it passes holds the attacker's pointer... But I would use that, cross reference it with my own player pointers to find out what crit chance the player should have, and set my crit variable to that value. Then return to the CritcalHelper function and let it execute with the 'correct' crit chance.

Every time a player fire's your plugin's hook will get called and the crit chance variable will change to whatever that player should have at that point in time.

It sounds like a cool idea, but of course I dont ever plan to actually implement something like this ;p But theoretically I think that might be the best, if not the only solution for you.

That being said I do not know the extent of this scripting language so that might not even be possible in this scenario, but if I was writing a real source plugin thats what I would do.

Last edited by RedComet; 11-22-2007 at 03:08.
RedComet is offline
BAILOPAN
Join Date: Jan 2004
Old 11-22-2007 , 10:00   Re: TF2 Critical Hits Oo
Reply With Quote #13

RedComet: Thank you for sharing how your plugin works! It sounds like you spent a decent bit of time researching and implementing it if you had to go to that level.

Indeed, that would require a TF2 extension in C++, it's too much for a script (unless someone actually wants us to expose memory editing natives from SDKTools). I think a TF2 extension is on the horizon so I'll keep this thread in mind when we tackle it.
__________________
egg

Last edited by BAILOPAN; 11-22-2007 at 10:10.
BAILOPAN is offline
WoZeR
Donor
Join Date: Nov 2007
Old 01-16-2008 , 18:42   Re: TF2 Critical Hits Oo
Reply With Quote #14

Quote:
Originally Posted by Tauphi View Post
ok i tested it a little bit ...

PHP Code:
new offset FindSendPropOffs("CTFPlayer""m_iCritMult"); 

LogMessage("CritMult: %d"GetEntData(clientoffset4)); 
the results are the maxiumum health points of my class ... 125 as scout, 200 as soldier and 300 as heavy ...

the the prop list i found the following with "crit" included:
PHP Code:
CTFGrenadePipebombProjectile m_bCritical
CTFProjectile_Rocket m_bCritical
CTFProjectile_SentryRocket m_bCritical
CTFWeaponBaseGrenadeProj m_bCritical
CTFMinigun m_bCritShot
CTFFlameThrower m_bCritFire
CTFPlayer m_iCritMult 
bCritShot and bCritFire are sometimes 1 or 2 ... the others are 0 ... i changed the numbers of all values a lot of times in different values ... no effect ...

any idea how to change the crit chance for a player now? :-/


there a is mod called "TFTrue", which supports cvars to change it global:
PHP Code:
tftrue_crit_multiple
    The multiple used 
for applying crits (normally x3)

tftrue_crit_chance
    The chance to 
do critical damage (decimal percentage)

tftrue_melee_crit_chance
    The chance to 
do critical damage with a melee attack (decimal percentage
so it should be possible

any help would be great

andreas


Use FindSendPropInfo instead. It is fixed now.
WoZeR 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 12:23.


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