How do I...Make something a 1 in 2 chance of happening

Get help using Construct 2

Post » Sat Jan 10, 2015 9:31 am

Hello, i want to create something which has a 1 in 2 chance of damaging the player. Please help!
please say if i am too vague
B
3
Posts: 1
Reputation: 177

Post » Sat Jan 10, 2015 10:47 am

one way to compare choose( 1, 2) with 1
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sat Jan 10, 2015 10:49 am

This could be a high level math question of what really is a 1 in 2 chance, but try: If choose(0,1)=1 - do your thing.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Sat Jan 10, 2015 10:51 am

You can also convert a chance into a percent, so 1 in 2 is 1x100% / 2 = 50%, so you could do during attack code set variable to int(random(0,100)) then do a compare 2 values event and variable less or equal to 50 damage is done.

If it was a 1 in 5 chance, 1X100% / 5 = 20% so int(random(0,100)), if variable less or equal to 20 then damages done.
B
43
S
22
G
20
Posts: 735
Reputation: 11,977


Return to How do I....?

Who is online

Users browsing this forum: Colludium, plinkie and 14 guests