Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> [Eventing]Rock/Paper/Scissors
Fallen-Griever
post Jul 17 2010, 04:38 AM
Post #1


Forgotten Neural Kiss
Group Icon

Group: Revolutionary
Posts: 183
Type: Event Designer
RM Skill: Masterful




This tutorial will allow you to create a Rock/Paper/Scissors minigame. This should work in all the RPGMakers, but I will set this up for RM2K3 because I know it works there.

First, make a variable and call it "Opponent Choice". We are going to assume that:

1 = Rock
2 = Paper
3 = Scissors

The basic idea is to set the "Opponent Choice" variable to a random number and then check it against the choice the player makes. To do that, we set up the event like this:

CODE
Variable [xxxx: Opponent Choice], Set Random (1-3)
Show Message: "What do you want to choose?"
Show Choice: "Rock", "Paper", "Scissors"
If Choice = "Rock" Then:
   If Variable [xxxx:Opponent Choice] = 1 Then
      Show Message "You chose Rock! The opponent chose Rock! The game is a tie!"
      <Whatever happens if you tie>
   End
   If Variable [xxxx:Opponent Choice] = 2 Then
      Show Message "You chose Rock! The opponent chose Paper! You lost the game!"
      <Whatever happens if you lost>
   End
   If Variable [xxxx:Opponent Choice] = 3 Then
      Show Message "You chose Rock! The opponent chose Scissors! You won the game!"
      <Whatever happens if you win>
   End
End
If Choice = "Paper" Then:
   If Variable [xxxx:Opponent Choice] = 1 Then
      Show Message "You chose Paper! The opponent chose Rock! You won the game!"
      <Whatever happens if you win>
   End
   If Variable [xxxx:Opponent Choice] = 2 Then
      Show Message "You chose Paper! The opponent chose Paper! The game is a tie!"
      <Whatever happens if you tie>
   End
   If Variable [xxxx:Opponent Choice] = 3 Then
      Show Message "You chose Paper! The opponent chose Scissors! You lost the game!"
      <Whatever happens if you lost>
   End
End
If Choice = "Scissors" Then:
   If Variable [xxxx:Opponent Choice] = 1 Then
      Show Message "You chose Scissors! The opponent chose Rock! You lost the game!"
      <Whatever happens if you lost>
   End
   If Variable [xxxx:Opponent Choice] = 2 Then
      Show Message "You chose Scissors! The opponent chose Paper! You won the game!"
      <Whatever happens if you win>
   End
   If Variable [xxxx:Opponent Choice] = 3 Then
      Show Message "You chose Scissors! The opponent chose Scissors! The game is a tie!"
      <Whatever happens if you tie>
   End
End

In order to make it more interesting than this random model is then you could always "weight" the random assignment to make an opponent prefer a particular choice over the others (i.e. add strategy to the game). For instance, you could make it so muscular types prefer Rock and so scholarly types prefer Paper, meaning that the player can make a good guess based on reading the characters personality. That, however, is outside the scope of this tutorial!


__________________________
<-- Complete
<-- In Development
<-- Complete
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 21st May 2013 - 02:01 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker