How do I make an Inn?
There are various ways to make an inn.
You have three main ways to do a INN. The first one, using the first one provided by the OHRRPGCE as a possible function for a shop . This way is recommended first because you also get this very INN the ability to raise hero from dead as a bonus which is helpful if you want to start implementing your battle system quickly and beeing able to restore your party without lines and lines of code.
The second one is for intermediate-level plotscripting writer, which consits in using text boxes with choices or text boxes and a menu. Finally the third one- the most difficult, is doing your INN as a slice collection. This third one won't be explained here but in another article (see above for more details).
First method: with a shop that has a INN function[edit]
Make you INN able to revive heroes from the dead[edit]
Before, we start, there are some important remarks to make. As mentionned in the introduction, the INN provided by the OHRRPGCE includes a revive function. As I explained above, this "revive heroes for the dead" function can very useful when you don't have a church yet.
If you intend to make your own battle system first, you need to be able to revive dead heroes.Every Rpg player knows that heroes can die though a battle (especially when the hero does not have enought EXP) The reviving function can be activated by doing the following . Go under custom. Choose edit the general map datas . Then go down to "preference bitests" and hit "Inns revive dead heroes."
Your heroes will be both restored and revived at the same place, which is a blessing while implementing your own battle system.
Transform a shop into a INN and make a script[edit]
So let's go! To make a Inn, you need only a global variable, a shop and 4 text boxes along with an NPC for INN Kepeer. Global variables can be tricky for beginners but here we're not using a lot in these scripts, (but will be the case with the other methods) so no need to worry.
Go under custom and edit the shop. Edit a shop items and choose Inn. Name it Town INN Pick up a price. (Here we choose $ 15). Then go into the text box menu and pick up four free text boxes.
The first (text box 23)
Inn Keeper: You want to stay? I'm sorry but you appear to not have enough money. A night is $15. May be later.
The second (text box 24)
Narration: Your HP & MP have been restored!
The third (text box 28)
Inn Keeper : Good morning! Did you sleep well?
The fourth (text box 20)
Inn Keeper : Welcome to the inn! Would you like to stay?
Edit the conditionnal and make sure you see :
shop: always do the following go to shop: town inn
Save up the datas. Now you can save your game, leave custom and edit the hss file.
Open your game hss file and add the following scripts.
#--------------------------------------------------------------------------- define script (31, inn keeper basic script, none) define script (32, basic inn, none) global variable (my money) #--------------------------------------------------------------------------- #script for the inn keeper plotscript, inn keeper basic script, begin suspend npcs suspend player set variable (my money, party money)# store current amount of money in variable for checking wait (3)# very important a lot of commands are launched if (MyMoney >= 15), then, begin # we check if we have at least 15 show text box (20) #access inn : text box which go to the shop with an INN function wait for text box end #end for the if if (MyMoney < 15), then, begin # we check if we have less than 15 show text box (23) #inn tender: You want to stay? I'm sorry but it seems that you don't have enough cash wait for text box end #end for the if resume player resume npcs end #end of the plotscript here #--------------------------------------------------------------------------- script, basic inn, begin if (pay money(15)) then, begin suspend player suspend npcs variable(loop) # gradual fade out for(loop,0,-21,-1) do( reset palette tweak palette(loop*2,loop*2,loop*2) update palette wait(4) ) # insert here what happens during the night. You can also delete from the line variable (loop) until suspend box advance # and personalise your script. # gradual fade in for(loop,-21,0) do( reset palette tweak palette(loop*2,loop*2,loop*2) update palette wait(2) ) suspend box advance show text box (24) #Hp & Mp restored wait (25) advance text box resume box advance show text box (28) #Inn Keeper: did you sleep well? wait for text box resume player resume npcs end #end for the if end #end of the script #-------------------------------------------------------------------------------------------
Finally go back under custom. Import the hss file.
Leave the script menu and edit the map menu. Pick up the indoor map. Edit the npcs. Pick up the "Inn Keeper Npc" Give it the script "inn keeper basic inn script". Edit the shops. Pick up the shop that has a INN function. Go down until you see the line "Inn Script". Press enter and pick up "basic inn". Save up your game. As you have implement quite a lot of new things , you may want to leave custom.exe copy your .rpg file and have a back up copy before coming back and editing your game datas again .
You can now test the whole system. This system is simple and it will help you thoughout game implementation and beta tests. It restores your stats cleaninly and easily. Later, when you start working on your own church/ revive spot, you will be able to make it a simple INN . To do so, you'll just go back to the main menu edit the general game data. Go down to preference bitsets. Check "Inns revive dead heroes" is not active/ not selected.
And then, later again once you're confident enough with your plotscripting skills, you may want to update your INN to the one described in the above sections.
Before we leave you may want to update the INN fees. The only way now is to make several INNs and give them several price. So go back under custom and edit the shop. Let's stay that you first INN was shop (4) with $15. Pick up another one let's say shop (6). Make it a INN and give it a bigger price $30. Give same script basic inn script". Finally pick up a third one. Again make it a INN. Give it a important price $60 and the same script "basic inn". This last one if shop (8)
Go under the text box menu and break the link between the shop and the inn. Make text box 20 a simple one. Edit the conditionals and make sure you DON'T SEE shop always do the folowing use shop 4 anymore. Edit also text 23 and update the content. Use ctrl + space and then arrow key to access the font table and insert the signs you need.
Inn Keeper: You want to stay? I'm sorry but you appear to not have enough money. A night is ${v17}. May be later.
To trigger the shop with the right value and the right shop, we're going to use the powerful switch command and a global variable.
Then edit you hss file. On the top of the file add the line
global variable (17, inn fees)
Finally you need a way to check so that the price can change. Check in plotscripting generally means check tag. But the tag are precious ressources so it's better to use another way: the maps! What do we want? We would like the price of the INN to go up as we proceed through the various villages.
Each town is linked to a map and each map has a name which is reference into your hsi file. Each village has indoor maps, that means maps which
correspond to the inside of the buildings. So we're going to use the command "current maps" for updating fees.
In this example, the first village is named Haling cove, the second one Arkas City and the third one Minter Village. To make the script works it is important to have the correct names. So open the hsi file and search for the line starting with map: So in our example, we'll have map:HC indoors map: Arkas indoors and Minter indoors. Now that everything is set and ready to go, we can adapt our script.
#script for the inn keeper plotscript, inn keeper basic script, begin suspend npcs suspend player set variable (my money, party money)# store current amont of money in variable for checking inn fees:=0 #reset the process just to be sure if (current map (map:HC indoors)==true)then, begin inn fees:=15 end if (current map (map: Arkas indoors)==true)then, begin inn fees:=30 end if (current map (map: Minter indoors)==true)then, begin inn fees:=60 end wait (3)# very important a lot of commands are launched if (MyMoney >= inn fees), then, begin # we check if we have at least the right fee amount show text box (20) #access inn : text box which presents the INN wait for text box switch (inn fees) do, begin case (15) do, begin # price is $15 go to shop 4 use shop (4) end case (30) do, begin # price is $30 go to shop 6 use shop (6) end case (60) do, begin # price is $60 go to shop 8 use shop (8) end end #end for the switch end #end for the if if (MyMoney < inn fees), then, begin # we check if we have less than 15 show text box (23) #inn tender: You want to stay? I'm sorry but it seems that you don't have enough cash wait for text box end #end for the if resume player resume npcs end #end of the plotscript here #---------------------------------------------------------------------------
Finally adapt your basic inn script. Change the line
if (pay money(15)) then, begin
to
if (pay money(inn fees)) then, begin
Why would you do that? Well because you don't want to actually pay/ lose 15 gold whereas you should pay 60!
Et voilà! A bit shop consuming... but it works. This method does not save on shop but save on script & tags, which is better than nothing I guess.
Before we finish you may wonder how can I update the Inn fees without use a different shop each time. To do so, just continue to the next section.
Indeed in most rpg, as time passes the hero gain more money along with levels so it is logical to want to update the fees so that the price a stay at the INN doesn't become ridiculously low into the party's budget. In fact a demand has been made for the creation of a new command probabily called set inn price which will do just that: it will allow you to change the price of an INN through plotscripting. When it implemented the article will be updated.
Second method: with a text box with choices and plotscripting[edit]
With this second method we're going to use a simple text box with choices.
So let's go! To make a Inn, you need only 2 global variables, a shop and 4 text boxes along with an NPC for INN Kepeer. Global variables can be tricky for beginners but here we're not using a lot here so that this should be ok. See this as an opportunity to understand how they work.
Go under custom and edit the shop. Edit a tex box
First go into the tag section and choose a free tag. Name in "pay in the INN keeper" or "Stay for the night" any other name you find useful. Choose a global variable which is free. Here we going to use global variable 7
Then go into the text box menu and pick up four free text boxes.
The first (text box 20)
Inn Keeper : Welcome to the inn! Would you like to stay? It's cheap ${v7}
Then edit the choices. Make choices available. Write Pay and Cancel. If Pay is chosen the tag "Stay for the night" is turned on and if Cancel is chosen the same tag is turned off. Go back to the text section and write your message. Use ctrl + space and then arrow key to access the font table and insert the signs you need. Then proceed to the other text boxes.
The second (text box 24)
Narration: Your HP & MP have been restored!
The third (text box 28)
Inn Keeper : Good morning! Did you sleep well?
The fourth (text box 23)
Inn Keeper: You want to stay? I'm sorry but you appear to not have enough money. A night is ${v7}. May be later.
Export your hsi files. Now you can save your game, leave custom and edit the hss file. Open your game hss file and add the following scripts.
#--------------------------------------------------------------------------- define script (31, inn keeper basic script, none) define script (32, basic inn, none) global variable (5, my money) global variable (7,inn fee) #--------------------------------------------------------------------------- #script for the inn keeper plotscript, inn keeper basic script, begin if (check tag (tag:stay for the night)==on) then begin #Pay has been chosen. Check if there is enough money. suspend npcs suspend player set variable (my money, party money)# store current amont of money in variable for checking set variable (inn fee, 15) #INN fees is 15 if (MyMoney >= inn fees), then, begin # we check if we have at least 15 show text box (20) #access inn : text box which choices enabled wait for text box end #end for the if if (MyMoney < inn fees), then, begin # we check if we have less than 15 show text box (23) #inn tender: You want to stay? I'm sorry but it seems that you don't have enough cash! wait for text box end #end for the if pay resume player resume npcs end #end for the if check tag if (check tag (tag:stay for the night)==off), then begin #Cancel has been chosen. Nothing special happens. wait (1) end #end for the if check tag end #end of the plotscript here #--------------------------------------------------------------------------- script, basic inn, begin if (pay money(inn fees)) then, begin suspend player suspend npcs variable(loop) # gradual fade out for(loop,0,-21,-1) do( reset palette tweak palette(loop*2,loop*2,loop*2) update palette wait(4) ) # insert here what happens during the night. You can also delete from the line variable (loop) until suspend box advance # and personalise your script. #restore party members Hp & Mp set hero stat(0,stat:hp, get hero stat(0,stat:hp,maximum stat), current stat) set hero stat(0,stat:mp, get hero stat(0,stat:mp,maximum stat), current stat) set hero stat(1,stat:hp, get hero stat(1,stat:hp,maximum stat), current stat) set hero stat(1,stat:mp, get hero stat(1,stat:mp,maximum stat), current stat) set hero stat(2,stat:hp, get hero stat(2,stat:hp,maximum stat), current stat) set hero stat(2,stat:mp, get hero stat(2,stat:mp,maximum stat), current stat) set hero stat(3,stat:hp, get hero stat(3,stat:hp,maximum stat), current stat) set hero stat(3,stat:mp, get hero stat(3,stat:mp,maximum stat), current stat) # gradual fade in for(loop,-21,0) do( reset palette tweak palette(loop*2,loop*2,loop*2) update palette wait(2) ) suspend box advance show text box (24) #Hp & Mp restored wait (25) advance text box resume box advance show text box (28) #Inn Keeper: did you sleep well? wait for text box resume player resume npcs end #end for the if end #end of the script #-------------------------------------------------------------------------------------------
Finally go back under custom. Import the hss file. Leave the script menu and edit the map menu. Pick up the indoor map. Edit the npcs. Pick up the "Inn Keeper Npc" Give it the script "inn keeper basic inn script".
Edit the text. Edit text box 20 again. Edit the conditionals. Go down to the last line. Change to:
Always do the following run "basic inn script"
Finally the last thing to do is to make a script to help us to trigger the whole thing.
#------------------------------------------------------------------- script, npc is killing you, begin suspend player suspend npcs show text box (40) #sorry I have to kill you wait for text box set hero stat (0,stat:hp, 5,current stat) set hero stat (0,stat:mp, 6,current stat) set hero stat (1,stat:hp, 2,current stat) set hero stat (1,stat:mp, 8,current stat) set hero stat (2,stat:hp, 4,current stat) set hero stat (2,stat:mp, 5,current stat) set hero stat (3,stat:hp, 6,current stat) set hero stat (3,stat:mp, 3,current stat) resume player resume npcs end #end for the script #----------------------------------------------------------------------------------------------
What does this script does? Well it basically puts down all your hp & mp so that you have reasons to use the inn. This way you can check that thanks to the INN script, you stats can come back to normal. Give this script to an Npc and change to number of the text box to the one you chose.
The line of code regenerating your stat functions perfectly. Finally another good news: just like the INN system above, the script can "revive the heroes from the dead" as there are no pre-requiered conditions to be able to change stats except money. Again just like the original INN.
Save up your game. As you have implemented quite a lot of new things, you may want to leave custom.exe copy your .rpg for a back up copy before coming back and editing your game datas again. Finally, how to change Inn fees?. Well that's easy you change the value of the global variable. Go up and search for this line
set variable (inn fee, 15) #INN fees is $15
When you want to update the INN price, you just need to change the figure after INN. For example put $30 to double the amount
set variable (inn fee, 30) #INN fees is $30
The new tariff will be applied in the text boxes. Using a global variable for one change into 2 text boxes may seem extreme but if you want to make a embettered version of this later (like adding restrictions for hero with 0 hp and a tarif update in step 5 or 6 or your RPG story), you won't have to search for another price to update price system.
You can now test the whole system. As always, if you have problems implementing this, you can ask for help on the forum or on Discord.
See Also[edit]
- How to use NPCs and Tags
- How do I make a INN that does not revive dead heroes?
- How can I make it so that an inn restores HP, but not MP?
- How do I make an INN using a slice collection and a menu?
- How do I prevent a dead hero from reviving at the Inn?
- How do I restore my hero's stats during a plotscript?