Game Development Reference
In-Depth Information
@>Conditional Branch: Variable [0009:TreasureChestSeed] == 4
@>Change Gold: + 1
@>Text: -, -, Normal, Bottom
: : Got a single Gold piece!
@>
: Branch End
@>Conditional Branch: Variable [0009:TreasureChestSeed] == 5
@>Change Gold: + 500
@>Text: -, -, Normal, Bottom
: : Got 500 Gold!
@>
: Branch End
@>Conditional Branch: Variable [0009:TreasureChestSeed] == 6
@>Change Items: [Hi-Potion], + 1
@>Text: -, -, Normal, Bottom
: : Got a Hi-Potion!
@>
: Branch End
@>Conditional Branch: Variable [0009:TreasureChestSeed] == 7
@>Change Items: [Elixir], + 1
@>Text: -, -, Normal, Bottom
: : Got an Elixir!
@>
: Branch End
@>Wait: 30 frame(s)
@>Control Variables: [0010:ChestsToOpen] -= 1
@>Erase Event
@>
That is a large part of the treasure chest minigame.
Creating the Treasure Chest Game NPC
Next, let's create the NPC. He's going to get straight to the point and begin with the all-important question: Want to
play the Treasure Chest game? The player will get three choices at that time. He/She can answer yes, at which point
the NPC will note that it costs 500 Gold to play and ask the player to confirm. We have the usual processing to make
sure that the player can't play if he or she doesn't have the Gold and have the NPC say good-bye if he/she says no.
The second choice is humorously named “Huh?” and prompts the NPC to explain what the game is actually about.
The last choice allows the player to say no from the first question and not have to initially say yes. If the player says yes
and has the Gold to play, the NPC will deduct 500 Gold from the player, say a little line, and the screen will fade out. After
the fade-out, we set the value of ChestsToOpen to 2, set the value of TreasureChestSeed to a random value between 1 and 7,
and flip the TreasureChestStart to the on state. One second later, the screen fades back in, and the fun can begin.
We add a simple second page to the NPC that gives him a witty one-liner urging the player to “Get to opening!” the
chests, as it were, but only when TreasureChestStart is on. A listing of the first page of the NPC event follows.
@>Label: Main
@>Text: -, -, Normal, Bottom
: : Want to play the Treasure Chest game?
@>Show Choices: Yes, Huh?, No
: When [Yes]
 
Search WWH ::




Custom Search