Dice Game Tutorial By Ichigo Momomiya (ribbybickie@hotmail.com; DON'T ASK) This tutorial shows you how to do a simple dice game in RM2K. Basically, what happens in this game is that the character pays 10 GP (or whatever amount you want to bet) to the dealer to play. The character and the dealer take turns rolling the dice until one of them comes up with either a 7 or 11. If the character wins, he is given back his 10 GP and wins a prize of another 10 GP. If the dealer wins, he keeps the 10 GP. What you need for this game is three variables and two switches. The first variable (I'll call this "Dice Game") will be "rolled" at every turn and come up with a number between 2 and 12. The second variable ("Bet") stores the amount of money you wish to bet. The third variable ("Money") stores the amount of money you have. The first switch ("Hero's Turn") turns on the page with the results for the hero's rolls. The second switch ("Dealer's Turn") turns on the page with the results for the dealer's rolls. First of all, set up the introductory event on the first page. (\v[xxxx] means whatever is stored in variable xxxx.) We have to make sure the character has enough money to bet, so there is a fork condition in place so the character doesn't bet 50 GP when he really has 30. <>Messg: Hey, you look like you're lucky! How about we : :play a little dice game, hmm? <>Show Choice: Yes/No :[Yes] Case <>Messg: Place your bet! <>Variable Ch:[xxxx:Money]*, Money# <>Input Number: 3 dg.[xxxx:Bet] <>FORK Optn:Varbl[xxxx:Money]-V[xxxx] less than <>Messg: Sorry, can't bet what you don't have! :ELSE Case <>Messg: All right. We take turns rolling the dice. : :If you get a 7 or 11, you win your bet back plus : :another \v[xxxx] GP. If I get a 7 or 11, I keep your : :\v[xxxx] GP. Understand? Okay! <>Change Money: Money V[xxxx]Decr. <>Change Switch: [xxxx:Hero's Turn]-ON set <> :END Case :[No] Case <>Messg: Fine by me. <> :END Case <> Step Two: Make a new page. Set the Event Conditions switch to "Hero's Turn." Set the Event Start Condition to "Parallel Process." First of all, set up the variable that will randomly determine a number between 2 and 12. <>Variable Ch:[xxxx:Dice game]Set, Randm[2*12] Next, we begin coding for each of the numbers you can get. For the numbers 2-6, 8-10 and 12 (with "xx" as the number on the "dice") have this fork option set up: <>FORK Optn:Varbl[xxxx:Dice game]-xx <>Messg: I got xx! Nuts! <>Change Switch: [xxxx:Dealer's Turn]-ON set <>Change Switch: [xxxx:Hero's Turn]-OFF set <> :ELSE case <> :END case For 7 and 11, code as follows (with "xx" again as the number on the "dice") <>FORK Optn:Varbl[xxxx:Dice game]-xx <>Messg: All right! I got xx! I win! <>Messg: You lucky dog! Here's your bet back plus : :another /v[xxxx] GP! : :Hope you had fun! Come again! <>Variable Ch:[xxxx:Bet]*,2 <>Change Money: Money V[xxxx] Incr. <>Change Switch: [xxxx:Hero's Turn]-OFF set <>Change Switch: [xxxx:Dealer's Turn]-OFF set <> :ELSE case <> :END case Step Three: Make another new page. Set the Event Conditions to have the switch "Dealer's Turn" ON. Set the Event Start Condition to Parallel Process. Basically, you just repeat the steps on the previous page. HOWEVER, reverse the switches order, like so: <>FORK Optn:Varbl[xxxx:Dice game]-xx <>Messg: I got xx! Nuts! <>Change Switch: [xxxx:Hero's Turn]-ON set <>Change Switch: [xxxx:Dealer's Turn]-OFF set <> :ELSE case <> :END case For 7 and 11, program this: <>FORK Optn:Varbl[xxxx:Dice game]-xx <>Messg: All right! I got xx! Ha ha ha! I get to keep your : :money! This was fun! I hope we play again! <>Change Switch: [xxxx:Dealer's Turn]-OFF set <>Change Switch: [xxxx:Hero's Turn]-OFF set <> :ELSE case <> :END case So that's all there is to it, unless I somehow did it the hard way (which I have a tendency to do) or overlooked something. (I actually overlooked the fact that I left out the payoff in my original code! Shimatta!) If you do find anything wrong with this, either notify me by e-mail or contact me thru The RM2K World Forum (look for Ichigo Momomiya.) This tutorial is (c)2002 Ichigo Games. Permission is granted to use what is contained in this tutorial in an RPG Maker 2000 game. Permission is NOT granted to submit this tutoral to any other site, because *I* will be doing the submitting here. Permission is also NOT granted for you lowlifes to claim this tutorial for your own, because unlike YOU, I actually SPELL my words right and use PROPER grammar, with none of that 1337 h4x0r stuff. If you do take this tutorial as your own, and if I or my friends find out about it, you will regret the day you were born. Comprendo? Don't make me mad, neither of us will like it. "Problems worthy of attack prove their worth by hitting back."--Piet Hein