How do I write formula to calculate outcome of event?

0 favourites
  • 3 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Brilliant Construct community, need help coming up with a way to calculate outcome of an event. In the game I'm working to develop, there are a set of factors that can impact the success of an event (small sampling of factors); smarts, speed and ability. The event being a player disarming a bomb.

    • smart - 10% increase in success
    • speed - 5% increase in success
    • ability - 15% increase in success

    I've been checking online for the formula on how to determine if the disarming was successful. I'll admit up front I have no idea how this works as I'm used to writing formulas in Excel so any help you can provide would be much appreciated.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You pretty much want to draw a random integer number between 0 and 100.

    The expression to do so is int(random(101))

    And you want to compare this number to the percentages of your skills.

    So let's assume we have a 20% base chance disarming the bomb.

    As I'm smart, it goes up to 30%

    Is my random number less or equal 30 ?

    If so, I have disarmed the bomb. Otherwise, it blew up in my face.

    The random number likely has to be assigned to a variable (local or global) and tested against a value made up of the base chance and the addition of skills value to it.

    Global var : randNum

    On user action

    - Set randNum to int(random(101))

    sub-event

    Compare randNum is less or equal baseChance + smart + speed + ability

    -> Win

    Else

    -> Explosion

  • Very well written and explained. Thank you!!

    Going to test it and post back any questions I come across.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)