[XP] Rune's CMS

Started by Rune, March 23, 2008, 04:30:57 pm

Previous topic - Next topic

Rune

March 23, 2008, 04:30:57 pm Last Edit: February 21, 2009, 05:49:00 am by Blizzard
Rune's CMS #5
Authors: Rune
Version: 1.0.0
Type: Menu System
Key Term: Custom Menu System



Introduction

Thought I'd kick-start my stay here at Chaosproject with a script.
This is my fifth released CMS, and I have to say, I think it's my best yet.


Features


  • Battler Display
  • Equipment Display
  • Cool Font (imo)
  • Location Display
  • Put your game name into it



Screenshots

Command Menu Active
Spoiler: ShowHide


Status Window Active
Spoiler: ShowHide



Demo

None needed


Script

Simply replace your current Scene_Menu with this:
Spoiler: ShowHide
#======================#
#     > CMS #5         #
#      > By Rune       #
#       > Ver. 1       #
#======================#

#---------------------Window_Base---------------------
#---------------------Battler display---------------------

class Window_Base
  def draw_actor_battler(actor, x, y, opacity)
    bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
    cw = bitmap.width
    ch = bitmap.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  end

#---------------------Name + Class display---------------------

  def draw_actor_name_menu(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 160, 32, actor.name, 1)
  end 
  def draw_actor_class(actor, x, y)
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, 160, 32, actor.class_name, 1)
  end

#---------------------Level display---------------------

  def draw_actor_level(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 32, 32, "Lv:")
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 24, y, 24, 32, actor.level.to_s, 2)
  end

#---------------------EXP display---------------------

  def draw_actor_exp(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 608 / 4, 32, "EXP")
    self.contents.font.color = normal_color
    self.contents.draw_text(x - 16, y + 16, 84, 32, actor.exp_s, 2)
    self.contents.draw_text(x + 68, y + 16, 12, 32, "/", 1)
    self.contents.draw_text(x + 80, y + 16, 84, 32, actor.next_exp_s)
  end

#---------------------Equipment display---------------------

  def draw_item_name_menu(item, x, y)
    if item == nil
      return
    end
    bitmap = RPG::Cache.icon(item.icon_name)
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 28, y, 608 / 4 - 28, 32, item.name)
  end
end


#---------------------Window_MenuStatus---------------------

class Window_MenuStatus < Window_Selectable
  def initialize
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.active = false
    self.index = -1
  end
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = i * 608 / 4
      y = 0
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x + 12, y + 64)
      draw_actor_battler(actor, x + 75, y + 256, 160)
      self.contents.font.size = 28
      self.contents.font.name = "Monotype Corsiva"
      draw_actor_name_menu(actor, x - 10, y)
      self.contents.font.size = 24
      draw_actor_class(actor, x - 10, y + 32)
      draw_actor_level(actor, x + 2, y + 64)
      draw_actor_state(actor, x + 50, y + 64)
      draw_actor_hp(actor, x + 2, y + 208)
      draw_actor_sp(actor, x + 2, y + 224)
      draw_actor_exp(actor, x + 2, y + 240)
      self.contents.draw_text(0, 270, 608, 32, "=========================================================================================================================")
      draw_item_name_menu($data_weapons[actor.weapon_id], x + 2, y + 288)
      draw_item_name_menu($data_armors[actor.armor1_id], x + 2, y + 320)
      draw_item_name_menu($data_armors[actor.armor2_id], x + 2, y + 352)
      draw_item_name_menu($data_armors[actor.armor3_id], x + 2, y + 384)
      draw_item_name_menu($data_armors[actor.armor4_id], x + 2, y + 416)
    end
  end
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(@index * 608 / 4, 0, 608 / 4, self.height - 32)
    end
    if Input.repeat?(Input::RIGHT)
      if (@column_max == 1 and Input.trigger?(Input::RIGHT)) or
          @index < @item_max - @column_max
        $game_system.se_play($data_system.cursor_se)
        @index = (@index + @column_max) % @item_max
      end
    end
    if Input.repeat?(Input::LEFT)
      if (@column_max == 1 and Input.trigger?(Input::LEFT)) or
          @index >= @column_max
        $game_system.se_play($data_system.cursor_se)
        @index = (@index - @column_max + @item_max) % @item_max
      end
    end
  end
end


#---------------------Window_Gold---------------------

class Window_Gold < Window_Base
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.name = "Monotype Corsiva"
    self.contents.font.size = 24
    self.contents.draw_text(0, 32, 128, 32, $game_party.gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 128, 32, $data_system.words.gold)
  end
