Raised This Month: $ Target: $400
 0% 

[TF2 Plugin idea] adjustable damage fall off


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nergal
Veteran Member
Join Date: Apr 2012
Old 06-07-2013 , 19:28   [TF2 Plugin idea] adjustable damage fall off
Reply With Quote #1

a plugin that allows a server admin to change minimum and maximum damage fall off and ramp up using percentages on a config. For example

say I want to decrease the damage fall off for the rocket launcher which, at maximum range, decreases 53% of the original damage from base damage of 90, to max fall off of 48; the plugin will let me change the percentage of 53 to whatever I want, lets say I want it at 68 max fall off damage instead of 48, i'd change the default 53% to 75%.

then reload the config in the configs folder of sourcemod and bam.
__________________
nergal is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 06-07-2013 , 19:54   Re: [TF2 Plugin idea] adjustable damage fall off
Reply With Quote #2

I made this for sniper rifles. The problem is, you need different falloff for various weapons/damagetypes. So, mabye a massive switch statement or something in an ontakedamage hook. It gives you the vecs, weapon, and damagetype... so you can calculate the distance, then just scale the damage based on that and return plugin changed.

For example sentry fire has its own damagetype, so you can identify it with just this. Probably also possble to do with explosions and such too.

You can also and out dmg_crit to prevent critical hits if you so desire.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 06-07-2013 , 20:10   Re: [TF2 Plugin idea] adjustable damage fall off
Reply With Quote #3

Quote:
Originally Posted by friagram View Post
I made this for sniper rifles. The problem is, you need different falloff for various weapons/damagetypes. So, mabye a massive switch statement or something in an ontakedamage hook. It gives you the vecs, weapon, and damagetype... so you can calculate the distance, then just scale the damage based on that and return plugin changed.

For example sentry fire has its own damagetype, so you can identify it with just this. Probably also possble to do with explosions and such too.

You can also and out dmg_crit to prevent critical hits if you so desire.
let's pretend I did not know how to do all that lol
besides, this is just an idea for anyone bored.
__________________
nergal is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 06-08-2013 , 11:29   Re: [TF2 Plugin idea] adjustable damage fall off
Reply With Quote #4

The best way to get something you need is to make it yourself, then it will work exactly how you want/expect it to.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 06-08-2013 , 14:00   Re: [TF2 Plugin idea] adjustable damage fall off
Reply With Quote #5

Quote:
Originally Posted by friagram View Post
The best way to get something you need is to make it yourself, then it will work exactly how you want/expect it to.
some people are just not meant for scripting/programming/coding, and I am one of those :/

I'm an art guy, i do 3D models, animations, textures, blah blah all that.
__________________
nergal is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 09-21-2013 , 23:19   Re: [TF2 Plugin idea] adjustable damage fall off
Reply With Quote #6

alright, I've done a rough draft of it; problem is, idk how to do the vectors to get the position of damage.....

how do I use damage position to equate to damage fall off? Also, how far does the game consider damage to be far from the inflictor?
PHP Code:
#include <sourcemod>   
#include <sdkhooks>
#include <morecolors>

#define MaxFallOffDistance 1024
new Handle:rl_falloff;
new 
Handle:shotgun_falloff;
new 
Handle:minigun_falloff;
new 
Handle:rifle_falloff;
new 
Handle:revolver_falloff;
new 
Handle:gl_falloff;
new 
Handle:pistol_falloff;
new 
Handle:sticky_falloff;
new 
Handle:smg_falloff;
new 
Handle:sentry_falloff;
new 
Float:falloff;
 
public 
Plugin:myinfo =   
{   
    
name "Adjust Damage Falloff",   
    
author "Assyrian",   
    
description "let's you adjust the damage fall off",   
    
version "1.0.0",   
    
url "https://forums.alliedmods.net/"   
}; 
 
public 
OnPluginStart() 
{
    
rl_falloff CreateConVar("sm_rl_damagefalloff_percent""53""amount of damage fall off Rocket Launcher will have");
    
shotgun_falloff CreatConVar ("sm_shotgun_damagefalloff_percent""50""amount of damage fall off Shotguns will have");
    
minigun_falloff CreatConVar ("sm_minigun_damagefalloff_percent""50""amount of damage fall off Miniguns will have");
    
rifle_falloff CreateConVar("sm_rifle_damagefalloff_percent""100""amount of damage fall off Sniper Rifles will have");
    
revolver_falloff CreateConVar("sm_revolver_damagefalloff_percent""50""amount of damage fall off Revolvers will have");
    
gl_falloff CreateConVar("sm_gl_damagefalloff_percent""100""amount of damage fall off Grenade Launchers will have");
    
pistol_falloff CreateConVar("sm_pistol_damagefalloff_percent""50""amount of damage fall off Pistols will have");
    
sticky_falloff CreateConVar("sm_sticky_damagefalloff_percent""50""amount of damage fall off Stickybomb Launchers will have");
    
smg_falloff CreateConVar("sm_smg_damagefalloff_percent""50""amount of damage fall off SMGs will have");
    
sentry_falloff CreateConVar("sm_sentry_damagefalloff_percent""100""amount of damage fall off Sentries will have"); 
    for (new 
1<= MaxClientsi++)
    { 
        if (
IsClientInGame(i))
        { 
            
SDKHook(iSDKHook_OnTakeDamageOnTakeDamage); 
        } 
    }
    
AutoExecConfig(true"plugin_damagefalloff"); 


public 
OnClientPutInServer(client

    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage); 
}

public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weaponFloat:damageForce[3], Float:damagePosition[3])
{
    
decl String:wepclassname[64];
    if (
attacker && victim != attacker)
    {
        if (
StrContains(wepclassname"tf_weapon_rocketlauncher"false) != -|| StrContains(wepclassname"tf_weapon_rocketlauncher_directhit"false) != -1)
        {
            
falloff GetConVarFloat(rl_falloff) / 100;
            
damage *= falloff;
            return 
Plugin_Changed;
        }
        if (
StrContains(wepclassname"tf_weapon_grenadelauncher"false) != -|| StrContains(wepclassname"tf_weapon_cannon"false) != -1)
        {
            
falloff GetConVarFloat(gl_falloff) / 100;
            
damage *= falloff;
            return 
Plugin_Changed;
        }
        if (
StrContains(wepclassname"tf_weapon_shotgun"false) != -|| StrContains(wepclassname"tf_weapon_sentry_revenge"false) != -1)
        {
            
falloff GetConVarFloat(shotgun_falloff) / 100;
            
damage *= falloff;
            return 
Plugin_Changed;
        }
        if (
StrContains(wepclassname"tf_weapon_minigun"false) != -1)
        {
            
falloff GetConVarFloat(minigun_falloff) / 100;
            
damage *= falloff;
            return 
Plugin_Changed;
        }
    }
}

stock bool:IsValidClient(iClientbool:bReplay true)

    if(
iClient <= || iClient MaxClients
        return 
false
    if(!
IsClientInGame(iClient)) 
        return 
false
    if(
bReplay && (IsClientSourceTV(iClient) || IsClientReplay(iClient))) 
        return 
false
    return 
true

__________________

Last edited by nergal; 09-22-2013 at 00:31.
nergal is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 09-21-2013 , 23:25   Re: [TF2 Plugin idea] adjustable damage fall off
Reply With Quote #7

Quote:
Originally Posted by friagram View Post
The best way to get something you need is to make it yourself, then it will work exactly how you want/expect it to.
That isn't always possible. Sometimes, it's a better idea to go call that electrician, rather than risk electrocution.
__________________
ddhoward 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 04:36.


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