AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [SOLVED][SDKHooks] Remove damage without removing push force? (https://forums.alliedmods.net/showthread.php?t=266207)

MrTimcakes 07-12-2015 15:50

[SOLVED][SDKHooks] Remove damage without removing push force?
 
I'd like to remove Rocket/Sticky self-damage in tf2, however I wish to keep the self-push force but my code removes that.
PHP Code:

public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype){

    if(
victim == attacker){
        
damage 0.0;
        return 
Plugin_Changed;
    }    
    return 
Plugin_Continue;



turtsmcgurts 07-12-2015 16:18

Re: [SDKHooks] Remove damage without removing push force?
 
A hacky workaround I used to accomplish this was to simply add the damage amount to the victims health to negate the incoming damage. If I remember correctly though, OnTakeDamage doesn't report the correct damage all the time (perhaps because of random damage spread?). I might be confusing it with OnPlayerHurt, it was one of them.

PHP Code:

public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype){ 

    if(
victim == attacker){ 
        
SetEntityHealth(victimvictim_health damage);
    }     
    return 
Plugin_Continue



Pelipoika 07-12-2015 16:25

Re: [SDKHooks] Remove damage without removing push force?
 
1.7 Syntax

PHP Code:

public Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3])
{    
    if(
victim == attacker)
    {
        
damage 0.0
        
TeleportEntity(attackerNULL_VECTORNULL_VECTORdamageForce);
        return 
Plugin_Changed
    }

    return 
Plugin_Continue;



MrTimcakes 07-12-2015 16:45

Re: [SDKHooks] Remove damage without removing push force?
 
Thanks. Also in the gun mettle update they added
Code:

Random damage spread is off by default (convar tf_damage_disablespread). Existing users will still use their currently set value.
Search Spread Here

Neuro Toxin 07-12-2015 18:01

Re: [SDKHooks] Remove damage without removing push force?
 
What about OnTakeDamage_Alive?

This was added to SM only a few revisions back.

MrTimcakes 07-12-2015 18:08

Re: [SDKHooks] Remove damage without removing push force?
 
Quote:

Originally Posted by Pelipoika (Post 2318978)
1.7 Syntax

PHP Code:

public Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3])
{    
    if(
victim == attacker)
    {
        
damage 0.0
        
TeleportEntity(attackerNULL_VECTORNULL_VECTORdamageForce);
        return 
Plugin_Changed
    }

    return 
Plugin_Continue;



TeleportEntity(attacker, NULL_VECTOR, NULL_VECTOR, damageForce); nor TeleportEntity(attacker, NULL_VECTOR, NULL_VECTOR, damagePosition); produces the desired result, damageForce pushes the player way too far and damagePosition pushes the player to hard and always the same direction

RedSword 07-12-2015 18:13

Re: [SDKHooks] Remove damage without removing push force?
 
Quote:

Originally Posted by Neuro Toxin (Post 2319021)
a few revisions back

"A few" revisions back, refering to a bit more than 10 months ago, or a bit more than 5 months for the stable. That's hundreds/thousands.

VoiDeD 07-12-2015 20:20

Re: [SDKHooks] Remove damage without removing push force?
 
If you don't care about the damage source, you can set the player's m_takedamage to DAMAGE_EVENTS_ONLY to avoid using any hooks.

MrTimcakes 07-12-2015 21:03

Re: [SDKHooks] Remove damage without removing push force?
 
Quote:

Originally Posted by VoiDeD (Post 2319061)
If you don't care about the damage source, you can set the player's m_takedamage to DAMAGE_EVENTS_ONLY to avoid using any hooks.

I don't think this does what I'd like. I'd like something that only makes self-damage do no damage, I'd like still to be damaged by other players just not by myself.

Neuro Toxin 07-12-2015 21:40

Re: [SDKHooks] Remove damage without removing push force?
 
Quote:

Originally Posted by RedSword (Post 2319025)
"A few" revisions back, refering to a bit more than 10 months ago, or a bit more than 5 months for the stable. That's hundreds/thousands.

I think it was 172


All times are GMT -4. The time now is 00:19.

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