View Single Post
dirka_dirka
Veteran Member
Join Date: Nov 2009
Old 02-20-2010 , 10:50   Re: [L4D & L4D2] Weapon Damage Mod
Reply With Quote #21

doesnt:
SetEventInt(event,"dmg_health", altereddamage);
change dmg_health... so when you do this:
new health = eventhealth + dmg_health - altereddamage;
your not actually doing anything (adding and subtracting the same value)?

you should be setting the dmg_health after the calculations are done.

also..
if you change the if (health > 1) to if (health < 1), you can partially fix cases that would cause to much damage. change this:
PHP Code:
        {
            
altereddamage RoundToNearest(dmg_health multiplierWeapon);

            
SetEventInt(event,"dmg_health"altereddamage); // for correct stats.
        
            
if (eventhealth 1// dont bother if the player dies
            
{
                new 
health eventhealth dmg_health altereddamage;
                
// health calculation: first revert damage done by adding dmg_health, then subtract the changed damage
                
                
if (health 1)
                {
                    
SetEntityHealth(clienthealth);
                    
                    
DebugPrintToAll("Changed weapon %s damage used by %N on %N, was %i, is now %i, oldhealth %i, newhealth %i"weaponnameattackerclientdmg_healthaltereddamageeventhealthhealth);
                }
            }
        } 
to this:
PHP Code:
        {
            
altereddamage RoundToNearest(dmg_health multiplierWeapon);

            if (
eventhealth 1// dont bother if the player dies
            
{
                new 
health eventhealth dmg_health altereddamage;
                
// health calculation: first revert damage done by adding dmg_health, then subtract the changed damage
                
                
if (health 1)
                {
                    
// adjust the damage done so theres 1 health left
                    
altereddamage += health 1;
                    
health 1;
                }
                
SetEntityHealth(clienthealth);
                
                
DebugPrintToAll("Changed weapon %s damage used by %N on Tank %N, was %i, is now %i, oldhealth %i, newhealth %i"weaponnameattackerclientdmg_healthaltereddamageeventhealthhealth);
            }

            
SetEventInt(event,"dmg_health"altereddamage); // for correct stats.
        

..fixes both points.
dirka_dirka is offline