Pick a random variable between a set of numbers

Get help using Construct 2

Post » Wed Sep 30, 2015 7:02 pm

How do I make it so that it picks a random variable between a set of numbers. For example I want it to pick a number between 1-8. I dont wanna use random because that could pick a number like 2.343521616
B
5
S
1
Posts: 86
Reputation: 571

Post » Wed Sep 30, 2015 7:05 pm

You can use int(), floor(), ceil(), round()... with random() to get rid of decimals. For example random(5) can give you 4.42425353.... but int(random(5)) will give you 4.
Or you can use choose(1,2,3,4,5,6,7,8) to chose one random value
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,598
Reputation: 34,823

Post » Wed Sep 30, 2015 7:09 pm

shinkan wrote:You can use int(), floor(), ceil(), round()... with random() to get rid of decimals. For example random(5) can give you 4.42425353.... but int(random(5)) will give you 4.
Or you can use choose(1,2,3,4,5,6,7,8) to chose one random value

I am trying to make a boss that makes it spawn a random enemy when x=1. But now when I do this it spawns a TON of them
B
5
S
1
Posts: 86
Reputation: 571

Post » Wed Sep 30, 2015 7:11 pm

phantomunboxing wrote:
shinkan wrote:You can use int(), floor(), ceil(), round()... with random() to get rid of decimals. For example random(5) can give you 4.42425353.... but int(random(5)) will give you 4.
Or you can use choose(1,2,3,4,5,6,7,8) to chose one random value

I am trying to make a boss that makes it spawn a random enemy when x=1. But now when I do this it spawns a TON of them


Could you please share the event/conditions you use for the spawn action and explain what is happening now and what you expect/like to happen?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Sep 30, 2015 7:20 pm

https://youtu.be/qC5HaoeebcA Here is a vid of the glitch
B
5
S
1
Posts: 86
Reputation: 571

Post » Wed Sep 30, 2015 9:11 pm

Your video is private. Most probably you have a condition that after it's met it repeats every tick. Add a "trigger once" condition to fix that.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829

Post » Wed Sep 30, 2015 9:53 pm

eli0s wrote:Your video is private. Most probably you have a condition that after it's met it repeats every tick. Add a "trigger once" condition to fix that.

THANK YOU SOOO MUCH!
B
5
S
1
Posts: 86
Reputation: 571

Post » Wed Sep 30, 2015 10:34 pm

Seeing the video, you could also just put all the compare variable conditions as subevents of the every x seconds event in which the choose action is performed..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: marcinkowski, zenox98 and 24 guests