AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=58)
-   -   Increasing Spell Dmg via another attribute (https://forums.alliedmods.net/showthread.php?t=335187)

Recluse 11-13-2021 22:20

Increasing Spell Dmg via another attribute
 
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.

PC Gamer 11-13-2021 23:08

Re: Increasing Spell Dmg via another attribute
 
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.


All times are GMT -4. The time now is 07:38.

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