Damage Calculation

KCEKCE Join Date: 2004-10-13 Member: 32247Members
edited January 2005 in NS General Discussion
<div class="IPBDescription">How to calculate damage</div> How do I calculate in general, how much damage a weapon will do to a player in regards to armor and distance (for gl)?
I need it for an amxmodx plugin I'm making. <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin-fix.gif' border='0' style='vertical-align:middle' alt='biggrin-fix.gif' /><!--endemo-->

Comments

  • AlkillerAlkiller Join Date: 2004-05-23 Member: 28847Members
    edited January 2005
    <a href='http://manual.nsguides.org/basic/damageCalculator.htm' target='_blank'>http://manual.nsguides.org/basic/damageCalculator.htm</a>

    ninja edit - Your brackets eluded me. I'm not sure about the distance/gl thing. <!--emo&???--><img src='http://www.unknownworlds.com/forums/html/emoticons/confused-fix.gif' border='0' style='vertical-align:middle' alt='confused-fix.gif' /><!--endemo-->
  • KCEKCE Join Date: 2004-10-13 Member: 32247Members
    edited January 2005
    I saw that, but I didn't understand the code that well. I need it in layman's terms. <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif' /><!--endemo--> BTW, who did the programming? Was it ninja? Maybe I could ask him to describe to me what the code does exactly or if he could put in a C style format.
  • DarknsDarkns Join Date: 2004-09-05 Member: 31402Members, Constellation
    In the HLSDK radial damage has it as a linear falloff...
    <!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->adjdamage = (damage * distance) / maxdistance<!--c2--></td></tr></table><div class='postcolor'><!--ec2-->
    Really like to know the formula for damage over health and armor, though...
  • im_lostim_lost TWG Rule Guru Join Date: 2003-04-26 Member: 15861Members
    <!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Really like to know the formula for damage over health and armor, though...<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->
    You are asking how much damage is done to health, and how much to armor, right?

    For marines, 30% of damage goes to health, and 70% goes to armor. The part that goes to armor is divided by 2 before taking away armor points. For a HA marine, 95% of damage goes to armor, and that is divided by 2 before taking away armor points. A JP marine works the same as a vanilla marine.

    For aliens, it depends on the number of hives. At one hive, 70% goes to armor, and that is divided by 2 before taking away armor points. At two hives, 80% goes to armor, and that is divided by <b>2.5</b> before taking away armor points. At three hives, 90% goes to armor, and that is divided by <b>3</b> before taking away armor points.
  • SuitePeeSuitePee Join Date: 2004-11-18 Member: 32857Members
    <!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->How do I calculate in general, how much damage a weapon will do to a player in regards to armor and distance (for gl)?
    I need it for an amxmodx plugin I'm making.<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->
    Well if you're dead,I presume the creature has done enough damage to kill you. <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile-fix.gif' border='0' style='vertical-align:middle' alt='smile-fix.gif' /><!--endemo-->
    Alternatively,each weapon interface on the 1-4 screen does show e.g:

    Skulk- Weapon 1- Bite: "info about it" Damage: 75
    Marine- Weapon 1- LMG: "info about it" Damage: 20 per shot

    Or just set up a fun server and get each thing to attack you.
    Btw,what mod are you planning?
  • a_civiliana_civilian Likes seeing numbers Join Date: 2003-01-08 Member: 12041Members, NS1 Playtester, Playtest Lead
    <!--QuoteBegin-SuitePee+Jan 29 2005, 12:27 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (SuitePee @ Jan 29 2005, 12:27 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Marine- Weapon 1- LMG: "info about it" Damage: 20 per shot<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->
    The LMG actually does 10 damage per shot, so that isn't correct.

    Most numbers can be found in Balance.txt in your 'ns' folder.
  • KCEKCE Join Date: 2004-10-13 Member: 32247Members
    edited January 2005
    It turns the gl into a rocket launcher. I had to create a new entity to replace the grenade and so I had to do everything manually including scoreboard and damage. Here was what I had before (found of amxmodx forums):

    <!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
    #define ARMOR_RATIO     0.3    // Armor Takes 80% of the damage (was .2 in the SDK)
    #define ARMOR_BONUS  0.5    // Each Point of Armor is work 1/x points of health
    //??
       new Float:flNew = float(damage) * ARMOR_RATIO
       new Float:flArmor = (float(damage) - flNew) * ARMOR_BONUS
       new Float:armor = float(get_user_armor(victim))

       // Does this use more armor than we have?
       if( flArmor > armor ){
           flArmor = armor;
           flArmor *= (1/ARMOR_BONUS)
           flNew = float(damage) - flArmor
           set_user_armor(victim, 0)
       }
       else
           set_user_armor(victim, floatround(armor - flArmor))

       damage = floatround(flNew)

    <!--c2--></td></tr></table><div class='postcolor'><!--ec2-->
  • TheAdjTheAdj He demanded a cool forum title of some type. Join Date: 2004-05-03 Member: 28436Members, NS1 Playtester, Constellation
    Damage isn't currently calculated correctly for the GL in terms of damage over distance. You can search mantis for the specific entry. Just a heads up.
  • KCEKCE Join Date: 2004-10-13 Member: 32247Members
    edited January 2005
    I have this for calculating the max damage a gl can do by distance:

    <!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
    dist = get_distance(origin,vExplodeAt)//DISTANCE BETWEEN PLAYER AND EXPLOSION
    maxdamage = 125 //MAX DAMAGE GL CAN DO
    damradius = 350 //RADIUS OF GL EXPLOSION

    dRatio = floatdiv(float(dist),float(damradius))  //CALCULATE DAMAGE RATIO
    damage = maxdamage - floatround( maxdamage * dRatio) ///CALCUALTE MAX DAMAGE
    <!--c2--></td></tr></table><div class='postcolor'><!--ec2-->
  • NiteowlNiteowl Join Date: 2002-09-04 Member: 1274Members, NS1 Playtester, Contributor
    <!--QuoteBegin-KCE+Jan 28 2005, 06:29 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (KCE @ Jan 28 2005, 06:29 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> I saw that, but I didn't understand the code that well. I need it in layman's terms. <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif' /><!--endemo--> BTW, who did the programming? Was it ninja? Maybe I could ask him to describe to me what the code does exactly or if he could put in a C style format. <!--QuoteEnd--> </td></tr></table><div class='postcolor'> <!--QuoteEEnd-->
    I have no idea who ninja is, but i coded that. Thanks to a civilian and TheAdj on the inner workings on armor absorptions/hives/etc.

    The code is pretty straightforward. And it's right there for you to peruse.

    And what i'm lost said is what i used.
  • KCEKCE Join Date: 2004-10-13 Member: 32247Members
    edited January 2005
    What happens with the armor leftover after being subtracted, like if it takes out all the armor and more? Is it then subtracted from the health?

    What does this mean in balance.txt:
    #define kArmorValueBase 0.50
  • NiteowlNiteowl Join Date: 2002-09-04 Member: 1274Members, NS1 Playtester, Contributor
    If it takes out all the armor and more, you ahve to translate that dmg value to health damage, and subtract that from the health.
Sign In or Register to comment.