RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
One-Man CMS

0 Members and 2 Guests are viewing this topic.

*******
Rep:
Level 90
Returned from the dead.
One-Man CMS
Version: 1.1
Author: Rune
Date: June 29th, 2008

Version History


(* marks current version.)
  • <Version 1.0> Command window displayed horizontally at the bottom of the screen with the Status window above it. Playtime and Gold windows displayed in Status window.
  • <Version 1.1> * Command window is now displayed at the side of the Status window.

Planned Future Versions

  • None planned. Although other versions may appear if alterations are suggested or requested

Description


This is basically a one-character CMS. Not much more to say really.

Features

  • HP/SP bars. You will need images for the bars, but I haven't added any, as I'm a n00b at art, and I didn't want everyone's Menu to look identical. You will also need a separate border image for the bars and you can also change the way the bars go down between squashing the image, or cropping parts of it off. Instructions are in the script. (Code by Modern Algebra)
  • Horizontal Command window.
  • Equipment display.
  • No ugly blackness around the windows.
  • One character displayed, but the active character is changeable in-game! Instructions on how to do so are in the script.
  • The height and y co-ordinate of the Command Window changes with the number of commands in the window!

Screenshots

Default six commands


Two extra commands

(Excuse the quality of the HP/SP bars, they were only a quick paint job.)

Instructions

Instructions are inside the script, at the top. Just read through the green comment lines.

Script


Code: [Select]
#==============================================================================
# ** One-Man CMS
#  * by Rune
#------------------------------------------------------------------------------
#  Little configuration required:
#
#  Must have three images in the pictures folder of your project named "HP_bar",
#  "SP_bar" (both of these must be from 100 x 4 to 100 x 10 pixels) and one
#  named "bar_border", this one must be 102 pixels in width and the height of
#  your bars + 2 pixels, and must consist of a one pixel thick border for your
#  HP/SP bars, and may include a darker colour in the centre.
#------------------------------------------------------------------------------
# * Credit:
#   Rune
#   Modern Algebra for the HP/SP bars coding and for the Window_Command edit
#                  (I'm 99.7% sure that was him).
#==============================================================================

#==============================================================================
# * HP/SP bar configuration
#==============================================================================

HP_BAR = RPG::Cache.picture("HP_bar") # Name of your HP bar
SP_BAR = RPG::Cache.picture("SP_bar") # Name of your SP bar
BAR_BORDER = RPG::Cache.picture("bar_border") # Name of your HP/SP bar border
DECREASE_STYLE = 0 # 0 = squash, 1 = crop

#==============================================================================
# * End of HP/SP bar configuration
#==============================================================================

#==============================================================================
# * MenuStatus bar configuration
#==============================================================================

$activecharid = 1 # Change this to match the current active character
                  # The number is the character's ID in the database
                  # I.e. Arshes = 1, Basil = 2, Cyrus = 3, etc...
                  # To change ingame, use a call script command and type:
                  # $activecharid = number

#==============================================================================
# * End of MenuStatus configuration
#==============================================================================

#==============================================================================
# * Window_Base (Edit)
#==============================================================================

class Window_Base
  #--------------------------------------------------------------------------
  # * Draw Battler
  #     actor   : actor
  #     x       : draw spot x-coordinate
  #     y       : draw spot y-coordinate
  #     opacity : opacity
  #--------------------------------------------------------------------------
  def draw_actor_battler(actor, x, y, opacity)
    char = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
    self.contents.blt(x, y, char, char.rect, opacity)
  end
end

#==============================================================================
# * End of Window_Base (Edit)
#==============================================================================

#==============================================================================
# * Window_Command (Rewrite)
#==============================================================================

class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(width, commands, column_max = 1, style = 0, inf_scroll = 1)
    super(0, 0, width, (commands.size * 1.0 / column_max).ceil * 32 + 32)
    @inf_scroll = inf_scroll
    @item_max = commands.size
    @commands = commands
    @column_max = column_max
    @style = style
    self.contents = Bitmap.new(width - 32, (@item_max * 1.0 / @column_max).ceil * 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = 22
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw_Item
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(index%@column_max * (self.width / @column_max) + 4, 32 * (index/@column_max), self.width / @column_max - 40, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index], @style)
  end
  #--------------------------------------------------------------------------
  # * Disable Item
  #--------------------------------------------------------------------------
  def disable_item(index)
    draw_item(index, disabled_color)
  end
  #--------------------------------------------------------------------------
  # * Update Help
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_actor($game_party.actors[$scene.actor_index])
  end
end

#==============================================================================
# * End of Window_Command (Rewrite)
#==============================================================================

#==============================================================================
# * Window_PlayTime (Edit)
#==============================================================================

class Window_PlayTime
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, "Play Time", 2)
    @total_sec = Graphics.frame_count / Graphics.frame_rate
    hour = @total_sec / 60 / 60
    min = @total_sec / 60 % 60
    sec = @total_sec % 60
    text = sprintf("%02d:%02d:%02d", hour, min, sec)
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 32, 120, 32, text, 2)
  end
end

#==============================================================================
# * End of Window_PlayTime (Edit)
#==============================================================================

#==============================================================================
# * Window_MenuStatus (Rewrite)
#==============================================================================

class Window_MenuStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(240, 32, 320, 416)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    actor = $game_actors[$activecharid]
    draw_actor_battler(actor, 128, 160, 160)
    self.contents.font.size = 32
    self.contents.font.color = Color.new(0, 0, 0, 255)
    self.contents.draw_text(4, 4, 288, 32, actor.name, 1)
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 0, 288, 32, actor.name, 1)
    self.contents.font.size = 22
    draw_actor_class(actor, 16, 160)
    draw_actor_level(actor, 16, 128)
    draw_actor_state(actor, 16, 192)
    draw_actor_exp(actor, 0, 96)
    border = BAR_BORDER
    src_rect = Rect.new(0, 0, 102, 12)
    self.contents.blt(39, 71, border, src_rect)
    self.contents.blt(183, 71, border, src_rect)
    hp = HP_BAR
    sp = SP_BAR
    case DECREASE_STYLE
    when 0
      hp_percent = ((actor.hp.to_f / actor.maxhp.to_f) * 100).to_i
      dest_rect = Rect.new (40, 72, hp_percent, 10)
      self.contents.stretch_blt (dest_rect, hp, hp.rect)
      sp_percent = ((actor.sp.to_f / actor.maxsp.to_f) * 100).to_i
      dest_rect = Rect.new (184, 72, sp_percent, 10)
      self.contents.stretch_blt (dest_rect, sp, sp.rect)
    when 1
      hp_percent = ((actor.hp.to_f / actor.maxhp.to_f) * 100).to_i
      src_rect = Rect.new (0, 0, hp_percent, 10)
      self.contents.blt (40, 72, hp, src_rect)
      sp_percent = ((actor.sp.to_f / actor.maxsp.to_f) * 100).to_i
      src_rect = Rect.new (0, 0, sp_percent, 10)
      self.contents.blt (184, 72, sp, src_rect)
    end
    draw_actor_hp(actor, 0, 48)
    draw_actor_sp(actor, 144, 48)
    draw_item_name($data_weapons[actor.weapon_id], 0, 224)
    draw_item_name($data_armors[actor.armor1_id], 0, 256)
    draw_item_name($data_armors[actor.armor2_id], 0, 288)
    draw_item_name($data_armors[actor.armor3_id], 0, 320)
    draw_item_name($data_armors[actor.armor4_id], 0, 352)
  end
  #--------------------------------------------------------------------------
  # * Dummy
  #--------------------------------------------------------------------------
  def dummy
    self.contents.font.color = system_color
    self.contents.draw_text(0, 112, 96, 32, $data_system.words.weapon)
    self.contents.draw_text(0, 176, 96, 32, $data_system.words.armor1)
    self.contents.draw_text(0, 240, 96, 32, $data_system.words.armor2)
    self.contents.draw_text(0, 304, 96, 32, $data_system.words.armor3)
    self.contents.draw_text(0, 368, 96, 32, $data_system.words.armor4)
    draw_item_name($data_weapons[actor.weapon_id], 0, 144)
    draw_item_name($data_armors[actor.armor1_id], 0, 208)
    draw_item_name($data_armors[actor.armor2_id], 0, 272)
    draw_item_name($data_armors[actor.armor3_id], 0, 336)
    draw_item_name($data_armors[actor.armor4_id], 0, 400)
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
    end
  end
