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

Increasing Spell Dmg via another attribute


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Recluse
Junior Member
Join Date: Jul 2021
Location: Braap
Old 11-13-2021 , 22:20   Increasing Spell Dmg via another attribute
Reply With Quote #1

I've been trying to make a plugin that increases damage on a spell (currently using the fireball spell).

Here's the code I have so far with the help of others that I've asked about this

public OnClientPutInServer(client)
{
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
public OnClientDisconnect(client)
{
if(IsClientInGame(client))
{
SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
}
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3], damagecustom)
{
new String:classname[128];
GetEdictClassname(inflictor, classname, sizeof(classname));
if(!strcmp("tf_projectile_spellfireball", classname))
{
damage = 500.0;
damagetype |= DMG_PREVENT_PHYSICS_FORCE;
}
return Plugin_Changed;
}

What I want to happen is the damage value to multiply by a percentage per value of an attribute

To put that into something that makes a little more sense:

For every let's say 100% increase in the "damage bonus" attribute, multiply the spell's damage by 70%

I'm a complete noob when it comes to coding and I'm using this to hopefully get me into coding since it sounds simple on paper. Any and all help would be greatly appreciated.
Recluse is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 11-13-2021 , 23:08   Re: Increasing Spell Dmg via another attribute
Reply With Quote #2

I think this is what you are looking for. It's what I use for my Jedi Knight plugin.

PHP Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weaponFloat:damageForce[3], Float:damagePosition[3], damagecustom)
{
    if( !
IsValidClient(victim) || !IsValidClient(attacker) || !g_bIsJedi[attacker] || g_bIsJedi[attacker] == g_bIsJedi[victim] )
    return 
Plugin_Continue;

    if(
g_bIsJedi[attacker] && damagetype == 8)
    {
        
damage damage 15;
    }
    if(
g_bIsJedi[attacker] && damagetype == 64 )
    {
        
damage damage 15;    
    }
    
    
//next line is for debugging
    //    PrintToChat(attacker, "Weapon: %d, Damage type: %d",weapon, damagetype);
    
return Plugin_Changed;

When posting code it is helpful to click on 'advanced' button and click on php icon to wrap your code in the correct format.
PC Gamer 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 05:21.


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