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.

Worship script

Hello RMXP.ORG members. As I've feverishly worked on my game, it has come to my attention that, other than storyline, there is nothing unique about my game AT ALL. Don't take it the wrong way, I have amassed a great many of scripts, but I want something that'll really give some fire to my project. I want a Worship Menu.

The worship menu would be accessed via worship at a church shrine  :angel: (pressing the action button at a shrine will activate the script)  and open into three panels. There would be a thin one line description of the benefits gained from worship on the first panel which would occupy the top of the screen. The second panel would cover the vast majority of the screen ( like 1/3 of the screen, not including the first panel) and would show the list of gods.(I'm working with a pantheon here) The final panel will contain a brief description of the god. A lot like the shopping menu, but not quite .Each of the god's blessings should last five minutes...

Here is a list of gods: 

Haen, god of trade and lord of the Merchant's Covenant. increases sell value; lowers cost.(about 100g either way).
Fostor, god of the cosmos and all celestial beings. increases energy (SP), and holy damage.
Aeftan, god of war and all mindless bloodshed. increases strength, fire damage.
For-wel, god of secrets and mystery. increases intelligence and dexterity.
Scieran, god of water, ice, and storm. increases water, ice damage, and thunder damage.
Seon, god of Air and wind. increases wind damage and agility.
Lief, god of the Earth and life itself. increases earth and darkness damage.
Axige, god of Death. increases damage to all living things.(via anti-ogre, anti-reptile, etc.)

Credit will, of course, be given to someone generous enough to do it. If I've left something out, let me know.
 
That looks exactly like what I was thinking...humor appreciated.

Yes, it will effect all party members, and yes there can only be one blessing at a time. I should have mentioned that the god menu has a 5 minute recharge
A battler of each god, you say...I'll look into that, for sure.

P.S. Haen's blessing, in this case, would maximizes your charm. You could woo anybody into thinking what your selling is better than what they have, even if the same, and charm them into selling some reduced price goods.
 
Ok, I have everything done, except the "Charm" part. (buy / sell discount). That is gonna take a bit more effort since there are a bunch of places in the shop scene that will have to be modified to make it work.
I assume you want the prices (buy & sell) that are displayed to reflect the modified values.

Anyways, here's the script. Pretty much anything you might want to change, plus the info you need to add is at the top of Scene_Worship.  Copy & paste both scripts above 'main', below 'Scene_Debug'..
Let me know if you have any questions.

Code:
#==============================================================================
# ** Window_God_Info
#------------------------------------------------------------------------------
#  This window shows the descriptions of the gods
#==============================================================================

class Window_God_Info < Window_Base
  attr_accessor :help_text
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(160, 64, 480, 416)
    self.contents = Bitmap.new(width - 32, height - 32)
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #  text  : text string displayed in window
  #  align : alignment (0..flush left, 1..center, 2..flush right)
  #--------------------------------------------------------------------------
  def set_text(text, align = 0)
    # If at least one part of text and alignment differ from last time
    if text != @text
      # Redraw text
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.draw_wrap_text(4, 0, self.width - 32, 32, text)
      @text = text
    end
    self.visible = true
  end
end

class Bitmap
  #-------------------------------------------------------------------------
  #   Name      : Draw Wrapped Text
  #   Info      : Draws Text with Text Wrap
  #   Author    : Trickster
  #   Call Info : Five Arguments
  #               Integer X and Y, Define Position
  #               Integer Width, defines the width of the text rectangle
  #               Integer Height, defines the height of the text
  #               String Text, Text to be drawn
  #-------------------------------------------------------------------------
  def draw_wrap_text(x, y, width, height, text)
    # Get Array of Text
    strings = text.split
    # Run Through Array of Strings
    strings.each do |string|
      # Get Word
      word = string + ' '
      # Get Word Width
      word_width = text_size(word).width
      # If n, move to next line
      if word == "n "
        x, y = 0, y + height 
        next
      end
      # If Can't Fit on Line move to next one
      x, y = 0, y + height if x + word_width > width
      # Draw Text Memory
      self.draw_text(x, y, word_width, height, word)
      # Add To X
      x += word_width
    end
  end  
end
Code:
#==============================================================================
# ** Scene_Worship
#------------------------------------------------------------------------------
#  This class performs Worship menu processing.
#  Thanks to Trickster for his draw_wrap_text method.
#
#  Setup 8 states, one for each God, with the advantages you want.
#  Edit the initialize method with the offset, duration, and descriptions.
#  Use the default sound effects, or place a 'bless' & 'unbless' sound in 
#  your Audio\SE folder.
#==============================================================================
$blessing = 0
$blessing_time = 0
$discount = 0

class Scene_Worship
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    #
    # Set the first state number as an offset
    # Set up 8 states, in order of the gods
    # 
    @state_offset = 18
    #
    # Blessing time in seconds
    @blessing_duration = 5
    
    # Percentage amount to change shop prices & item values
    # Recommend not setting above 25, or players could keep buying &
    # selling to make a profit. (default sell value is 1/2 item value)
    @discount = 20   # sells items for 20% more, buy for 20% less
    
    # Short description
    @menu_index = menu_index
    @help_text = []
    @help_text[0] = "Select a God to Worship"
    @help_text[1] = "God of Trade and Lord of Merchant's Covenant"
    @help_text[2] = "God of the Cosmos, and all Celestial Beings"
    @help_text[3] = "God of War and all mindless Bloodshed"
    @help_text[4] = "God of secrets and mystery"
    @help_text[5] = "God water, ice, and storm"
    @help_text[6] = "God of Air and Wind"
    @help_text[7] = "God of Earth and life itself"
    @help_text[8] = "God of Death"
    # Enter your long descriptions here. Use 'n' for a newline.
    @god_desc = []
    @god_desc[0] = ""
    @god_desc[1] = "Haen is the God of trade and lord of the Merchant's 
                    Covenant. n His Blessing somehow increases the value of
                    your goods & money, however economically illogical that
                    may be. n Or, perhaps he just reduces the intelligence
                    of all merchants"
    @god_desc[2] = ""
    @god_desc[3] = ""
    @god_desc[4] = ""
    @god_desc[5] = ""
    @god_desc[6] = ""
    @god_desc[7] = ""
    @god_desc[8] = ""
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    s0 = "WORSHIP"
    s1 = "Haen"
    s2 = "Fostor"
    s3 = "Aeftan"
    s4 = "For-wel"
    s5 = "Scieran"
    s6 = "Seon"
    s7 = "Lief"
    s8 = "Axige"
    @command_window = Window_Command.new(160, [s0,s1,s2,s3,s4,s5,s6,s7,s8])
    @command_window.y = 64
    @command_window.height = 416
    @command_window.index = @menu_index
    @help_window = Window_Help.new
    @info_window = Window_God_Info.new
    # Execute transition
    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 windows
    @command_window.dispose
    @help_window.dispose
    @info_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @command_window.update
    @help_window.update
    @info_window.update
    # If command window is active: call update_command
    if @command_window.active
      update_command
      update_help
      update_info
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      # if cursor is on the title
      return false if @menu_index == 0
      # if any blessings are in effect. (for actor[0])
      if $blessing > 0
        $game_system.se_play($data_system.buzzer_se)
        return false
      end
      # set new state for all party members
      Audio.se_play("Audio/SE/blessing")
      for actor in $game_party.actors
        $blessing = @menu_index + @state_offset - 1
        $blessing_time = @blessing_duration * Graphics.frame_rate
        $game_system.se_play($data_system.decision_se)
        actor.add_state(@menu_index + @state_offset - 1)
        $scene = Scene_Map.new
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @menu_index = @command_window.index
    @help_window.set_text(@help_text[@menu_index], 1)
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_info
    @menu_index = @command_window.index
    @info_window.set_text(@god_desc[@menu_index], 1)
  end
end

class Scene_Map
  
  alias blessing_update update
  
  def update
    blessing_update
    if $blessing
      $blessing_time -= 1
      if $blessing_time == 0
        for actor in $game_party.actors
          actor.remove_state($blessing)
        end
        Audio.se_play("Audio/SE/unbless")
        $blessing = 0
      end
    end
  end
end

class Scene_Battle
  
  alias blessing_update update
  
  def update
    blessing_update
    if $blessing
      $blessing_time -= 1
      if $blessing_time == 0
        for actor in $game_party.actors
          actor.remove_state($blessing)
        end
        Audio.se_play("Audio/SE/unbless")
        $blessing = 0
        @status_window.refresh
      end
    end
  end
end

class Scene_Menu
  
  alias blessing_update update
  
  def update
    blessing_update
    if $blessing
      $blessing_time -= 1
      if $blessing_time == 0
        for actor in $game_party.actors
          actor.remove_state($blessing)
        end
        Audio.se_play("Audio/SE/unbless")
        $blessing = 0
        @status_window.refresh
      end
    end
  end
end
And here are the Sound Effects I used. (copy them to your Audio\SE folder)
http://www.box.net/shared/r2nqkr0cgo
http://www.box.net/shared/bsc6tsq048

Be Well

Ref: Test9
 

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