end


#---------------------Window_PlayTime---------------------

class Window_PlayTime
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.font.name = "Monotype Corsiva"
    self.contents.font.size = 24
    self.contents.draw_text(4, 0, 120, 32, "Play Time")
    @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


#---------------------Window_Command---------------------

class Window_Command
  def refresh
    self.contents.clear
    for i in 0...@item_max
      self.contents.font.name = "Monotype Corsiva"
      self.contents.font.size = 24
      draw_item(i, normal_color)
    end
  end
end


#---------------------Window_Location---------------------

$data_mapinfos = load_data('Data/MapInfos.rxdata')

class Window_Location < Window_Base
  def initialize
    super(0, 0, 320, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  def refresh
    self.contents.clear
    self.contents.font.name = "Monotype Corsiva"
    self.contents.font.size = 24
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 80, 32, "Location:")
    self.contents.font.color = normal_color
    name = $data_mapinfos[$game_map.map_id].name 
    self.contents.draw_text(96, 0, 192, 32, name)
  end
end

#---------------------Window_GameName---------------------

class Window_GameName < Window_Base
  def initialize
    super(0, 0, 320, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  def refresh
    self.contents.clear
    self.contents.font.name = "Monotype Corsiva"
    self.contents.font.size = 24
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 288, 32, "Insert Name Of Game", 1)
  end
end


#---------------------Scene_Menu---------------------

class Scene_Menu
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  def main
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Save Game"
    s6 = "End Game"
    @status_window = Window_MenuStatus.new
    @status_window.x = 0
    @status_window.y = 0
    @status_window.contents_opacity = 44
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 160
    @playtime_window.y = 320
    @playtime_window.visible = true
    @gold_window = Window_Gold.new
    @gold_window.x = 320
    @gold_window.y = 320
    @gold_window.visible = true
    @loc_window = Window_Location.new
    @loc_window.x = 0
    @loc_window.y = 416
    @loc_window.visible = true
    @gn_window = Window_GameName.new
    @gn_window.x = 320
    @gn_window.y = 416
    @gn_window.visible = true
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
    @command_window.index = @menu_index
    @command_window.x = 240
    @command_window.y = 128
    @command_window.height = 32 * 6 + 1
    @command_window.visible = true
    if $game_party.actors.size == 0
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    if $game_system.save_disabled
      @command_window.disable_item(4)
    end
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @loc_window.dispose
    @gn_window.dispose
    @playtime_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
  def update
    @command_window.update
    @loc_window.update
    @gn_window.update
    @playtime_window.update
    @gold_window.update
    @status_window.update
    if @command_window.active
      update_command
      return
    end
    if @status_window.active
      update_status
      return
    end
  end
  def update_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      if $game_party.actors.size == 0 and @command_window.index < 4
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @command_window.index
      when 0
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Item.new
      when 1
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @command_window.visible = false
        @gold_window.visible = false
        @playtime_window.visible = false
        @loc_window.visible = false
        @gn_window.visible = false
        @status_window.contents_opacity = 256
        @status_window.active = true
        @status_window.index = 0
      when 2
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @command_window.visible = false
        @gold_window.visible = false
        @playtime_window.visible = false
        @loc_window.visible = false
        @gn_window.visible = false
        @status_window.contents_opacity = 256
        @status_window.active = true
        @status_window.index = 0
      when 3
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @command_window.visible = false
        @gold_window.visible = false
        @playtime_window.visible = false
        @loc_window.visible = false
        @gn_window.visible = false
        @status_window.contents_opacity = 256
        @status_window.active = true
        @status_window.index = 0
      when 4
        if $game_system.save_disabled
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Save.new
      when 5
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_End.new
      end
      return
    end
  end
  def update_status
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = true
      @command_window.visible = true
      @gold_window.visible = true
      @playtime_window.visible = true
      @loc_window.visible = true
      @gn_window.visible = true
      @status_window.contents_opacity = 64
      @status_window.active = false
      @status_window.index = -1
      return
    end
    if Input.trigger?(Input::C)
      case @command_window.index
      when 1
        if $game_party.actors[@status_window.index].restriction >= 2
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Skill.new(@status_window.index)
      when 2
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Equip.new(@status_window.index)
      when 3
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Status.new(@status_window.index)
      end
      return
    end
  end
end



Instructions

Plug-n-play, except the game name.
Ctrl + f to search through the script for "Insert Name Of Game". Replace the text inside the quotation marks with the name of your game.

If you can't see the font, download it, and put it in your computer's 'Fonts' folder.
Linky >> http://www.newfonts.net/index.php?pa=show_font&id=130



