How do I make an INN using a slice collection and a menu?

In this article, we're going to see how to use a slice collection and a menu to make a INN. These requiere advance knowledge in ploscripting so you may want to check the other ways and be cure that they don't feet your game design before going any further.
What is a "fake inn?"
Well that's a INN made by you but which looks like exactly like the one you have access to when you turn a shop into a INN. By fake INN, I simply means that looks exactly like the one you get by default under custom.
That's right, in this article, you're going to see how to make an inn that is exactly like the one included with custom.exe. To do so, we'll have to include the text box which display stats. This will be an good opportunity to combine everything we've seen about plotscripting so far: slices collections, strings, menus and fake text boxes.
Before we start I assume that you already have put into place the inn tender NPC (along with other INNn customer npcs maybe) on the INN indoor map and that your heroes have stats. We'll also need an NPC which looks like an enemy and one that looks like theft. It can also be a monster. I also assume that your party has money when you start testing. . (Reminder : You can give your party money either by placing a treasure chest or by editing the General game settings and choose an amount of money to start with).
If you don't see what I'm talking about I advise you to read the HOW TO chapters and come back to this article again later. Implementing a fake INN needs advance plotscripting knowledge, you need to have some experience. It is strongly recommended before going further in this article
There are ways more simple than this to make an INN. Feel free to read the other articles (the links are in the See Also section below) about them if you feel that they are more likely to meet your needs!
You may wonder what about making something that has already been implemented by other? Well I think that making a fake inn is also a great opportunity to revise how to store & display slice collection (among other things). If you want to make your own battle system, it's a great way to start as making a INN is a bit easier!
Without further dues, let's go!
First Step: setting up the system[edit]
The first things we're going to do is to make the fake text boxes and set up the menu. We're going to use slices which will be in a collection. That will allow us to display several boxes at a time. A collection here is all the more handy as you have to adapt the text box which displays the heroes stats.
We also need global variables. We'll start with that.
Global variable (7, My Money) Global variable (15, inn fees) Global variable (19, Inn Slice Collection handle) ) #use to control appear or disappear the whole "fake inn" Global variable (20, put Inn keeper dialogues on screen) Global variable (21, put Inn keeper displays party details on screen) Global variable (23, Menu Handle) #use to control menu made with the item menu
There's one four our current money another one for the INN fees, the third one is for
slice collection handling. The two following ones are for dialogues update and manipulation.
To the last one if to control the menu made with item menu. It will be use
to prevent the player from choosing pay or cancel too early.
We'll also need to add global variable which will be linked to slice look up codes to manipulate the slice pieces inside our collection but we'll add them later.
Then edit the menus. Pick up a free one. Here we'll pick up menu 13.
Give it a name like "my INN menu" or another name that may come helpful to you.
Give it two items. The first one is pay and the other one is cancel.
Make you sure you hit the following bitsets
Allow gameplay & scripts Suspend player even if allowed No Box Disable player control of menu Disable player closing menu Prevent main menu activation Advance text box when menu closes
Edit the menu items. Choose pay. Edit the bitsets. Hit the bitset
close menu when activated
Edit the menu items. Choose cancel. Edit the bitsets. Hit the bitset
close menu when activated
Go into reposition menu and change the offset. Use the arrow until you see -7, -13 (or close to it) This will make your menu pops up on your slice menu box. Next go under windows and pick up a simple text file. Name my_game_string_list_memo.txt
In this text file you'll note what figures is attributed to what string. It may seem like something unimportant but we you're doing high level plotscripting you need to keep in mind which string does what so that you don't re-use a string which contents in already on screen.
So here is what it should look like.
String lists for my game #change my name by the actual name of the game you're developing
We can use 99 strings (0-> 98)
0
1
2
3
4
5 Current Heroes' name in slot 0
6 Current Heroes' name in slot 1
7 Current Heroes' name in slot 2
8 Current Heroes' name in slot 3
9
We'll use those strings for displaying the name of the hero.
Save your text file.
Go under custom again. Edit the slice collections. Pick up a free one and name it INN (or as always as other name that may come useful to you) Here we'll pick slice collection number 2
Go with the down arrow. Press the key + and add a rectangle.
Give it the following characteristics
[Dimension]
x: 9 y: 8
width: 295 height: 47
[Rectangle settings]
Style: 0 Background color: 18 Foreground color: 28 Border Style: 0 Translucency: fuzzy Fuzzyness: 50% Fuzzy zoom: 1 Stationary pattern: no
The press + again. This time add a text slice. Give it a look-up slice code (INN Keeper dialogue) Adding a new slice code is easy. Just press enter and then the down arrow key to select a free one. Type a name for your slice-up just like you would do with your Rpg dialogue. Once it's down use the up arrow to choose previous menu and valid with enter. You're back to your slice text. Give it the following characteristics
[Dimension]
x: 6 y: 4 width: 40 height: 10
[Visibility]
Visible : no Clip children :no
[Text Settings]
Press enter and type Inn Keeper: Hello! Welcome to our INN! Would you like to stay?
We want the text slice to invisible so that the player cannot see on screen 0 transforming into text. We'll make it visible again through plotscripting. Press sec to leave the text input sub-menu and text use the up arrow key to select previous menu. Valid with enter. You're back to slice collection tree.
The press + again and add another rectangle. Once it's created. Go up and highlight your text slice. Press Shift and the right arrow key to organise your slice tree.
The slice text will move slightly on the right and will be linked to the first rectangle
Next, press + again. Create another rectangle. This time give it the following characteristics
[Dimension]
x: 65 y: 40
width: 191 height: 65
[Rectangle settings]
Style: 0 Background color: 18 Foreground color: 28 Border sytle: 0 Translucency: fuzzy Fuzzyness: 50% Fuzzy zoom: 1 Stationary patern: no
The press + again. Add a text slice. (This slice will be for displaying the party money and INN fees.
Give it a look-up slice code (INN Keeper displays party details) Adding a new slice code is easy. Just press enter and then the down arrow key to select a free one. Type a name for your slice-up just like you would do with your Rpg dialogue. Once it's down use the up arrow to choose previous menu and valid with enter. You're back to your slice text. Give it the following charactersitics
[Dimension]
x: 7 y: 7 width: 48 height: 10
[Visibility]
Visible : no Clip children :no
[Text Settings]
Press enter and type THE INN costs $${v15} You have $${v7}
Just like the first one, we want the text slice to invisible so that the player cannot see on screen 0 transforming into text. We'll make it visible again through plotscripting.
Press sec to leave the text input sub-menu and text use the up arrow key to select previous menu. Valid with enter. You're back to slice collection tree.
Just like we've done with the first slice text select and press Shift and the right arrow
key AT THE SAME TIME to move slightly to the right your slice and
link it to the right rectangle.
Now the first step for the slice collection is complete. Compare what you have with the screenshot above and correct the mistakes if there are any.
INSERT SCREENSHOT HERE
Leave the slice collection menu and edit your .his file and then save your game.
Next, edit your hss file and add the following scripts.
Then, edit your hss file and add the following scripts.
define script (41 ,innkeeper script, none) define script (44 ,inn pay script, none) define script (45 ,inn cancel script, none) #-------------------------------------------- plotscript, innkeeper script, begin suspend npcs suspend player My Money:=0 #cleanly reset variables inn fees:= 0 wait (3) set variable (My Money, party money) # Store Money for later comparaison inn fees:= 34 # price is $34. But you can change the figure if you want. Inn Slice Collection Handle := load slice collection (2) textbox text (4, 9) #string 4 to is display content of text box 9 put Inn keeper dialogue on screen:= lookup slice (sli:inn keeper dialogue) set slice visible (put Inn keeper dialogue on screen, on) textbox text (5, 4) #string 5 to is display content of text box 4 put Inn keeper displays party details on screen:= lookup slice (sli:inn keeper displays party details) expand strings in slices (put Inn keeper displays party details on screen) set slice visible (put Inn keeper displays party details on screen, on) open menu (13) wait (2) menu handle:= find menu ID (13) set menu bit(menu handle, menubit:no controls, off) wait (1) resume npcs resume player end# end for the script #-------------------------------------------------- plotscript, inn pay script, begin suspend player suspend npcs wait (1) resume npcs resume player end #end of the script #-------------------------------------------------- plotscript, inn cancel script, begin suspend player suspend npcs free slice (Inn Slice Collection handle) menu handle:= find menu ID (13) #check if menu is already open. If it is not closed, close it. if (menu handle) then (close menu (menu handle)) wait (3) resume npcs resume player end #end of the script #-------------------------------------------------
Finally go under custom and import your HSS file. Save up the whole thing! Then go into edit menus. Pick up menu 13, you hand-made Inn menu.
Edit the menu items. Choose pay. Make sure you see
type 4 run script script sub-type : inn pay script.
Then, choose cancel. Make sure you see
type 4 run script script sub-type : inn cancel script.
You can now go back and edit the maps. Pick up the map which corresponds to your INN interior. Edit the Inn Keeper npc and give him/ her the Inn Keeper Script. (Check that it is correctly placed on the map. Ideally near the entrance of the INN)
Save your game again! You are now ready for your first test. Launch your game and got and speak to the NPC. You should see the fake text box (with text in it) and the menu.
Choose cancel to leave. Be sure to choose cancel and not pay to make everything disappear cleanly. If you choose pay by error, start a test game again.
Once everything works fine, feel free to proceed to the next step.
Step Two : checking stat record and stat display along with Inn fees[edit]
In this section we're going to test if the portion of codes dedicating to hero slot hero hp hero mp and hero name works normally. To do so, we'll add two npcs. One of them will be a theft who will rob the party money and the other one will be a monster who will attack us and will leave us with only a small amount of Hp & Mp.
So first, just as your learned in the how to, edit your graphics and check that you have something which corresponds to this description (If now draw walkabout graphics). Then, edit the map and give those graphics to two distinct NPCs. Place them on the map not for from the INN door.
Go under custom edit text boxes. Pick up a free one and write something like
Monster: I have to kill you!
Pick up the next one and write something equivalent to
Thieft: Hey hey... look what I got! Narration : Your money pouch had been stolen. You lost all your money! Hero: Oh no!
In our example it will be text box 33 and text box 34.
Then add the following scripts into your game
define script (51, Killer Npc script, none) define script (52, Thief Npc script, none) #--------------------------------------------------------------- # script that enable you to weaken your heroes without going into battle plotscript, Killer Npc script, begin suspend player suspend npcs show text box (33) #sorry I have to kill you wait for text box set hero stat (0,stat:hp, 0,current stat) set hero stat (0,stat:mp, 1,current stat) set hero stat (1,stat:hp, 5,current stat) set hero stat (1,stat:mp, 1,current stat) set hero stat (2,stat:hp, 0,current stat) set hero stat (2,stat:mp, 2,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 of the plotscript #-------------------------------------------------------------------------------------------------------- #script for the NPC who will stole our money plotscript, Thief Npc script, begin suspend player suspend npcs set variable (My Money, party money) lose money (MyMoney) show text box (34) #hey hey Give me your money . Hero: NO! Argh! Narration: You loose all your money wait for text box resume player resume npcs end #end of the plotscript #--------------------------------------------------------------------------------------------------------------
As you've learned in the how to series, go under custom, edit successively the npcs and give them their respective scripts. Check also their location on map. They musn't be far from the INN. You may also want to check the other member of the party. When the game starts they are generally NPCs like any others.
For better testing experience, it's best to find all these NPCs (monster npc that kills you, the one that robs you and you futur party member quickly. Ideally on the same part of the same map.
We can now tackle the issue of heros stats storing and heros stats storing displaying. But before to do that
we need to check that the Inn Keeper had been paid.
As you noticed, our inn pay script basically does nothing. That's what we're going to change. We use the command if and the global variable inn fees to check our condition.
So go into your hss file and edit the script called inn pay script. Add the following lines.
#-------------------------------------------------------------------- plotscript, inn pay script, begin suspend player suspend npcs if (My Money >= inn fees) then, begin #if we have $34 dollars or more wait (1) end, else, begin #if we don't have $34 dollars or more simply leave cleanly the menu. free slice (Inn Slice Collection Handle) menu handle:= find menu ID (13) #check if menu is already open. If it is not closed, close it. if (menu handle) then (close menu (menu handle)) wait (3) end# end for the if resume npcs resume player end #end of the script #-------------------------------------------------------------------------------------
What does this update do? Well, it simply make sure that just like the INN implemented by default, you do nothing except leaving the INN menu if your don't have enough money.
Make a quick test. Go and speak to the NPC which robs you of your money. Check that you have $0 and go to speak the INN Tender. Try to stay for the night whereas you don't have enough cash by choosing pay. Normally, nothing should happen.
We could choose to add a text box with the Inn Keeper saying "sorry but it seems that you don't have enough money"
but things are already enough complex like at his stage, so I chose to add it later.
Go and speak to monster NPC and check that you stats are not full. (It means you must not have 14/14 HP or 24/24 MP after speaking the monster NPC)
Now that we have checked that INN Keeper will not offer services for free we can focus on the meat of the script: healing and reviving heroes.
Store and display stats[edit]
As we have seen in other articles about INNs & churches we need to store stats with global variables for both reviving and healing purposes.
As the plotscript dictionary says, the commands we need to use are :
set hero stat (for direct stat modifications) get hero stat (for storing a hero stats) find hero (for identifying which hero should has his/her stats modified) hero by rank (for identifying among all the heroes in the edit hero menu who is currently in the party or not)
The tricky part will be combining them correctly in our code. To overcome this "trickyness" is one of the main purpose of this article.
So we'll need to use plenty of global variables. So edit your Hss file and add all those lines.
global variable (26, hero in slot 0 check) global variable (27, hero in slot 1 check) global variable (28, hero in slot 2 check) global variable (29, hero in slot 3 check) global variable (30, hero 0 level hp current) global variable (31, hero 1 level hp current) global variable (32, hero 2 level hp current) global variable (33, hero 2 level hp current)
global variable (34, hero 0 level hp max) global variable (35, hero 0 level hp max) global variable (36, hero 0 level hp max) global variable (37, hero 0 level hp max)
Finally, we'll also need a global variable which allows us to store the number of dead heroes.
Global variable (39, dead heroes)
Some remarks : - We need the command hero by slot and not hero by rank because what matters in our situation is the current party slot in which the hero is. (See the article Ways to refer to a hero in a script for more details) - You have four party slots but 0 is considered as a slot. (You count them just like building floors) - As we have seen in other articles there is an difference between current stat and maximum stat.
What are the differences between "current stat" and "maximum stat" ?
Let's imagine that we have something like this. You have 3 heroes Jessa, Pyra & Milo in your party. When you open the status screen you see:
Jessa Lvl1 Hp 4/15 MP 2/34 Pyra Lvl2 HP 8/25 Mp 4/32 Milo Lvl2 HP 9/27 Mp 5/31
What does these figures means?
The first figure after HP corresponds to current stat and the second to the maximum stat.
In our example the first héroïne, Jessa has currently 4 point out of 15. It means that out the 15 points she could get (it's her maximum) she currently has only 4 points.
We can deduce, that this character needs healing as it has less than half of HP it can possibly has.
(We can also deduce from the HP & MP maximum stat figures alone that the level of the character must be pretty low. There are only has two figures for maximum- but I digress) The same goes with MP. We can see that Jessa has only 2 mp out of the 34 she could get if her health was at the top! That implies that she has cast spells several times.
The INN that comes with custom displays both hp current stat and hp max stat, so that the player can see if Jessa (or any other hero with low HP need healing). That's why we have two types of variable, for hp: hp current and hp maximum
Now to test all this? Well the best way is to use again a simple NPC that a displays a script. In our example this will be a INN
customer which will display a text with our name, our current HP and our maximum HP
So edit the text box menu and pick up a free one. Type in it
Here are your heroes stats Hero ${s7} Hp ${v30}/ ${v34} Hero ${s8} Hp ${v31}/ ${v35} Hero ${s9} Hp ${v32}/ ${v36} Hero ${s10} Hp ${v33}/ ${v37}
In our case this will be text box 36. So how does this works. As we defined above, the hero in each slot has been assigned a global variable to store current Hp& maximum HP.
The first part of the line of code ${s7} implies the use of strings. String will enable us to put on screen directly the hero name according to it party's slot and the following two variables will be used both to store and display the stats of the hero in the given slot.
But before we forget, we need to update our text file related to string. Why did we make such a file already? Well simply because we can't use the same string tow times into the same script. So we need to keep a track of the different uses we make of our string to always keep in mind which string is free at such given moment.
When it's simple dialogue updates, it's not that important but with a big slice collection you can easily try to use a string which you are already using in the part of the collection.
So open the text file we made in the last section and update it. Pick up 4 free strings slots.
String lists for my game #change my name by the actual name of the game you're developing
We can use 99 strings (0-> 98)
0
1
2
3
4 Display Inn Keeper dialogues (use in combination with the command text box text)
5 Display INN menus (costs and current amount of money the party has)
6
7 used to display hero name in slot 0 at the INN
8 used to display hero name in slot 1 at the INN
9 used to display hero name in slot 2 at the INN
10 used to display hero name in slot 3 at the INN
11
12
13
14
15
Save your text file.
Go back under Custom and save your game. Next, you can go under windows and add the following script
#------------------------------------------------------------------------------------------------------ #script used for tests plotscript, customer NPC script , begin suspend npcs suspend player hero in slot 0 check:=hero by slot (0) # store the number which corresponds to the slots in the order menu. From 0 to 3. hero in slot 1 check:=hero by slot (1) hero in slot 2 check:=hero by slot (2) hero in slot 3 check:=hero by slot (3) wait (3) set variable (hero 0 level hp, get hero stat (find hero (hero in slot 0 check), stat:hp,current stat)) #store hero 0 HP stats set variable (hero 0 level hp, get hero stat (find hero (hero in slot 0 check), stat:hp,maximum stat)) set variable (hero 1 level hp, get hero stat (find hero (hero in slot 1 check), stat:hp,current stat)) #store hero 1 HP stats set variable (hero 1 level hp, get hero stat (find hero (hero in slot 1 check), stat:hp,maximum stat)) set variable (hero 2 level hp, get hero stat (find hero (hero in slot 2 check), stat:hp,current stat)) #store hero 2 HP stats set variable (hero 2 level hp, get hero stat (find hero (hero in slot 2 check), stat:hp,maximum stat)) set variable (hero 3 level hp, get hero stat (find hero (hero in slot 3 check), stat:hp,current stat)) #store hero 3 HP stats set variable (hero 3 level hp, get hero stat (find hero (hero in slot 3 check), stat:hp,maximum stat)) set variable (hero 4 level hp, get hero stat (find hero (hero in slot 4 check), stat:hp,current stat)) #store hero 4 HP stats set variable (hero 4 level hp, get hero stat (find hero (hero in slot 4 check), stat:hp,maximum stat)) wait (3) show text box (36) wait for text box resume npcs resume player end #end for the script #------------------------------------------------------------------------------------------------------
As you usually do, import your hss file. Edit the maps. Choose the one which corresponds to the INN interior. Pick up an free NPC. Make it run the script. place it on the map (not too far from the entrance would be great).
Save your game. Make a test. Go to speak to the INN customer. Ideally add 3 heroes to your party before you speak to him/ her. Use the team menu and the order menu to change heroes and swap their places in the party. Check that the value which appears in the text box are correct for each move you made.
To take back our example: if you have an hero named Jessa which has 4/15 HP, you should see it in the text whatever slot you put her in.
Again if you have trouble implementing at this step, take the time to read Hspeak.exe messages and don't hesitate to ask for help on the discord. I advice you to double check that the script works correctly by speaking ten times at least to the INN customer as it will helpful later on.
When it's done, we can move to the next step , make a slice collection.
Step Third : making a slice collection for displaying heroes information[edit]
Ok. So the code of line for storing heroes name hero current hp and hero maximum works. We know that value inside our global variables are correct because when we speak to INN Customer it displays a text box with our current name current hp and maximum hp correctly for all the heroes whatever slot they're in.
Now, how could we include these lines into our inn system?
We'll the best way to do so is to update our slice collection called INN menu and include these lines inside text slices.
We're going to add slice rectangle and text slice and use loop up code to turn them on or off according to our needs.
So go under custom and edit the slice collection and pick up the INN Menu slice collection. Go and Press + and add a rectangle slice just after the one which the slice look-up code "inn keeper dialogue". Make it a rectangle relatively small. This rectangle will be the stat display but when we have only one hero in the party.
Add the slice look up code "one hero at the INN". Then add a slice text above it. Edit the text slice and choose text settings. Then choose text and press enter Write
Hero ${s7} Hp ${v30}/ ${v34}
Press esc to go back to the previous menu . Give it a slice look up code. I chose "hero slot 0 inn box stats" but you can pick any other name that may seem meaningful to you.
Tip n°1 to order your slice tree you first need to make sure that the slice in our left side of the screen before moving it up or down.
Tip n°2 To be sure not to make typo errors when you edit the text box menu. Go back to the text box menu. Edit text box 36 and press F12 to take a screenshot. This way, you'll have
a copy for each of the lines you're going to re-write with all the correct numbers. (You can also choose to write very thing on a piece of paper.
Finally go into the dimensions sub-menu and use the arrow key to place correctly first the rectangle box and then the text slice. Use the shit key and the right arrow key to make the text slice a child of the rectangle slice
Once they are correctly placed, pick the rectangle slice go down to visibility and turn it invisible.
visible: no
The rectangle slice and the text slice will both become orange and will not appear anymore. (There are still here. To make them appear again turn the visibility on again. Repeat the same process 3 times. Add a slice rectangle, then add a slice text in it. Each time add a line into the text slice
Hero ${s7} Hp ${v30}/ ${v34} Hero ${s8} Hp ${v31}/ ${v35}
Finally a look-up code for the rectangle and turn it invisible. The rectangle box for the text-box must
be larger each time. When you have two heroes in your parties, you'll have for the rectangle a look-up code name
"two heroes at the INN". "hero slot 1 inn box stats"
Here is a screenshot of what it should look like.
INSERT SCREENSHOT HERE
Once your slice collection is done. A last thing before we leave Custom.exe. We need tag. Tags will be used to store which slots are occupied or not. It will be even more useful in the next step. So back to the main menu and edit tag names.
Pick four free tags and name them : hero in slot0, hero in slot1, hero in slot2, hero in slot3 or as always any other names that may come handy to remember their purpose.
Finally export your hsi file. save your game. We made a lot of modifications, so you can couple the saving by making a copy of your RPG file. Nothing wrong with being extra-cautious and not loose a long time of work and implementation.
Go back under windows, edit your HSS file and edit the following script :
#------------------------------------------------------------------ # script which allows INN services to be provided to the heroes plotscript, inn keeper script, begin suspend player suspend npcs My Money:=0 #cleanly reset variables inn fees:= 0 wait (3) set variable (My Money, party money) # Store Money for later comparaison inn fees:= 34 hero in slot 0 check:=hero by slot (0) # store the number which corresponds to the slots in the order menu. From 0 to 3. hero in slot 1 check:=hero by slot (1) hero in slot 2 check:=hero by slot (2) hero in slot 3 check:=hero by slot (3) wait (2) set tag (tag: hero in slot0, off) #reset hero detection in slots set tag (tag: hero in slot1, off) set tag (tag: hero in slot2, off) set tag (tag: hero in slot3, off) Inn Slice Collection Handle:= load slice collection (2) put Inn Keeper dialogue on screen:= lookup slice (sli:inn keeper dialogue) set slice visible (put Inn keeper dialogue on screen, on) put Inn keeper displays party details on screen:= lookup slice (sli:inn keeper displays party details) expand strings in slices (put Inn keeper displays party details on screen) set slice visible (put Inn keeper displays party details on screen, on) open menu (13) # menu 13 is the Inn menu wait (5) nb of heroes in slots at the inn:=0 if (hero in slot 0 check == -1) then, begin #if slot 0 is free then... wait (1) end, else, begin increment (nb of heroes in slots at the inn, 1) set tag (tag: hero in slot0, on) end #end for the if check tag if (hero in slot 1 check == -1) then, begin #if slot 1 is free then... wait (1) end, else, begin increment (nb of heroes in slots at the inn, 1) set tag (tag: hero in slot1, on) end #end for the if check tag if (hero in slot 2 check == -1) then, begin #if slot 2 is free then... wait (1) end, else, begin increment (nb of heroes in slots at the inn, 1) set tag (tag: hero in slot2, on) end #end for the if check tag if (hero in slot 3 check == -1) then, begin #if slot 3 is free then... wait (1) end, else, begin increment (nb of heroes in slots at the inn, 1) set tag (tag: hero in slot3, on) end #end for the if check tag wait (3) if (check tag (tag: hero in slot0)== on) then, begin switch (hero in slot 0 check) do, begin #hero name identification and stats storing case (0) do, begin $21="Hiro" set variable (hero at the inn slot 0 hp current, get hero stat (find hero (hero in slot 0 check), stat:hp,current stat)) #Hero in slot 0 is Hongjun set variable (hero at the inn slot 0 hp max, get hero stat (find hero (hero in slot 0 check), stat:hp,maximum stat)) end #end of the case case (1) do, begin $21="Pyrus" set variable (hero at the inn slot 0 hp current, get hero stat (find hero (hero in slot 0 check), stat:hp,current stat)) #Hero in slot 0 is Lin Jinglong set variable (hero at the inn slot 0 hp max, get hero stat (find hero (hero in slot 0 check), stat:hp,maximum stat)) end #end of the case case (2) do, begin $21="Milo" set variable (hero at the inn slot 0 hp current, get hero stat (find hero (hero in slot 0 check), stat:hp,current stat)) #Hero in slot 0 is Mo Rigen set variable (hero at the inn slot 0 hp max, get hero stat (find hero (hero in slot 0 check), stat:hp,maximum stat)) end #end of the case case (3) do, begin $21="Jessa" set variable (hero at the inn slot 0 hp current, get hero stat (find hero (hero in slot 0 check), stat:hp,current stat)) #Hero in slot 0 Ah Tai set variable (hero at the inn slot 0 hp max, get hero stat (find hero (hero in slot 0 check), stat:hp,maximum stat)) end #end of the case end #end for the switch end #end for the tag if (check tag (tag: hero in slot1)== on) then, begin switch (hero in slot 1 check) do, begin case (0) do, begin $22="Hiro" set variable (hero at the inn slot 1 hp current, get hero stat (find hero (hero in slot 1 check), stat:hp,current stat)) #Hero in slot 1 is Hongjun set variable (hero at the inn slot 1 hp max, get hero stat (find hero (hero in slot 1 check), stat:hp,maximum stat)) end #end of the case case (1) do, begin $22="Pyrus" set variable (hero at the inn slot 1 hp current, get hero stat (find hero (hero in slot 1 check), stat:hp,current stat)) #Hero in slot 1 is Lin Jinglong set variable (hero at the inn slot 1 hp max, get hero stat (find hero (hero in slot 1 check), stat:hp,maximum stat)) end #end of the case case (2) do, begin $22="Milo" set variable (hero at the inn slot 1 hp current, get hero stat (find hero (hero in slot 1 check), stat:hp,current stat)) #Hero in slot 1 is Mo Rigen set variable (hero at the inn slot 1 hp max, get hero stat (find hero (hero in slot 1 check), stat:hp,maximum stat)) end #end of the case case (3) do, begin $22="Jessa" set variable (hero at the inn slot 1 hp current, get hero stat (find hero (hero in slot 1 check), stat:hp,current stat)) #Hero in slot 1 Ah Tai set variable (hero at the inn slot 1 hp max, get hero stat (find hero (hero in slot 1 check), stat:hp,maximum stat)) end #end of the case end #end for the switch end #end for the tag if (check tag (tag: hero in slot2)== on) then, begin switch (hero in slot 2 check) do, begin case (0) do, begin $23="Hiro" set variable (hero at the inn slot 2 hp current, get hero stat (find hero (hero in slot 2 check), stat:hp,current stat)) #Hero in slot 2 is Hongjun set variable (hero at the inn slot 2 hp max, get hero stat (find hero (hero in slot 2 check), stat:hp,maximum stat)) end #end of the case case (1) do, begin $23="Pyrus" set variable (hero at the inn slot 2 hp current, get hero stat (find hero (hero in slot 2 check), stat:hp,current stat)) #Hero in slot 2 is Lin Jinglong set variable (hero at the inn slot 2 hp max, get hero stat (find hero (hero in slot 2 check), stat:hp,maximum stat)) end #end of the case case (2) do, begin $23="Milo" set variable (hero at the inn slot 2 hp current, get hero stat (find hero (hero in slot 2 check), stat:hp,current stat)) #Hero in slot 2 is Mo Rigen set variable (hero at the inn slot 2 hp max, get hero stat (find hero (hero in slot 2 check), stat:hp,maximum stat)) end #end of the case case (3) do, begin $23="Jessa" set variable (hero at the inn slot 2 hp current, get hero stat (find hero (hero in slot 2 check), stat:hp,current stat)) #Hero in slot 2 Ah Tai set variable (hero at the inn slot 2 hp max, get hero stat (find hero (hero in slot 2 check), stat:hp,maximum stat)) end #end of the case end #end for the switch end #end for the tag if (check tag (tag: hero in slot3)== on) then, begin switch (hero in slot 3 check) do, begin case (0) do, begin $24="Hiro" set variable (hero at the inn slot 3 hp current, get hero stat (find hero (hero in slot 3 check), stat:hp,current stat)) #Hero in slot 3 is Hongjun set variable (hero at the inn slot 3 hp max, get hero stat (find hero (hero in slot 3 check), stat:hp,maximum stat)) end #end of the case case (1) do, begin $24="Pyrus" set variable (hero at the inn slot 3 hp current, get hero stat (find hero (hero in slot 3 check), stat:hp,current stat)) #Hero in slot 3 is Lin Jinglong set variable (hero at the inn slot 3 hp max, get hero stat (find hero (hero in slot 3 check), stat:hp,maximum stat)) end #end of the case case (2) do, begin $24="Milo" set variable (hero at the inn slot 3 hp current, get hero stat (find hero (hero in slot 3 check), stat:hp,current stat)) #Hero in slot 3 is Mo Rigen set variable (hero at the inn slot 3 hp max, get hero stat (find hero (hero in slot 3 check), stat:hp,maximum stat)) end #end of the case case (3) do, begin $24="Jessa" set variable (hero at the inn slot 3 hp current, get hero stat (find hero (hero in slot 3 check), stat:hp,current stat)) #Hero in slot 3 Ah Tai set variable (hero at the inn slot 3 hp max, get hero stat (find hero (hero in slot 3 check), stat:hp,maximum stat)) end#end of the case end #end for the switch end #end for the tag wait (3) switch (nb of heroes in slots at the inn) do, begin case (1) do, begin #only one hero put Inn hero stat box on screen:= lookup slice (sli: one hero at the Inn) slice is rect (put Inn hero stat box on screen) put hero stats for the INN stat box on screen:= lookup slice (sli: hero slot 0 inn box stats) expand strings in slices(put hero stats for the INN stat box on screen) wait (1) set slice visible (put Inn hero stat box on screen, on) set slice visible (put hero stats for the INN stat box on screen, on) end #end for the case case (2) do, begin #two heroes put Inn hero stat box on screen:= lookup slice (sli: two heroes at the Inn) slice is rect (put Inn hero stat box on screen) put hero stats for the INN stat box on screen:= lookup slice (sli: hero slot 1 inn box stats) expand strings in slices(put hero stats for the INN stat box on screen) wait (1) set slice visible (put Inn hero stat box on screen, on) set slice visible (put hero stats for the INN stat box on screen, on) end #end for the case case (3) do, begin #three heroes put Inn hero stat box on screen:= lookup slice (sli: three heroes at the Inn) slice is rect (put Inn hero stat box on screen) put hero stats for the INN stat box on screen:= lookup slice (sli: hero slot 2 inn box stats) expand strings in slices(put hero stats for the INN stat box on screen) wait (1) set slice visible (put Inn hero stat box on screen, on) set slice visible (put hero stats for the INN stat box on screen, on) end #end for the case case (4) do, begin #four heroes put Inn hero stat box on screen:= lookup slice (sli: four heroes at the Inn) slice is rect (put Inn hero stat box on screen) put hero stats for the INN stat box on screen:= lookup slice (sli: hero slot 3 inn box stats) expand strings in slices(put hero stats for the INN stat box on screen) wait (1) set slice visible (put Inn hero stat box on screen, on) set slice visible (put hero stats for the INN stat box on screen, on) end# end for the case end #end for the switch menu handle:= find menu ID (13) set menu bit(menu handle, menubit:no controls, off) wait (2) resume npcs resume player end #end of the plotscript #----------------------------------------------------------------------
As always take the time ro read any message Hspeak.exe would give you. Go and speak the Inn Keeper. Change your party members and the order into your party. The name and current HP should always be correctly displayed in the dedicated box.
Feel also free to go and speak to the enemy Npc and check that heroes with weaken HP stats also appears correctly. If you're troubled at this point, don't panic. Make small changes one a time and run the script again. As always you can ask for help on the forum.
Once the stat box functions correctly and that you can make disappear the INN menu whereas you have more or less than $34, you are good and ready to go!
Step four: implementation of the healing process[edit]
Before we took on the implementation for the healing process we going to add lines which makes displays a text box to let the player know that he's cannot make the party stay for the night because they don't have enough cash.
So go under custom. Pick a free text box and add the following
Inn Keeper: Sorry but it seems that you don't have enough money.
Pick up a free script, Name it "heroes revive at the INN".We're going to put just basic stuff. suspend ans resume commands for the player and the NPCS and a show value.
Now, you should have scripts that look like that
#------------------------------------------------------------------------------------- plotscript, inn pay script, begin suspend player suspend npcs if (My Money >= inn fees) then, begin #if we have $34 dollars or more heroes revive at the INN end, else, begin #if we don't have $34 dollars or more simply leave cleanly the menu. free slice (Inn Menu handle) menu handle:= find menu ID (13) #check if menu is already open. If it is not closed, close it. if (menu handle) then (close menu (menu handle)) wait (3) show text box (26) #Inn keeper : sorry sir you don't seem to have money. wait for text box end# end for the if resume npcs resume player end #end of the script #-------------------------------------------------------------------------------------------------------- # script which defines what happens to the heroes at the INN plotscript, heroes revive at the INN, begin suspend player suspend npcs show value (1) wait (1) resume npcs resume player end #end of the script #--------------------------------------------------------------------------------------------------------
Save you hss file. Save your rpg file. Launch a test game. Go and speak to the NPC which make it loose your money. Check that you have 0. Go and speak to the Inn Keeper. Choose pay. This time you should have a message in addition of the whole text boxes which disappears.
Leave you game. Launch a save. You're back in town. Check that you have money. Go and speak to the Inn keeper. Pay for the night. As always if you have questions feel free to ask about it on the forum or on the discord.
See also