Search Unity

Converting to math

Discussion in 'Scripting' started by henmachuca, Nov 11, 2016.

  1. henmachuca

    henmachuca

    Joined:
    Oct 14, 2016
    Posts:
    105
    Hello,

    I'm doing a game where the player have skills called attack and dodge and I would like that for every 2 attack : 1 dodge, the chance to hit the enemy is somewhere around 70-75%.

    Any ideas on how to convert this to a formula?!


    Thank you very much.
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Hit chance = Attack / Dodge / 2 * 75%

    This may not have the exact characteristics you are after. But it increases with attack, decreases with dodge, and give a chance of 75% when attack is double dodge.