Adding a critical strike

Get help using Construct 2

Post » Sat Jun 14, 2014 5:02 am

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.
B
7
S
2
Posts: 102
Reputation: 975

Post » Sat Jun 14, 2014 5:09 am

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.
B
42
S
14
G
3
Posts: 165
Reputation: 5,115

Post » Sat Jun 14, 2014 5:21 am

How do I chose random, which action is that?
B
7
S
2
Posts: 102
Reputation: 975

Post » Sat Jun 14, 2014 5:27 am

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).
B
42
S
14
G
3
Posts: 165
Reputation: 5,115

Post » Sat Jun 14, 2014 11:04 am

It would look something like this @Beserky

Image

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!
B
15
S
4
G
1
Posts: 286
Reputation: 1,988

Post » Sat Jun 14, 2014 2:34 pm

Nice, thanks man :)
B
7
S
2
Posts: 102
Reputation: 975

Post » Wed Jun 25, 2014 7:16 pm

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.
B
11
S
3
G
8
Posts: 473
Reputation: 4,569


Return to How do I....?

Who is online

Users browsing this forum: asdtricky, brunopalermo, ST314 and 26 guests