condition: x% chance (edit: SOLVED)

New releases and general discussions.

Post » Fri Jan 23, 2009 11:20 pm

i'd like a simple condition like this -- triggers randomly with the specified percentage chance.

i know it's already possible, which i'm about to start coding -- pick random value, store value as private variable, compare value. it'd just be nice to have a simple condition instead of all that extra work.

example:

Bullet: overlaps Enemy 0
33% Chance
> FunctionCall function "breakArmor" (and Remember picked objects)

so if the bullet overlaps the enemy, there's a 33% chance it will break the armor
B
2
S
2
G
4
Posts: 254
Reputation: 1,958

Post » Fri Jan 23, 2009 11:24 pm

Compare values: random(100) is less than 33 :P
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Fri Jan 23, 2009 11:26 pm

[quote="Ashley":3d7zhuk2]Compare values: random(100) is less than 33 :P[/quote:3d7zhuk2]
marvelous
B
2
S
2
G
4
Posts: 254
Reputation: 1,958


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests