Adding a critical strike

0 favourites
  • 7 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • So as you can see from the title i want to know how t make a critical strike. Basically I have normal attack which is performed by pressing A.

    And there would be 2 animations (one for normal attack and one for a critical).

    Then lets say that my critical strike chance is 10%, so i want it to hit at 10% chance (lol).

    How do I pull it off? I guess i will need a variable but how can I make it chose randomly?

    Thanks in advance.

  • When you press A, have something like this:

    if random(100) < critical chance >>> Do critical animation

    else >>> do normal animation

    Basically is calculates a random number random(100) and if that number is inside your critical chance then it is a critical hit.

  • How do I chose random, which action is that?

  • You would most likely use it the other way, like critchance > random(100)

    So in this case you would compare your system variable with > value of random(100).

  • It would look something like this

    The int command tells it to pick a whole number (otherwise you get a load of decimals) and you go from 1 to 101 because random picking always goes from the first number to one less than the second number. Just fill in the events and it should work!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nice, thanks man

  • 2c. A critical in RPGs are usually the highest damage you can do in your damage variable range. For instance, if your damage range is 2500-10000, then your critical would be 10000.

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