matthew30903

Veteran
Veteran
Joined
Jun 29, 2014
Messages
84
Reaction score
32
First Language
English
Primarily Uses
RMMZ
Today we will go over making a dynamic inn for your player’s party to rest in. The cost can be changed dynamically with variables and the inn is easily extendable.


For this you will need one Common Event, 2 Variables, and an Event for the Innkeeper.


First we will want to make a loop, this will repeat the inn choice display after each option is finished.


Use the Show Text command to display the Innkeeper’s greeting, something like: “How may I help you?”


Then comes the choices for the player to decide what they want. This could be as simple as asking for a room or exiting the dialog, but that would not be that interesting. In my game there is a Mercenary system and you can ask Innkeepers for work, so I add the options. (Both Future Tutorials)


Within our Room Choice we want to set a variable to what the inn will cost for one night using the Control Variables command. Name the variable something recognizable like “Inn Room Cost”


In your Exit Choice we will want to place a Break Loop command to close out the Inn event.


Your Innkeeper should look something like this:

InnTest_1.JPG

◆Loop
  ◆Text:None, Window, Bottom
  :Text:How may I help you?
  ◆Show Choices:Room, Mercenaries, Work, Never mind. (Window, Right, #1, #4)
  :When Room
    ◆Control Variables:#0008 Room Inn Cost = 100
    ◆
  :When Mercenaries
    ◆
  :When Work
    ◆
  :When Never mind.
    ◆Break Loop
    ◆
  :End
  ◆
:Repeat Above


In this example we are using Variable 8 for our Room Inn Cost and we are setting it to 100, but you could set this elsewhere or make something more complicated by multiplying it by an economy variable.


Now we want to open the database and create a new Common Event named Inn. The reason we are using a Common Event is so we can use it in every inn we make, saving time.


Within our Common Event we will want to show some text telling the player how much the room costs for one knight and asking them if they would like to stay.


◆Text:None, Window, Bottom
:Text:\V[8]\G for one night. Would you like to stay?\$



We will be using some text commands for this \V[8] will display the value of Variable 8, our inn’s cost. \G displays the symbol used for currency within the game. \$ displays the gold window, showing the player how much currency they have.


We will want to give the player the option of Yes or No. Within the yes branch you will want to set a variable to the Gold (Under Game Data within the Set Variables command). In this example we will be using Variable 9.


After setting the variable, we want to use a Conditional Branch to see if the Party Gold Variable is greater than or equal to the Inn Room Cost variable. Check the Create Else Branch before hitting okay.


Within the If branch we want to use Change Gold to Decrease using the Inn Room Cost variable. This will subtract the party’s gold by the variable.


Next is cosmetic, but good feedback for players. We want to use Fadeout Screen, Play a ME sound effect for the inn, and Wait 300 frames.


Use the Recover All command for the Entire Party and then Fadein Screen.


In the Else branch we will want some text to tell the players they do not have enough money.


Leave the No branch empty.


Your Inn Common Event should look something like this:


◆Text:None, Window, Bottom
:Text:\V[8]\G for one night. Would you like to stay?\$
◆Show Choices:Yes, No (Window, Right, #1, #2)
:When Yes
  ◆Control Variables:#0009 Party Gold = Gold
  ◆If:Party Gold ≥ Inn Room Cost
    ◆Change Gold:- {Inn Room Cost}
    ◆Fadeout Screen
    ◆Play ME:Inn (100, 100, 0)
    ◆Wait:300 frames
    ◆Recover All:Entire Party
    ◆Fadein Screen
    ◆
  :Else
    ◆Text:None, Window, Bottom
    :Text:\n<Innkeeper>You don't have enough money.
    ◆
  :End
  ◆
:When No
  ◆
:End

InnTest_3.JPG

Within our original Inn Event we will want to use the Call Common Event command to call our Inn event after setting the variable for cost. This will bring up the inn sequence we just wrote. Thanks to the Loop players will be brought back to the start of this event after staying the night so they can use other commands.


Our final inn will look something like:

InnTest_2.JPG

◆Text:None, Window, Bottom
:Text:\V[8]\G for one night. Would you like to stay?\$
◆Show Choices:Yes, No (Window, Right, #1, #2)
:When Yes
  ◆Control Variables:#0009 Party Gold = Gold
  ◆If:Party Gold ≥ Inn Room Cost
    ◆Change Gold:- {Inn Room Cost}
    ◆Fadeout Screen
    ◆Play ME:Inn (100, 100, 0)
    ◆Wait:300 frames
    ◆Recover All:Entire Party
    ◆Fadein Screen
    ◆
  :Else
    ◆Text:None, Window, Bottom
    :Text:\n<Innkeeper>You don't have enough money.
    ◆
  :End
  ◆
:When No
  ◆
:End



Using plugins it is possible to gain more control over what options are available to the player at any given time, but this makes a good framework.


If you found this helpful please share with me the projects that you use this in. Also if you find any mistakes or have any improvements please share them. Thank you.
 
Last edited by a moderator:

Archeia

Level 99 Demi-fiend
Staff member
Developer
Joined
Mar 1, 2012
Messages
15,525
Reaction score
16,000
First Language
Filipino
Primarily Uses
RMMZ
Can you also include images? While this is nice I think it'll help the user to see it in action :D
 

matthew30903

Veteran
Veteran
Joined
Jun 29, 2014
Messages
84
Reaction score
32
First Language
English
Primarily Uses
RMMZ
There we go, didn't even think of that. I will make a small video to demonstrate in the future as well.
 

Jeralt

Warper
Member
Joined
Jan 1, 2019
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMMV
But what if I dont want to make my inn dynamic? What if it will always have a set price that never changes? That's all I need to know, and looking at this tutorial I get the feeling it has way more to it than is necessary in my case. All I need is an inn where the person at the counter will greet you with a show text command, beyond the simplicity of the quick event innkeeper creation.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,512
Reaction score
12,003
First Language
English
Primarily Uses
RMVXA
@Jeralt If you don't want to make your inn dynamic then you are hi-jacking this thread with an unrelated question.
I suggest you start a new thread in MV Support, setting out exactly what you do want to happen.
 

Latest Threads

Latest Posts

Latest Profile Posts

I'm seeing my god daughter's school play next week. Being the mild agoraphobe I am this makes me nervous. Thus I had a dream that it was actually a plot by my best friend to take me clubbing at an establishment where it is customary to throw a harpoon at staff members to reward good service.
Praise be to the game make!
I need help on what I should add to this fighter game.
Should I add:
Rain
Sleet
Snow
Leaves
Wind
If you can come up with anything else let me know.
Final day of the kickstarter campaign and my team and I decide to cap it off by doing ... musical numbers online.

These are clearly definitely My People.
6 hours and 35 minutes until it is December first here :3

Forum statistics

Threads
117,086
Messages
1,104,448
Members
153,079
Latest member
Lnaunboq
Top