Jump to content

Pick a random number for item collecting ?

Recommended Posts

Hello so in my game in making it so that you can collect garlic and I want you to be able to collect a random number of garlic pieces, how would you do that?


i have no idea how to use variables either, it that’s important.

Share this post

Link to post
Share on other sites

Hey! :)


Fortunately, what you're looking to do is pretty easy to set up by utilizing (you guessed it) variables.


As a basic introduction to what variables are, they're essentially just keep track of a number, in which you can use later.


To start things off, create a new event for your Garlic patch. Start off by using "Control Variable". At the top of the window by "Single", you'll have to pick a variable to use. Select an unused variable, and name it "Random Number". 


Next, for "Operation" make sure "Set" is selected. Lastly, for Operand, select "Random. Here you list the minimum and maximum pieces of garlic you want to be able to collect. For this example, I'll use 1-3. Just click "OK", and you've successfully set up a variable!


Now to make use of it. Use the "Change Items" command, and select the garlic item. Instead of setting a static amount, you can now select your variable. You'll now be given a random amount of garlic depending on the min and max you set for the variable!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

Top ArrowTop Arrow Highlighted