Pick a random variable between a set of numbers

0 favourites
  • 8 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • 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

  • 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

  • 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

  • > 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?

  • https://youtu.be/qC5HaoeebcA Here is a vid of the glitch

  • 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.

  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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..

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