end

#==============================================================================
# * End of Window_MenuStatus (Rewrite)
#==============================================================================

#==============================================================================
# * Scene_Menu
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Makes the Map appear in the background
    @spriteset = Spriteset_Map.new
    # Make command window
    s1 = "Inventory"
    s2 = "Abilities"
    s3 = "Equipment"
    s4 = "Status"
    s5 = "Save Game"
    s6 = "Quit Game"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6], 1, 2)
    @command_window.index = @menu_index
    @command_window.y = 240 - @command_window.height / 2
    @command_window.x = 80
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(4)
    end
    # Make status window
    @status_window = Window_MenuStatus.new
    # Make play time window
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 400
    @playtime_window.y = 160
    @playtime_window.opacity = 0
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 400
    @gold_window.y = 224
    @gold_window.opacity = 0
    # 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
    @playtime_window.dispose
    @spriteset.dispose
    @gold_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @command_window.update
    @playtime_window.update
    @spriteset.update
    @gold_window.update
    @status_window.update
    # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    end
    # If status window is active: call update_status
    if @status_window.active
      update_status
      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 C button was pressed
    if Input.trigger?(Input::C)
      # If command other than save or end game, and party members = 0
      if $game_party.actors.size == 0 and @command_window.index < 4
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Branch by command window cursor position
      case @command_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to skill screen
        $scene = Scene_Skill.new
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equip screen
        $scene = Scene_Equip.new
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to status screen
        $scene = Scene_Status.new
      when 4  # save
        # If saving is forbidden
        if $game_system.save_disabled
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to save screen
        $scene = Scene_Save.new
      when 5  # end game
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_End.new
      end
      return
    end
  end
end

#==============================================================================
# * End of Scene_Menu
#==============================================================================

Credit


  • Rune
  • Modern Algebra

Thanks

  • Modern Algebra, for a couple of scriptlets. I'll leave it up to him whether he wants to be credited, but until he says, be sure to credit him anyway.

Support


PM me on RMRK or CP if you have any issues, or just post in the topic.

Known Compatibility Issues

None known.

Demo


None needed

Author's Notes


If you have any problems, criticism, praise or queries, I'm right here. ;)

Restrictions

No restrictions. I don't care how this is used, as long as I get a little credit acknowledgment in your game's credits.

Enjoy.
« Last Edit: July 01, 2008, 05:13:21 PM by Rune »
Sincerely,
Your conscience.

*******
Rep:
Level 90
Returned from the dead.
Sincerely,
Your conscience.

*
Rep: +0/-0Level 85
I love you! i have ALOT of use for this. Infact it is exactly what i need. Thanks man
« Last Edit: August 05, 2008, 03:13:39 PM by DJIlLuZiOnIsT »

*
Rep: +0/-0Level 7
RMRK Junior
They sta.vlqf.rmrk.net.nae.an hand tried allopurinol without dr prescription propecia cost cialis propecia cialis without prescription cheapest exelon exelon for sale buy zithromax buy cialis online cialis 20 mg lowest price bleed, saline, <a href="http://disasterlesskerala.org/allopurinol/">online allopurinol</a> <a href="http://modreview.net/propecia/">cheap propecia</a> <a href="http://modreview.net/cialis-20-mg-price/">cialis</a> <a href="http://takara-ramen.com/exelon/">exelon</a> <a href="http://ivapelocal.com/zithromax/">zithromax online</a> <a href="http://puresportsnetwork.com/buy-cialis-online/">cialis</a> <a href="http://vintagepowderpuff.com/generic-cialis/">canadian pharmacy cialis 20mg</a> preventive: climate http://disasterlesskerala.org/allopurinol/ online allopurinol http://modreview.net/propecia/ cheap propecia http://modreview.net/cialis-20-mg-price/ cialis cialis http://takara-ramen.com/exelon/ exelon http://ivapelocal.com/zithromax/ azithromycin 250mg http://puresportsnetwork.com/buy-cialis-online/ cialis buy cialis online http://vintagepowderpuff.com/generic-cialis/ cialis endoluminally oligohydramnios, happening, type.