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.

Simple mini script package #1

This is not intended to be a system rather a plug in to add small features to your game, if you don't want a feature just comment out starting at the class or find all references of that class and comment them out using a # sign.

Mini script instructions.

Pause:
To pause the game press "W" on the keyboard, to quit the game during pause press "X" on the keyboard, pressing "X" will bring up two choices "yes" and "no" choosing "no" will return you to the pause screen whereas choosing "yes" will return you to the title screen.

When you pause the game a different bgm plays and can be changed to whatever you want it to by reading the notes starting on line 209, also you can change the pause and quit graphic by creating your own and importing it into the pictures folder. (my graphics are included)

Run:
To run hold either the space bar or enter while moving. to change walk and run speed find line 227. Whole numbers aren't neccessary 1.1, 1.2, 1.3.. etc can be used

Change lead character:
To change which character appears on the map press one of these keyboard keys.
"Q" = first actor [0], "A" = fourth actor [3], "S" = third actor [2], "D" = second actor [1].

Font:
To change the font go to line 233.
Font change: Change the name of the font you want inbetween the ""
Font size: change the numbers
Font bold: set it to true.
NOTE: THIS AFFECTS THE WHOLE GAME FROM START TO FINISH SO YOU MAY NEED TO MESS AROUND WITH THE SIZE OR BOLD TO SEE IF IT SUITS YOUR GAME (was made to affect the whole game, not custom choice)

Map death:
Happens when your parties hp reaches 0 from terrain damage on the map, a feature that seems to have been missed out.

Mini script packages are designed for ease of use and to add features to your games, they are not intended to be a script system. For my systems read the comments in this mini script package.

Code:
=begin
                    CREDITS:  THE KRYPTONATOR
                                  "MSP1"
                                CONTENTS:   
                                       
                                  RUN
                                 PAUSE
                               MAP DEATH
                              DEFAULT FONT    
                          CHANGE LEAD CHARACTER
                             
================THE MINI SCRIPT PACKAGES ARE JUST PLUGINS/ADDONS================
                                *PAUSE* 
================================================================================
  Creates the ability to pause the game using the W key on the keyboard.
===============================================================================
  If you press Input.trigger?(Input::B) which is ESC or X on the keyboard it
  will bring up an option to quit the game selecting "yes" will send you to the
  title screen whereas selecting "no" will return you to the pause screen.
================================================================================

                              *MAP DEATH*
================================================================================
  Contains map terrain damage death and pause Input.trigger?(Input::R) update.
  It is easy to use if you set a certain terrain to cause damage then if/when
  your parties hp reaches zero you will die and get the gameover screen.
================================================================================

                                 *RUN*
================================================================================
  Game_Player edit for dashing, I wouldn't mess with the numbers much.
  Press Space or Enter to run. 
  Animated run script part of Suikoden 1 + 2 Script System
================================================================================

                             *DEFAULT FONT*
================================================================================
  Allows you to easily change the games overall font, also includes bold effect
  if you don't want your game's overall text to have a bold effect leave false.
  It was made for people who want to determine their games font properties
  from start to finish without changing during gameplay.
  However if you do change it during play then you would setup a script call
  from the script editor and inserting any of the three lines into it but that
  would make this addon pointless it's made for people who will not change it
  once the game has started.
  
================================================================================

                          #CHANGE LEAD CHARACTER# 
================================================================================
  Allows you to swap actor graphic during gameplay, added just for fun really?
  It is set to different keys for easier access to the desired lead actor.
  Keyboard keys: 
  Q = actor 0 (first actor)
  D = actor 1 (second actor)
  S = actor 2 (third actor)
  A = actor 3 (fourth actor)
  This feature will be added to my caterpillar script once I get time to make it
  so you can swap lead characters like Secret of Mana (includes 2 player)
================================================================================
                        
                                  ALIASES
================================================================================                                 
 Game_Map                        :krypt_gamemap update
 Game_Player                     :krypt_gameplayer update
 Game_Player < Game_Character    :krypt_gameplayer_gamecharacter update
================================================================================

                              CURRENT PROJECTS
================================================================================
                                  SYSTEMS
 Advanced caterpillar script (ACS)
 First person shooter script (FPSS) 
 Mini script package 2 (MSP2)
 Advanced menu system (AMS) (maybe)
 Random event generator (REG) enables random events (requires ready made events)
 Legend of legia battle system (LOLBS) ?? LOL? ha, BS? ha (Rethinks shortname)
                                 MINI GAMES
 Fishing (ala Breath Of Fire 4) 
 Football (Soccer) complete pitch, game length determined by user
 Arcade system (various mini games similar to arcade classics)
 And more when inspiration kicks in.....
================================================================================ 
=end

class Game_Map
  alias krypt_gamemap update
  def update
    krypt_gamemap
    if Input.trigger?(Input::R) # keyboard key |W|
      $scene = Scene_Pause.new 
    else
      $game_system.bgm_play(@map.bgm)# for returning maps bgm after unpause
    end
    if $game_party.all_dead?
      $scene = Scene_Gameover.new
    end
  end
end

class Scene_Pause
   def main
    @spriteset_map = Spriteset_Map.new
    @pause = Pause_Window.new
    @pause.x = 155
    @pause.y = 160
    @pause.height = 500 
    @pause.width = 500
    @pause.opacity = 0
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @pause.dispose
  end

  def update
    if Input.trigger?(Input::R) # keyboard key |W|
      $scene = Scene_Map.new
      Audio.bgm_stop
    elsif
      Input.trigger?(Input::B) #keyboard key |ESC| or |X|
        $scene = Pause_Quit_Option.new
    end
  end
end

class Pause_Quit_Option
  def main
    @mw = MW.new
    @mw.x = 140
    @mw.y = 160
    @mw.height = 500 
    @mw.width = 500
    @mw.opacity = 0
    s1 = "Yes"
    s2 = "No"
    @command_window = Window_Command.new(192, [s1, s2])
    @command_window.back_opacity = 160
    @command_window.x = 320 - @command_window.width / 2
    @command_window.y = 288
  Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @mw.dispose
  end
  def update
    @command_window.update
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0  
        command_yes
      when 1  
        command_no
      when 2
      end
    end
  end
#------------------------------------------------------------------------------#
#-Quits the game to start over or shutdown-#
#------------------------------------------------------------------------------#
  def command_yes
    $scene = Scene_Title.new
  end
#------------------------------------------------------------------------------#
#-Returns you back to the pause screen-#
#------------------------------------------------------------------------------#
  def command_no
    $scene = Scene_Pause.new
  end
end
#------------------------------------------------------------------------------#
# Used for displaying the quit message after pressing B (ESC,X) while paused.
#------------------------------------------------------------------------------#
class MW < Window_Base
  def initialize
    super(480, 480, 480, 480)
    self.contents = RPG::Cache.picture("quit")
  end
end
#------------------------------------------------------------------------------#
# Used for displaying the pause graphic, change "" to the name of your graphic.
#------------------------------------------------------------------------------#
class Pause_Window < Window_Base
  def initialize
    super(480, 480, 480, 480)
    self.contents = RPG::Cache.picture("pause")
    Audio.bgm_play("Audio/BGM/1", 100, 100) # see below notes titled NOTES
  end
end
#==================================NOTES========================================
# TO CHANGE BGM DURING PAUSE IMPORT A BGM TO YOUR PROJECTS AUDIO FOLDER THEN
# CHANGE THE NUMBER 1 TO THE NAME OF YOUR BGM, I USED THAT BGM AS AN EXAMPLE.
# AS FOR THE PAUSE GRAPHIC |IF YOU LIKE IT YOU CAN KEEP IT :)| JUST IMPORT
# YOUR CUSTOM PAUSE GRAPHIC INTO YOUR PROJECTS PICTURE FOLDER THEN CHANGE THE
# TEXT pause TO THE NAME OF YOUR CUSTOM GRAPHIC. YOU MAY NEED TO MESS WITH x,y
# IF YOU USE A CUSTOM GRAPHIC THAT ISN'T THE SAME SIZE AS THE ONE PROVIDED IN
# THE DEMO.
#===============================================================================

class Game_Player
  alias krypt_gameplayer update

  def update
    krypt_gameplayer
    if Input.press?(Input::C) # keyboard keys |SPACE|, |ENTER| and |C|
      @move_speed = 4
    else
      @move_speed = 3
    end
   krypt_gameplayer
 end
end

 class Font_Type_Size_Bold
  begin
    Font.default_name = "Rod"
    Font.default_size = 15
    Font.default_bold = false
  end
end

 class Game_Player < Game_Character
  alias krypt_gameplayer_gamecharacter update

  def update
    krypt_gameplayer_gamecharacter
    if Input.trigger?(Input::L) #keyboard key |Q|
     actor = $game_party.actors[0] 
     @character_name = actor.character_name
   end
   if Input.trigger?(Input::Z) # keyboard key |D|
     actor = $game_party.actors[1] 
     @character_name = actor.character_name
   end
   if Input.trigger?(Input::Y) # keyboard key |S|
     actor = $game_party.actors[2] 
     @character_name = actor.character_name
   end
   if Input.trigger?(Input::X) # keyboard key |A|
     actor = $game_party.actors[3] 
     @character_name = actor.character_name
   end
 end
end

Here is the pause and quit graphics needed to use the pause (you can make your own)
to be copied to your graphics/pictures folder

http://www.mediafire.com/?4gt3elxd1k2
http://www.mediafire.com/?e2xjxnxbzic

Here is the bgm to copy into your audio folder, it is a default bgm so either download this and try easily or just export a bgm and rename it 1 and copy it to your audio folder
http://www.mediafire.com/?2nxcmwjx028

[EDIT] Thanks to arbiter for helping me learn how to code in rgss and for the map death code.
 

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