How do I make title options like Start Game, Continue Game, etc.?
This article explains how to make title options named "New game" and "Continue". It is also possible to do this with animated NPCs on a starting map (If so, it would be necessary to modify the scripts)
We're going to make title options using basic text boxes, a chain of plotscripts combined and tags. Note that this system compiles you to use only one save slot because the only way to launch a saved game is to use command 'load from slot'. It gives your game a very modern design because nowadays many games use only one-save slot system.
You have basically 2 ways. The first one is outdated and was created when the edit menus function was not been implemented yet. The second one with menus and tags is more likely to fit your need.
With a text box with choices enabled[edit]
The first section of this article deals with title options made with text boxes and tags. Since the implementation into Custom.exe of menu and slice collection, this way has become a bit old-dated . Nonetheless it requires a few plotscript writing experience so It may worth a shot to implement this if putting this kind of option when your game starts fits your game . It's also a good way to understand how to launch a script after a text box with choices had been used.
We're going to make title options using basic text boxes, a chain of plotscripts combined with tags. You can choose to use only one save or several slots then, you'll need to adapt a bit your save point script and the autorun map script.
First we'll modify a bit your save point. We assume in this example, that you chose save point type number 2 in the article dedicated to save points. See the article How do I make a "Save Point"? (see the line above to see what I'
m talking about.
Now that you have a save point, Edit the text box in which it is written "Would you like to save?" ( Text Box nb21) and enable choice. Add yes and no as choixcs. Go bask to the tag menu. Pick up a free one and name it "go to save". Then pick up two new free tags. Name them "save point first use"and "continue story". Export the datas to hsi. file. Then, we'll modify the script. The tag go to save will be used inside the script and not outside like before. Once a first tag is checked a second one is also checked. You can now save your hss file and import the scripts.
define script, save game, begin #------------------------------------------------------------------------- plotscript, save game point, begin if (check tag: go to save)==on) then, begin #if save used for first time, use shop and turn tag off, else, simply call the save menu if (check tag: save point first use )==on) then, begin suspend player suspend npcs set tag (tag: save point first use, off) set tag (tag: continue story, on) #active continue function. Once turned on, don't turn it off for the whole game. save menu (reallysave) resume player resume npcs end #end for the if check tag end #end for the if check tag if (check tag: save point first use )==off) then, begin suspend player suspend npcs save menu (reallysave) resume player resume npcs end #end for the if check tag end #end for the if check tag if (check tag: go to save)==off) then, begin wait (1) end #end for the if check tag end #end for the script #-------------------------------------------------------------------------
Edit text box 21 and change the conditionals. Now you must see
always do the following run script next "save point"
We will use the tag "continue story" to activate the continue function of or menu and the tag "save point first use" to be sure that the tag "continue story" is turned off only one time and not each time we save. Now, edit your introduction script (= the script which introduce the story of the rpg to the player) and add the following line
set tag (tag: save point first use, on) #activate continue function of the menu when using save point.
For the next step, we need to make the menu. So edit the tag and again pick up news ones. First "New Game". This tag will use to activate the choice of our text box. Then 2 other "player ch new game" and "play ch continue". Why is that? Well that's the tricky part. You can't use the same tag to trigger choices and to trigger the scripts. Finally pick up a last one and name it "game preload end"
Then edit the text boxes and pick up a free one. Let's says it's text box (28). Edit the choice. Enable them. Name them "New Game" and "Continue". If the player chooses "new game" then the tag is turned on if he chooses to Continue, then the tag is turned off. Edit the appearance the pick up
show box: no
Save your game datas. Edit your hss file and add the following script
define script, start menu, begin #---------------------------------------------------------------------------------- # code triggered if the player make the right choice the first time plotscript, start menu, begin suspend player if (check tag (tag: new game)==ON) then, begin# if new game is chosen then set tag (tag: game preload end, off) wait (8) advance text bpx #make diappear text box menu very very important DO NO ERASE introduction #replace this by the name of the script which contains the introduction of your game end# end for the if check tag new game if ON if (check tag (tag: new game)==OFF) then, begin if (check tag (tag: continue story)==on) then, begin load menu #load save with custom menu end end # end of the 2nd if check tag resume player end #end of the plotscript #--------------------------------------------------------------------------------------
You must see
always do the following run script next "star menu"
Now we need to speak about special plotscripts among which there are 2 kinds which will be useful for us to use. The first one the autorun map script. As the name states this script launches when a map is launched . Here we'll need of the autorun of the start map that is to say the autorun of the map such as defined in the menu New game in the major setting when you choose to edit "General Game Settings"
The second kind of special plotscript we need is on-keypress plotscript . This script is the natural partner of the command if (keyispressed) command and allows you to add key functions to you game . It even overpass the pre-implemented keyfunction. For example when you press esc while playing, it generally triggers the menu. But here with this script, it allows you to leave the game as you can see if the first lines.
So what other keys function do we need to over pass? Well the key space and the key enter. Thoses 2 are used to display dialogues and activates sub-menus. We don't need them here (before the player starts to play). We'll combine these key with tags so that the effect can be activated and unactived cleanly.
#-------------------------------------------------------------------------------------- plotscript, start map keypress, begin if (key is pressed (key:esc), and, check tag (tag: game preload end)==on) then, begin #allows you to leave the game game over end if (key is pressed (key: enter), or, key is pressed (key:space),and, check tag (tag: game preload end)==on) then, begin #key is pressed after the menu is launched #option New game is chosen whereas there is no previous save. Run intro if (check tag (tag: save point first use)==off,and, check tag (tag: player ch new game)==OFF)then, begin set tag (tag: game preload end, off) new game chosen end #end for the if check tag #option New game is chosen whereas there is a previous save. Run intro again if (check tag (tag: save point first use)==on,and, check tag (tag: player ch newgame)==ON)then, begin set tag (tag: game preload end, off) new game chosen end #end for the if check tag #option continue is chosen whereas there is no previous save. Wrong choice Make pop up the menu again if (check tag (tag: save point first use)==off,and, check tag (tag: player ch continue)==OFF)then, begin show text box (28) end #end for the if check tag #option continue is chosen and there is previous save. Load Save if (check tag (tag: save point first use)==on,and, check tag (tag: player ch continue)==ON)then, begin set tag (tag: game preload end, off) continue chosen end #end for the if check tag end# end for the if key is pressed end #end for the script #-------------------------------------------------------------------------------------- #autorun for the start map plotscript, autorun map9, begin # if one of the slot is already use then activate continue if (save slot used (1), or, save slot used (2), or, save slot used (3), or, save slot used (4) == true) then , begin set tag (tag: continue story, on) set tag (tag: player ch newgame, on) #if game is saved, player can choose to start a new game nonetheless set tag (tag: player ch continue, on) #if game is saved, player can choose continue end end #end of the plotscript #--------------------------------------------------------------------------------------
Edit your launch game script and add the following line
set tag (tag: game preload end, on)
This will prevent the keys to activate before the menu/ our text box with choices is on screen. Allows add the commands to display the text box automatically both at the beginning and the end of your script.
suspend box advance .... .... resume box advance
and indeed the line
show text box (28)
Save your hss file and import the scripts. Edit your start map and give it autorun script and the keypress script. Finally, what else do we need to do to complete the process? Well we need a script again but this time for the reboot. Why reboot? Well it's because we took into account that the player may want to choose continue first whereas there are no previous save.
For this case, we need to make the menu popping up again so that he can choose "new game" to start playing. Previously, we have made our keyscript triggering, so it has to go somewhere isn't it?
define script (30, new game chosen) define script (31, continue chosen) #--------------------------------------------------------------------------- # code triggered if the player makes the right choice the second time plotscript, new game chosen, begin suspend player #suspend box advance if (check tag (tag: new game)==ON) then, begin# if new game is chosen then set tag (tag: game preload end, off) wait (8) wait for text box #make disappear text box menu very very important introduction 1 end# end for the if check tag resume player #resume box advance end #end for the script #-------------------------------------------------------------------------------------- # code triggered if the player makes the right choice the second time plotscript, continue chosen, begin suspend player if (check tag (tag: new game)==OFF) then, begin if (check tag (tag: continue story)==on) then, begin load menu end end # end of the 2nd if check tag resume player end #end of the plotscript #--------------------------------------------------------------------------------------
"Et voilà!" After all this work, you can finally enjoy you game menu! Thanks to a lot of tags and powerful commands combination (
load menu, save menu (really save)...) and the ability to check if save slot are used with "if (save slot used)" your system is ready to go.
How to test it? Well first search for the the directory mygame.saves . It's a directory which is created automatically by custom to store .sav file which corresponds, you guessed it, to your save slot datas. Erase them to make your game without any previous save . This is necessary to trigger the whole first part. Remember that the autorun script checks for previous saves.
Now you can launch you game. Save your game. And then leave you game. Normally, the continue function should have been activated and you should be able to take back from when you were thanks to a successful loaded menu. At this state, you can either choose continue or to restart from beginning with new game. As always this may seem really tricky for beginners so If you need help don't hesitate to ask on the forum or on discord. Be sure to implemented little by and to take the time to understand every error message Hspeak.exe may give you. Good luck!
With a Menu, tags and a autorun map script[edit]
This way allows the function "continue" to be gray/ disable in grey which was possible with the method above and allow you to add more line (like options form example). So let's go!
Edit your game. Edit the menus. Name it start menu. Let's say it's menu 5. Pick up the menu items. Use the caption to give the menu item a name. The first menu item will be named "New Game" and the following one "Continue"
Then, edit the bitsets. Make sure you have hitten the following
Allow gameplay & scripts Suspend player even if gameplay allowed Disable player closing menu Prevent main menu from activation. Advance text box when menu closes
Go back to the main menu and edit the tag menu. Pick up a free tag. Name if continue story (or any other name which makes you remember the purpose of the tag. Let's say we picked up tag 8. We need also another one for the save point. Name it save point first use. Go back to the main menu and export your scripts to the hss file.
Now you can go back again to edit the menus. Edit the menu item "New Game". Edit the bitset. Choose "close menu when activated" Edit the menu item "Continue". Edit the bitset. Choose "close menu when activated" and also put "tag enable" to "if tag 8=ON continue story"
Then save your game. Insert the following scripts in your hss file.
#--------------------------------------------------------------------------- #Script with make the RPG story starts from the beginning. plotscript, new game chosen, begin fade screen out (0,0,0) show backdrop (3) wait (2) stop song introduction end# end of the plotscript #--------------------------------------------------------------------------- #Script when player decide to launch game from continue. plotscript, continue chosen, begin wait (1) load from slot (1) #Game starts again end #end of the script end# end of the plotscript #---------------------------------------------------------------------------
Save the hss file and import the script. Edit the menu. Edit the menu items. Give the each menu item its script. Go back to your hss file. Modify the script that launches when game.exe read your rpg file, the one that the special plotscript menu calls "new game". Seach for the command "load menu" (= or another one with has the same effect).
Replace load menu by
open menu (5) #new starting menu with New Game/ Continue option
Finally! You can now make a first test and check if you can launch the script called "introduction" (= the script that launches the story) without any problems. Also check that if you choose continue, the menu is kept opened and nothing happens.
If everything goes fine, you can go on. Else search for the meaning of the error you get from Hspeak.exe (I advise you to check line after line that the code works correctly. If you still have troubles, as always you can ask for help on the forum or discord. Edit your save script and use the tag "save point first use" to divide the script in two parts.
Here is an example above. I used the command save in slot but I could have used the commad use shop or even my own made save menu.
#-------------------------------------------------------------------------------------------- plotscript, save point, begin suspend player suspend npcs if (check tag (tag: save point first use)==off) then, begin # if save point is not used for the first time then do as usual. suspend player suspend npcs show text box (19) # Narration: You have saved you game! wait for text box resume player resume npcs save in slot (1) #don't move this line up. Else, Npc will frozen after save is reloaded wait (2) end #end for the if check tag if (check tag (tag: save point first use)==on) then, begin # if save point is used for the first time then active continue and save. suspend player suspend npcs set tag (tag: save point first use, off) set tag (tag: continue story, on) show text box (19) wait for text box resume player resume npcs save in slot (1) #don't move this line up. Else, Npc will frozen after save is reloaded wait (2) end#end for the if check tag #--------------------------------------------------------------------------------------------
Next, you need to go into the file that launch the intro of the story of the rpg and add the two following lines :
set tag (tag: save point first use, on)
When the player save the game for the first time: I want him/her to activate the tag "continue story" so that the continue function of my start menu can activate. Thanks to the 'tag save point first use" this will happen only one time (just what we need).
Now that you have gone so far, all that's left to do is to launch the script "new game chosen". So do it. Then, save the party and leave the game. When you relaunch everything from the beginning, the continue function must have been activated and you should be able to take back from the last save. I made this system using a single slot but you can choose to modify the save game script if you want to the player to access several slots.
Now how to make "remember" the game about the fact that tag continue is on and that the continue function of the start menu need to be activated?. Well to do that, we need to use an autorun map script and the command save slot used
So open your hss file and add one the two the following scripts. Hare are 2 variations. The first script is if you're using only one save slot
and the second one with more save slots
#-------------------------------------------------------------------------------------------- script, autorun map, begin if (save slot used (1) == true) then , begin set tag (tag: continue story, on) resume npcs resume player end end#end of the script #--------------------------------------------------------------------------------------------
And the second one if you're using the basic save menu with 4 slots available
#-------------------------------------------------------------------------------------------- script, autorun map, begin # if one of the slot is already use then activate continue if (save slot used (1), or, save slot used (2), or, save slot used (3), or, save slot used (4) == true) then , begin set tag (tag: continue story, on) resume npcs resume player end end #end of the script #--------------------------------------------------------------------------------------------
Compile your hss file and go under custom. Edit your starting map. (= the one you're own when the games starts and the start menu you made appear) Edit the general map data. And go down until you find
autorun script [none].
Change the line to
autorun script : autorunmap
Finally! You can save the whole thing!. Next you can test the whole system. Find the directory you_game.saves . In there you have the previous save slots. Delete all the files so that you save system become blank. Then launch the game. Only new game will be active. Launch the game, speak to some npcs and save your game. Then leave and restart it. Normally it should work fine.
A last detail to check : you may want to focus on two other useful commands "set on keypress script" and game over
set on keypress script (85) # to change the esc key behaviour
This command allows the player to leave you game like he/she would do if you were using the regular custom menu. You can combine it with the command key is pressed
#--------------------------------------------------------------------- plotscript, start map keypress, begin if (key is pressed (key:esc)) then, begin game over end end #end of the plotscript #---------------------------------------------------------------------
How does the command function? It changes the script which is linked to the use of the keyboard. If you don't want to leave the game while trying to access your main menu you'll have to add the following line in your introduction script.
set on keypress script (none)
if key is pressed can also be used if you want the player to use a specific key (more likely enter) to make the menu pop up and not popping up on its own. In this case the command which is used with is : "wait for key" You choose any letter of alphabet or one of the keys used for making the menu pop. Those are esc, alt and crtl. Just keep in mind that esc is already used to exit the game.
wait for key (key:enter) #Feel free to replace (key:enter) by (key:alt) or (key:Ctrl) if it better suits your needs. if (key is pressed (key:enter)==on) then, begin open menu (5) end
Congratulation: you have implemented with success new title options in your main menu! Feel free to ask questions for further customisation !