How do I add screens before my title game screen?

From OHRRPGCE-Wiki
Jump to: navigation, search

You would like the player to see screens before the title screen? Guess what? You can do that! Isn't the OHRRPGCE the world best rpg engine? ^______^

Now, you need to think about what you want to show up when the game starts. You might have a "An XYZ production", or "Created with the OHR" or something. Here are a few screens that one might theoretically use (although, using these exact screens are not recommended): In case you wouldn't know graphic stealing is not something( not to say one of the least things ) very much appreciates in the community. Anyway feel free to pick up a copy of those 2 below but if you could use them for testing only It would be very very much appreciated.

Foobar-studios.png

Created-with-the-ohr.png

Note that Mike Caron vectorized the logo that was originally designed by members of the Castle Paradox community. It is available here for anyone to use: http://ohrdev.com/logo.psd

Once you've created your screens, launch Custom and open your game.

Now, go into Edit General Game Data, and choose Preference Bitsets.... Then, enable the "skip title screen" bitset. If you also want to implement your own loading screen, also enable the "skip load screen" bitset. However, this will not be covered in this tutorial (but it is by the one called "How do I make title options like Start Game, Continue Game, etc.?".

Next, import your screens as backdrops. This should be a no-brainer. It doesn't really matter what order you import them, but for your own sake, do it in order. Also, note which numbers each screen has, for use in the upcoming plotscript. Let's pretend that the two screens shown above are #1 and #2, while the title screen itself is #3. (also, if possible, import an all-black screen. We'll pretend you did this first, and it's numbered #0)

Save your changes and leave Custom. Don't worry, we'll be coming back soon!

Now, you need to open up your plotscript file. If you use HSSED.EXE, great, although it really doesn't matter.

Include the following scripts in your code:

#change this if you already have a script #1

#-------------------------------------------

plotscript, title screen, begin

  suspend player #the player shouldn't be able to move during the title, duh...
  
  show backdrop (0) #show absolutely nothing
  fade screen out
  wait(1) #this is to avoid the initial fade-in

  

  do, begin
    if(wait and listen(15)) then (break)  #waiting a few seconds before displaying anything never hurts
    show backdrop (1)#  FooBar Studios
    wait(1)
    fade screen in
    if(wait and listen(30)) then (break)
    fade screen out
    show backdrop (2)# created with the OHR
    wait(1)
    fade screen in
    if(wait and listen(30)) then (break)
  end
  
  fade screen out

  show backdrop (3) #title screen
  play song(song:title) #play the title theme
  wait(1)

  fade screen in

  variable(waiting)
  waiting:= true
  while(waiting) do, begin #these simulate the regular behaviour of the title screen
  wait (1) #don't delete the wait (1) command here! I would prevent the player from pressing the keys
    if(key is pressed(28)) then (waiting:= false) #ENTER
    if(key is pressed(57)) then (waiting:= false) #SPACE
    if(key is pressed(1)) then (fade screen out, game over) #ESCAPE
  end 

  variable (s)

  #display the load-game menu
  #if you were implementing your own, you'd do it here
  
  s:= load menu(false) #show it, but don't actually do anything
  if(s >> 0) then, begin
    load from slot (s)
    exit script #the game is loaded, we're done here.
  end  

  if(s == -1) then, begin
    game over #they chose quit
  end

  if(s == 0) then, begin
    introduction #game intro begins, this is your old new-game script
  end #end of the load menu  
  

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

#this is simply a utility script that waits for a specified
# amount of time, but will stop if the player pressed a given key
#
#returns true if it was interrupted by the player, or false oherwise

plotscript, wait and listen, time=-1, key=28, begin
  if(time==-1) then, begin
    while(key is pressed(key)==false) do (wait(1))
    exit returning(true)
  end, else, begin
    variable(i)
    for(i, 0, time -- 1, 1) do, begin
      if(key is pressed(key)) then (exit returning(true))
      wait(1)
    end
    exit returning(false)
  end
end

Notes about the script:

  1. Set the new-game script to title screen
  2. wait and listen is just like wait, but you can also choose a key to interrupt it. This is used so that we display a given screen for the proper amount of time, but still allow the player to skip right to the title.
  3. If there are no saved games, load game will automatically choose "new game" for you. That is why the title-screen section listens for "escape", so the player has a chance to quit if they choose to do so.
Personal tools