|
Random contents treasure chest guide 1.0 By Emirpoen Ok, bear with me here, as this is my first tutorial. This will be a simple guide on how to make your treasure chest spawn random items. You should probably have a basic understanding of variables, conditional branches, and obviously switches. *SET UP* First; decide what items you want to possibly appear in the treasure chest. Second; set aside a variable for random number and a switch for the treasure chest. third; assign a value to each item that is within the range of the random number range. *CREATION* Choose a sprite to represent the untouched goods on page 1. Then, create a second page. Set a precondition for the switch you reserved for the chest to be on, and optionally, leave a message to indicate that the treasure chest is empty. You're done here. Now, go back to page one and make the first event a variable operation. This is where you set the range. Set variable to change to single variable. Be sure to choose the variable set aside for the random number. Next, choose "set equal" for operand. Finally, choose "random number between" for operand, and set your range for the randomization. The simplest way is to make "1" in the left box, and how many items possible, like "5" for example for 5 items. Now, make a condition branch and set it to "variable". Next, choose number and set it to what number item it is on the list. Finally, set the bottom box to "Equal to" if it isnt already set at that.Uncheck the box that says "execute custom handler". Make an event in the branch adding the item,a message/image indicating the item, and an event that turn this treasure chest's switch on. Repeat this for each item, and viola! You now have a treasure chest/container that can leave random items. Here's a sample: Variable Oper:[0001:Randomizer] Set, Rnd [1-3] Branch if Var[0001:Randomizer] is 1 Change Items:Potion 1 Add Message: You got potion Switch Operation: [0001:chest1] : End Branch if Var[0001:Randomizer] is 2 Change Items:Elixer 1 Add Message: You got elixer Switch Operation: [0001:chest1] : End Branch if Var[0001:Randomizer] is 3 Change Items:Bad Mushroom 1 Add Message: You got bad mushroom Switch Operation: [0001:chest1] : End *THE RANDOM PRIZE VARIANT* This concept is roughly the same, except that you dont need the switch for this or page 2. First, you'll want to make a condition branch that checks the amount of money the player has. Be sure tohave the "execute custom handler" box checked for this particular event. Make the else section leave amessage telling the player that they have insufficient funds. Now, in the if part of the money check conditional, give the player a choice of yes or no. In the "Yes" section, take the amount the lotto cost, set the randomizer, make the conditional branches as mentioned earlier, minus the switch (you WANT the player to do this as long as they got the money). Sample: Branch if Money is 300 or more Message: Want a Prize? Show Choices: Yes/No :[Yes] Handler Change Money: 300 Remove Variable Oper:[0001:Randomizer] Set, Rnd [1-3] Branch if Var[0001:Randomizer] is 1 Change Items:Potion 1 Add Message: You got potion :End Branch if Var[0001:Randomizer] is 2 Change Items:Elixer 1 Add Message: You got elixer :End Branch if Var[0001:Randomizer] is 3 Change Items:Bad Mushroom 1 Add Message: You got bad mushroom :End :[No] Handler :End : Else Handler Message: Insufficient funds. : End Emirpoen wishes to thank: Nessiah, for suggesting writing a tutorial Ocean, for suggesting how to make this guide better Dajhail, for hosting this #CR for putting up with me on those bad days
|