How do I make title options like Start Game, Continue Game, etc.?

From OHRRPGCE-Wiki
Jump to: navigation, search
Revise.png
This article does not meet the standard of quality we would like to have. Feel free to revise it and make it better by using the edit link at the top of the page. This tag should be removed when an editor feels it is of high quality.

The reason this article has been marked is: needs to be re-written for user-defined menus

This article explains how to make title options with text boxes. 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 game use only one-save slot system.

To make your gameplay coherent, it also recommended to implement the "auto save system" (see below)

1) Go under custom. Edit tags. Pick a free one and name it " new game". Then edit the maps and pick a free one you call "start map" or "launch map" (or any other name that make you remember easily what the tag is used for.) In the scripts above, I'll use map 12 as start map.

Edit the map menu pick up you map and put you title music file as ambient music. Then, edit the text boxes and pick one. Make choice enabled. The first choice is "new game" and the second one is "continue".

For the choice "New game" set tag (new game) on and for the choice "Continue" set the tag (new game) off. You don't write text in it! (or any spaces): it would make appear a big blank text box! Edit the box appearance and put the line show text box to "No". In our example, it will be text box 46!

Edit the hsi file. Now you can save the changes and quit custom.

2) Launch hssed.exe and include the following scripts in your hss file.


Global variable (3, saved game)

#-----------------------------------------------------
plotscript, new game, begin

suspend npcs
suspend player     
suspend box advance 
 
show backdrop (4) #e.g licenced by bob the hamster
wait (11)
show backdrop (6) #e.g in association with/ music from
wait (18)
show backdrop (7) #e.g Shadowii proudly presents...
wait (12)

fade screen out (63,63,63)   
#feel free to make a "fake movie" here to make appear the
#game title screen instead of a fade screen out

show backdrop (1) # E.g Crescent dream EX title screen
wait (35)
show text box (46) # text box with choices : new game/ continue
wait (5)
fade screen in

resume NPCs
resume box advance
resume player
set on keypress script (12)#See note (11)

end # end of the plotscript
#-------------------------------------------------------
#In this script you launch the script actived
#by the tag of text box (46)

plotscript, new game2, begin  


if (check tag (tag: new game)==ON) then, begin
# game is not saved yet. Intro script runs
fade screen out (0,0,0)
set on keypress script (none)#See note (13)
suspend player
suspend npcs
show backdrop (5) 
wait (6)
resume players #see note (10)
resume npcs

# put the two first line of your intro script here so that 
# the change of script does not appear on screen
stop song
set on keypress script (none)
introduction #see above
# see note (8)

if (check tag (tag: new game)==OFF) then, begin 
#game begin if there is already a previous saved and reload the text box with choice if necessary
suspend box advance
suspend npcs
suspend player
  
  if(saved game == 2) then, begin #see note (12)
    stop song
    resume box advance
    resume npcs
    resume player
    load from slot (1)  #Game starts again
    #exit script #use it if you have illegal wait statement pbs.
  end
  
   if(saved game << 2) then, begin
    show text box (46) # text box with choice appear again
    stop song
    resume box advance
    resume npcs
    resume player
  end #end of the load menu  

end # end of the 2nd if check tag 
#----------------------------------------------------------------------

plotscript, introduction, begin  

suspend player
suspend npcs

show backdrop (6)
wait (34)
show text box (56)
wait for text box
teleport to map (12, 43, 54)


resume player
resumpe npcs
end# end of the plotscript
#----------------------------------------------------------------------

plotscript, start map keypress, begin

if (key is pressed (key:esc)) then, begin
game over
end

end #end of the plotscript
#---------------------------------------------------------------------

plotscript, autorun map 12, begin

if (save slot used (1) == true) then , begin
increment (saved game, 2)
end, else, begin
decrement (saved game, 2)
end #end for the if

end #end of the plotscript
#---------------------------------------------------------------------


3) Launch custom.exe again and edit the text boxes. Pick the one we've made above and edit the conditionnals. Put it to always do the following "run newgame2 next"

4) Edit the game menu and edit the general game data. Go to the special plotscripts and change the new game script to "new game" Change the starting location and make the hero start on your "start map" or "launch map" (See above for more details)

5) Edit the preference bitsets and active "skip load screen" and "skip title screen"

6) Save the changes and go back under Windows or Linux or any other O.S you currently use.

7) Test it as many times as necessary to see if wait ticks are ok and then feel free try to launch it after deleted yourgame.sav so that you are sure the main backdrop keep on poping up until the player choose continue.

8) The script "introduction" contains backdrops and text boxes that explains how the story comes to start. Don't forget to put the fade screen at the top of your intro script, else the screen will stay black.

9) E.g: Crescent dream title screen here. This part is very important because it make title screen repeated again if there is not .sav file on the hardrive (no previous save if you prefer). The screen won't change until the player choose "new game".

10) Feel free to resume player and npcs or not. Adapt it to your ex intro script.

11) The onkeypressed of the starting map make you able to quit the game ONLY when the main script has poped up but you may want the player to the leave as soon as the first backdrop shows. To do so, go under cutom edit the start map and put the onkeypress script to "start map keypress". Don't forget also to cancel the line "set on keypress script"

12) The value incremented in the global variable will determine if a previous save have already been made and will make pop the text box with choice new game/ continue if necessary.

13) Replace "none" by your current onkeypress script if you have implemented extra keys for the player

Adapt the save point[edit]

No you may want to adapt the save point using a single save slot, so that the game does not seem to have a strange game play. Here is how to do.

First launch custom and edit the text boxes. In a first free text box write Would you like to save? and make choice enbaled (YES/NO). In a second one write "wait." In a third one "Wait.." and in the fourth "Wait..." and in the fifth and last one write "Your progress have been saved!"

For this example let's say that we have picked up text boxes 18, 19, 20, 21 and 22. Now go back and edit the tags. Pick up a free one and name it "go to save". Now, you can save the changes. Go back under windows and include the following script in your code.

# This script record any progress in the game
plotscript, save point, begin

suspend npcs
suspend player
suspend box advance

show text box (19)
advance text box
wait (15)
show text box (20)
advance text box
wait (15)
show text box (21)
advance text box
wait (15)
resume box advance

show text box (22)
wait for text box
resume player
resume npcs
save in slot (1) 
#feel free to choose another slot, but if so, don't forget to adapt the autorun map script.

Be sure that the line "save slot 1" is not executed as box advance is suspended, esle you may have bad surprises when you launch a saved game!

Go back under custom and edit the conditionnals of text box 18. If the player choose YES the tag go to save is turned on and launch the script save point and if the player chooses NO the tag is turned off and game.exe displays again text box 18.

Pick up a free npc picture set and draw an "S" in it. Then edit the maptile sets. Pick up the maptile of the map you're making tests with. Edit it and pick a draw a blue rectangle. Then, edit the map and place it. Now you can go back to the map menu and edit the npcs. Give as a picture set to a free Npc, the S you have just drawn . Make it "step on". Eh voilà! You are ready to test! If you feel like it, just test all those new scripts as many times as needed and feel free to adapt it to your gameplay. Enjoy!


See Also[edit]