Compatibility

No known incompatibility issues.


Credits and Thanks


  • Just me



Author's Notes

Any problems, or queries, reply here, or contact me via PM. ;)
Signature.

Starrodkirby86

The Active Command Menu looks marvelous. I love the symmetrical Pyramid feel to it. If I'm not mistaken, you can edit the font to your liking, am I correct? This is a simple assumption I am making. On the Active Status Window, the "======" look a little annoying. Can you modify this? If so, then that's A-OK.

Overall, I love this CMS. I don't know if I'm using it in the future, considering I don't even have a project set up on RPG Maker XP yet. :P

What's osu!? It's a rhythm game. Thought I should have a signature with a working rank. ;P It's now clickable!
Still Aqua's biggest fan (Or am I?).




Rune

To get rid of the annoying "=====================", simply delete the longest line in the script xD
I put that there to separate the equipment and the other stats.

Do you mean the font style, or the font color, etc?
Signature.

Nortos

try putting an image there might look nicer or you could do two seperate windows but than u would have to modify other stuff more. It looks good maybe you could add an option to change the tone or opacity of the status when u have the command window active.

Starrodkirby86

Quote from: Rune on March 23, 2008, 05:54:40 pm
To get rid of the annoying "=====================", simply delete the longest line in the script xD
I put that there to separate the equipment and the other stats.

Do you mean the font style, or the font color, etc?
It doesn't matter whether it's been the former or the latter you know. I just meant the Font Face, but Color is acceptable as well. :P

What's osu!? It's a rhythm game. Thought I should have a signature with a working rank. ;P It's now clickable!
Still Aqua's biggest fan (Or am I?).




Rune

The font face is changable, but the size will also need to be changed depending on the font you are changing to. The font color is also editable.

@Nortos - I may add two windows over the top of the status screen, thus splitting it up, with no further editing, though this may conflict with the cursor on the status window. Also, an image would be just as annoying as an army of '='s.
Signature.

Fantasist

Intereting layout, but it all seems to be a bit cramped to me. Just  my opinion. I'll try this with other fonts and see. Again, good idea with the layout :D *powers up*
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Sase

March 24, 2008, 04:59:17 am #7 Last Edit: March 24, 2008, 05:00:00 am by Tsurara
You could replace that line with ===='s using ?'s or ?'s or other cool unicode symbols (link)

Looks AWESOME, I'll try later if this works with my scripts!

10/10!

Rune

Quote from: Tsurara on March 24, 2008, 04:59:17 am
You could replace that line with ===='s using ?'s or ?'s or other cool unicode symbols (link)

Again, that would still get as annoying as my multitude of ='s.

@Fantasist - That's about as uncramped as I can get it atm I think. :-\ Thanks for the charge though :D

Thanks for the comments guys. Much appreciated :)
Signature.

Juan

March 24, 2008, 10:43:12 am #9 Last Edit: March 24, 2008, 10:43:44 am by Juan
instead of looking for each line thats 'Insert game here try using constants something like Game_Name = 'insert game here' then it would sorta be more plug in and play. Btw nice cms layout.
Dropbox Who need luck when you can make your own.
3ds Friend code: ShowHide
 4468 1422  6617

Rune

That'd be pointless as you only have to change one string in the first place. :P
Signature.

Juan

Oh I through there was more lines that said it. I didn't get a chance to look at the script.
Dropbox Who need luck when you can make your own.
3ds Friend code: ShowHide
 4468 1422  6617

Fantasist

Well, if it were me, I'd make that constant even if it's just one line. Not only for a public release, but even for my own use. In some other scripts I made, there are more constants in my script than in the one I post here. Mainly for easy cosmetic adjustment and convenience.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Rune

I see. I may do that then. :)
Signature.

Valcos

Its nice its just a bit extra :-\ if you know what i mean. Very flashy imo :P. But its nice ;D!
"We are all in the gutter, but some of us are looking at the stars."
-Oscar De La Hoya

Fantasist

I didn't mean to preach Rune, just stated my opinion, sorry if you got me wrong, lol! But nice work indeed :D
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Rune

I didn't take it as preaching at all. :D I took it as help and advice. :P
Signature.

Fantasist

Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Blizzard

You should just add a constant on top like GAME_NAME and use it further down in the script instead of making the user use the search function. *powers up and moves*
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Rune

I know, I'm gonna include that in the first update :P Thanks for the powerup ;)
Anybody got any other suggestions, problems, etc?

(Think someone's been spam-powering me xD I only had 1 energy last lime I checked :P)
Signature.