Raised This Month: $ Target: $400
 0% 

[TF2] Heal all the things


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 02-20-2014 , 10:34   [TF2] Heal all the things
Reply With Quote #1

I'm trying to make Medic be able to heal sentries and whatnot (mostly sentries) but i can't manage to make the beam attach to like in this screenshot

PHP Code:
new Entity GetClientAimTarget(clientfalse);
PrintToChat(client"AimTarget: %i"Entity);
new 
Weapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
PrintToChat(client"Weapon: %i"Weapon);
        
if (
Entity && IsValidWeapon(Weapon))
{
    
SetEntProp(WeaponProp_Send"m_hHealingTarget"Entity);
    
SetEntProp(WeaponProp_Send"m_bHealing"1);
}
else
{
    
CPrintToChat(client"{red}You must be aiming at something for this to work.");
    return 
Plugin_Handled;

This just causes the medigun to play the start healing animation but doesnt actually do anything else
Pelipoika is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 02-20-2014 , 11:55   Re: [TF2] Heal all the things
Reply With Quote #2

Use DHooks or write extension to hook CWeaponMedigun::AllowedToHealTarget(CBaseEnti ty *) which is probatly bool and make it return true.
There's no vtable for this function so you'il need to get signature or ask someone to do it for you.

Edit:

AllowedToHealTarget function has string inside it
"weapon_blocks_healing"
So it probatly will be easy to get windows signature for it

When i have time i might try to get it

Edit 2:

Linux Signature:
PHP Code:
@_ZN14CWeaponMedigun19AllowedToHealTargetEP11CBaseEntity 
Windows Signature:
PHP Code:
\x55\x8B\xEC\x51\x53\x57\x8B\xF9\x8B\x87\xE4\x01\x00\x00 
__________________
...

Last edited by Oshizu; 02-20-2014 at 16:29.
Oshizu is offline
arthurdead
Senior Member
Join Date: Jul 2013
Old 02-20-2014 , 21:09   Re: [TF2] Heal all the things
Reply With Quote #3

How Do I Use Dhooks ?

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <dhooks>
#pragma semicolon 1

new Handle:hAllowheal;
new 
Handle:hGameConf;
new 
Address:HealTarget;

public 
OnPluginStart()
{
    
hGameConf LoadGameConfigFile("tf2.arthurdead");
    
HealTarget GameConfGetAddress(hGameConf"CWeaponMedigun");
    
hAllowheal DHookCreate(HealTargetHookType_EntityReturnType_BoolThisPointer_CBaseEntityAllowHealCallback);
}

public 
MRESReturn:AllowHealCallback(Address:thisHandle:hReturn)
{
    
DHookSetReturn(hReturntrue);
    return 
MRES_ChangedOverride;
}

public 
OnClientPutInServer(client)
{
    
DHookEntity(hAllowhealfalseclient);

(14) : warning 213: tag mismatch (hAllowheal = DHookCreate(HealTarget, HookType_Entity, ReturnType_Bool, ThisPointer_CBaseEntity, AllowHealCallback);)

PHP Code:
        "Addresses"
        
{
            
"CWeaponMedigun"
            
{
                
"signature" "AllowedToHealTarget"                
            
}
        }
        
"Signatures"
        
{
            
"AllowedToHealTarget"
            
{
                
"library" "server"
                "windows" "\x55\x8B\xEC\x51\x53\x57\x8B\xF9\x8B\x87\xE4\x01\x00\x00"
            
}
        } 
insta crash
arthurdead is offline
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 02-21-2014 , 03:46   Re: [TF2] Heal all the things
Reply With Quote #4

That's a familiar screenshot

I think AllowedToHealTarget only sets the heal target, though, which can obviously be done manually with ease. We just need to find the actual healing method, if that isn't it...although it might only work on players.
__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
MasterOfTheXP is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 02-21-2014 , 04:08   Re: [TF2] Heal all the things
Reply With Quote #5

You can literally set m_hHealTarget or whatever it was called to things you wouldn't normally be able to heal.

Well, at least enemy teammates. I don't know about setting it to any arbitrary entity.

Then you could use a timer or something to control healing if m_bHealing doesn't do it already.
__________________
Chdata is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 02-21-2014 , 05:28   Re: [TF2] Heal all the things
Reply With Quote #6

Quote:
Originally Posted by MasterOfTheXP View Post
That's a familiar screenshot

I think AllowedToHealTarget only sets the heal target, though, which can obviously be done manually with ease. We just need to find the actual healing method, if that isn't it...although it might only work on players.
Teach us your ways, Master

Last edited by Pelipoika; 02-21-2014 at 05:28.
Pelipoika is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 02-21-2014 , 11:41   Re: [TF2] Heal all the things
Reply With Quote #7

There will be a flag set which disallows buildings to be healed. Look at the code in IDA to find it.
__________________
Santa or Satan?

Watch out when you're paying people for private requests! Most stuff already exists and you can hardly assess the quality of what you'll get, and if it's worth the money.
Dr. Greg House is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 02-21-2014 , 11:43   Re: [TF2] Heal all the things
Reply With Quote #8

My guesses is that medi gun can heal only one target at once, but to allow healing each other, you should use DHooks and make something like this.
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 02-21-2014 , 12:00   Re: [TF2] Heal all the things
Reply With Quote #9

Quote:
Originally Posted by Root_ View Post
My guesses is that medi gun can heal only one target at once, but to allow healing each other, you should use DHooks and make something like this.
If i could somehow get the offsets.
Yeah, that would be great
Pelipoika is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 02-21-2014 , 13:33   Re: [TF2] Heal all the things
Reply With Quote #10

I'll look for a solution after dinner.

EDIT:

Code:
.text:0071DC40 ; CWeaponMedigun::IsAllowedToTargetBuildings(void)
.text:0071DC40 _ZN14CWeaponMedigun26IsAllowedToTargetBuildingsEv proc near
.text:0071DC40                 push    ebp
.text:0071DC41                 xor     eax, eax
.text:0071DC43                 mov     ebp, esp
.text:0071DC45                 pop     ebp
.text:0071DC46                 retn
.text:0071DC46 _ZN14CWeaponMedigun26IsAllowedToTargetBuildingsEv endp
Detour with an extension and always return yes? Although it seems there is a field for that which you could find.
__________________
Santa or Satan?

Watch out when you're paying people for private requests! Most stuff already exists and you can hardly assess the quality of what you'll get, and if it's worth the money.

Last edited by Dr. Greg House; 02-21-2014 at 14:49.
Dr. Greg House 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 21:20.


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