Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

RGSS Questions

One. I am working on a custom title screen system and I am wondering first:
1. How do I skip the title screen and instead have the game.exe show a 30 second video before the title screen?
2. Second, if the player skips the video or finishes watching it...I want it then to teleport the player to a custom evented title screen I have I made (something ala the old days like a simple title and "press enter") which will lead to my own custom made title screen.
3. How would I make it show a video if the player doesn't do naything on the cts for more than 30 seconds?

Two. I have two variables that act as hidden stats, luck and intelligence. How would I make it so that luck affects the enemy gold drop rate, and intelligence affects the enemy exp rate? If it helps, their base number is 100 but their maximum is 2000.

Three. I have two different soundtracks for my game, one that has original music from it's series, and one entirely of remixes. How could I make it so that the player can toggle between the two? I was planing to put each into their own folder with their own BGM, BGS, ME, and SE folders.

Four. I read tutorial to make a selectable window for practice, and I got this error: http://img15.imageshack.us/img15/7153/s ... werror.png
Script:
[pastebin]57[/pastebin]

Also, I forgot:
fifth: I'm writing my own cms. What part of the system RGSS would I put the call script line for when the player presses esc?
 
4. erase the end on line 28

Also,
- you shouldn't erase a window inside some other window.
windows are handled (created, updated and disposed) in a scene.
- I don't see why you need a global variable($window).
- check_input, is another thing you should do in a scene.
- You should make a new scene for your pet window.

Your scene should create the pet window, check what option you choose, do something based on your selection, and return to the map.
The code for your scene:
[rgss]class Scene_Pet
  def main
    # Make pet window
    @pet_window = Window_Pet.new
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame Update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of window
    @pet_window.dispose
  end
 
  def update
     if Input.trigger?(Input::C)
       case @pet_window.index
       when 0
          p "you selected pet number 1"
          $scene = Scene_Map.new
       when 1
          p "you selected pet number 2"
          $scene = Scene_Map.new
       end
 
     end
  end
end
[/rgss]

Normally you would add a new option saying 'choose pet' to the menu, and when it's selected call your scene.
This is NOT as easy as it sounds!
Here's how to do it:
open the script editor and go to Scene_Menu, now:
A. There's no room for another option in the menu screen, but you can erase the gold window: find all lines which mention Window_Gold and add a '#' before them to disable them.

B. find the line : @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
and change it to:
[rgss]s7 = 'select pet'
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6,s7])
[/rgss]
C. Lastly, check if the player chose 'select pet'. find 'def update' and after it, add this code. We used s7, so the number of our menu option is 6:
[rgss]if @command_window.index == 6
  $scene= Scene_Pet.new
  return
end
[/rgss]
 
sorry I guess it's too much for a beginner. ^^;
Forget the whole menu part.
you can show your window when the player presses a key. All you need is the code for the scene, your code, and a common event:
[rgss]class Scene_Pet
  def main
    # Make pet window
    @pet_window = Window_Pet.new
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame Update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of window
    @pet_window.dispose
  end
 
  def update
     @pet_window.update
     if Input.trigger?(Input::C)
       case @pet_window.index
       when 0
          p "you selected pet number 1"
          $scene = Scene_Map.new
       when 1
          p "you selected pet number 2"
          $scene = Scene_Map.new
       end
 
     end
  end
end
[/rgss]
scenepet.png


You see, windows always go with scenes. A scene is simply a class which handles one window or more. It creates the window and waits. The scene will update the screen and any windows, and get input from the player, until you tell it to exit ($scene= Scene_Map.new)
If you don't update your window it'll show up but the cursor won't move.
 
For your first questions, there are some scripts out there that skip the title screen and go to the first map. If your video is evented, simply code your video there and then transfer the player to a second map, the real title screen. (You can use a Parallel Process and a Conditional Branch that checks buttons to skip the video; you can also check if nothing is pressed for 30 seconds and transfer back to the video from the second map.)

Here is one made by Dargor; this version is made by Punk.

If your video is not evented, you will need some complicated script to show avi/swf files (which I do not recommend).

Just an aside, I know this sounds like an ambitious project, but you may want to step back and start simpler. If you think you're up to this task, however, try familiarizing yourself with the basics of RGSS and looking through the default scripts to try to understand how it works. Trust me, that's how I got into RGSS, and it really helped.
 
For the soundtrack thing, you'd overwrite the "play" methods from each RPG::AudioFile Subclass, to take a variable into account so that it switches to the right directory when loading the song :). SO the variable modify a string that is used to identify the folder.
The code is available from the help file, in the "Data Structure" section within the "Game library" part of the RGSS reference Manual.
 
trebor777":32uzdnzh said:
For the soundtrack thing, you'd overwrite the "play" methods from each RPG::AudioFile Subclass, to take a variable into account so that it switches to the right directory when loading the song :). SO the variable modify a string that is used to identify the folder.
The code is available from the help file, in the "Data Structure" section within the "Game library" part of the RGSS reference Manual.
Could you show how to do this in depth? I'm not very experienced with RGSS, even though I'm still learning.
 
IMO, you know you should go in the script request section for that :p

anyway:
[rgss] 
module RPG
  class BGM < AudioFile
    @@last = BGM.new
    def play
      if @name.empty?
        Audio.bgm_stop
        @@last = BGM.new
      else
        Audio.bgm_play("Audio/#{ $_sountrack ? "my_folder" : "other_folder" }/BGM/" + @name, @volume, @pitch)
        @@last = self
      end
    end
  end
  class BGS < AudioFile
    @@last = BGS.new
    def play
      if @name.empty?
        Audio.bgs_stop
        @@last = BGS.new
      else
        Audio.bgs_play("Audio/#{ $_sountrack ? "my_folder" : "other_folder" }/BGS/" + @name, @volume, @pitch)
        @@last = self
      end
    end
  end
  class ME < AudioFile
    def play
      if @name.empty?
        Audio.me_stop
      else
        Audio.me_play("Audio/#{ $_sountrack ? "my_folder" : "other_folder" }/ME/" + @name, @volume, @pitch)
      end
    end
  end
  class SE < AudioFile
    def play
      unless @name.empty?
        Audio.se_play("Audio/#{ $_sountrack ? "remix_folder" : "orig_folder" }/SE/" + @name, @volume, @pitch)
      end
    end
  end
end
# if you set $_soundtrack to true in game, it'll switch to the remix folder the next time a song or a sound is asked to be played ( the bgm won't change instantly )
# then set it back to false to use the original folder
# it requires as well that all the tracks have the exact same names.
 
# folder tree:
# Audio
#    remix_folder
#       BGM
#       BGS
#       ME
#       SE
#    orig_folder
#       BGM
#       BGS
#       ME
#       SE
 
[/rgss]

:) should work :)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top