[Resolved][XP] Finish this CMS for me

Started by Ranquil, January 13, 2014, 02:46:08 pm

Previous topic - Next topic

Ranquil

January 13, 2014, 02:46:08 pm Last Edit: January 18, 2014, 04:17:33 am by Ranquil
Yo. I started editing AJNR95's CMS and so far, with my absolutely non-existent RGSS abilities, I managed to adjust the menus the way I wanted to. The menu system and the clock window for it (+ extra poop) are now like this:

Spoiler: ShowHide
Code: Scene_Menu
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

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
   # Make command window
   s1 = $data_system.words.item
   s2 = $data_system.words.skill
   #s3 = $data_system.words.equip
   s4 = "Journal"
   s5 = "Quit"
   @command_window = Window_Command.new(160, [s1, s2, s4, s5])
   @command_window.index = @menu_index
   # 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)
   end
   # If save is forbidden
   if $game_system.save_disabled
     # Disable save
     @command_window.disable_item(4)
   end
   # Make play time window
   @playtime_window = Window_PlayTime.new
   @playtime_window.x = 0
   @playtime_window.y = 224
   # Make gold window
   @gold_window = Window_Gold.new
   @gold_window.x = 0
   @gold_window.y = 160
   # 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
   @gold_window.dispose
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # Update windows
   @command_window.update
   @playtime_window.update
   @gold_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)
       # Call diary
       $scene = Scene_Diary.new
       # Make status window active
       #@command_window.active = false
       #@status_window.active = true
       #@status_window.index = 0
     #when 2  # equipment
       # Play decision SE
       #$game_system.se_play($data_system.decision_se)
     when 2  # 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_Journal.new
     when 3  # 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
 #--------------------------------------------------------------------------
 # * Frame Update (when status window is active)
 #--------------------------------------------------------------------------
 def update_status
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # Make command window active
     @command_window.active = true
     @status_window.active = false
     @status_window.index = 0
     return
   end
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Branch by command window cursor position
     case @command_window.index
     when 1  # skill
       # If this actor's action limit is 2 or more
       if $game_party.actors[@status_window.index].restriction >= 2
         # 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 skill screen
       $scene = Scene_Skill.new(@status_window.index)
     when 2  # equipment
       # Play decision SE
       $game_system.se_play($data_system.decision_se)
       # Switch to equipment screen
       $scene = Scene_Equip.new(@status_window.index)
     end
     return
   end
 end
end


Code: Window_PlayTime
#==============================================================================
# ** Window_PlayTime
#------------------------------------------------------------------------------
#  This window displays play time on the menu screen.
#==============================================================================

class Window_PlayTime < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   super(0, 0, 160, 64)
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   self.contents.font.color = system_color
   @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", hour)
   text2 = sprintf("%02d", min)
   text3 = sprintf("%02d", sec)
   self.contents.font.color = normal_color
   self.contents.draw_text(0, 0, 90, 32, text3, 2)
   self.contents.draw_text(0, 0, 95, 32, "  ", 2)
   self.contents.draw_text(0, 0, 60, 32, text2, 2)
   self.contents.draw_text(0, 0, 65, 32, ":", 2)
   self.contents.draw_text(0, 0, 30, 32, text, 2)
   self.contents.draw_text(0, 0, 35, 32, ":", 2)
   #self.contents.font.color = system_color
   #self.contents.draw_text(0, 16, 70, 135, "Play Time", 2)
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   super
   if Graphics.frame_count / Graphics.frame_rate != @total_sec
     refresh
   end
 end
end


Code: Transparent Menu Add-on
class Scene_Menu

 alias background_main main
 def main
   background = Spriteset_Map.new
   background_main
   background.dispose
 end
end


There are just three more things to do that I just can't pull off on my own. These are:

1. Set a background picture for the menu.
2. Add the battler of the first hero in party to the empty space in the menu. (The battler will change during the game, so I can't just set one specific pic.)
3. Add an icon to the clock window to function as a "currency" or something like that. (I have a clock icon that I want to add to it.)

Would someone be so kind as to help me with this? I understand that I'm a total newb concerning scripting and RGSS and that these things should be fairly simple. I can set the graphics as needed, like the position for the battler and which pic to show, so that's not too specific.



Thanks in advance! :)
Quote from: Some guy on FacebookLife is like a penis. It's short but it feels so long when it gets hard.


Quote from: Steven WinterburnBefore you diagnose yourself with depression or low self-esteem, first make sure that you are not, in fact, just surrounded by assholes.

KK20

The background is simple. If you looked at Scene_Title, you'd see these lines

    # Make title graphic
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.title($data_system.title_name)

# And later below that...this is where the "loop do" is at

    # Dispose of title graphic
    @sprite.bitmap.dispose
    @sprite.dispose

It's exactly the same format (and under method main in about the same spot--before and after the "loop do"); you only need to replace $data_system.title_name with the filename of your graphic, in quotes.

I don't know how you want to add the battler; the menu is pretty bare and open for me to guess where you want it.

To draw an icon to the window

    icon = RPG::Cache.icon('icon_filename')
    rect = Rect.new(0,0,24,24)
    self.contents.blt(x, y, icon, rect)  # Change the x and y to something you like

I'd suggest putting this in the initialize method of the Window_Playtime since it really only needs to be drawn once, not every second when the playtime updates.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Ranquil

January 14, 2014, 03:52:44 am #2 Last Edit: January 15, 2014, 06:35:21 am by Ranquil
Thanks a bunch! I got the background picture to work properly and I got the icon to appear!
Too bad the Garbage Collector (?) removes the icon pretty fast. How can I get around this problem? //Nevermind, I already solved it. I just put it to the refresh area as I was told not to lol

Also, I just want the battler of the first actor in party (oh well, also the only actor in the game) to float somewhere in the empty space in the menu. No movement, no tint or opacity changes, no nothing, just stay put there. I'm using a very large battler so it should be fine. I can adjust the position of it, but it should be the battler of the actor, not just that one battler with the specific filename because the actor's battler will change during the game.
Is that clear enough? :D

EDIT:
Because bumping is epic. (or not)

No double posting within 24 hours please. If you edit your last post, it'll show up as unread to other people. ~ G_G
I tried it first and it didn't work ;___; Oh well, let's just say I got impatient lol. Looks like it didn't work this time either.
Quote from: Some guy on FacebookLife is like a penis. It's short but it feels so long when it gets hard.


Quote from: Steven WinterburnBefore you diagnose yourself with depression or low self-esteem, first make sure that you are not, in fact, just surrounded by assholes.

Ranquil

Because 24 hours have already passed.
And because bumping is epic. (or not)
Quote from: Some guy on FacebookLife is like a penis. It's short but it feels so long when it gets hard.


Quote from: Steven WinterburnBefore you diagnose yourself with depression or low self-esteem, first make sure that you are not, in fact, just surrounded by assholes.

KK20

Yeah sorry. I was busy today. I'll have time tomorrow to help you out. It's not much different from making your background though. Instead, you use

battler_sprite = Sprite.new
battler_sprite.bitmap = RPG::Cache.battler('filename', 0)

and perhaps change the sprite's X/Y coordinates

battler_sprite.x = 200
battler_sprite.y = 100

and don't forget to dispose the sprite and its bitmap in a similar fashion. Of course, the "changing the graphic based on ____ events" will have to be explained.

Quote from: Ranquil on January 14, 2014, 03:52:44 am
//Nevermind, I already solved it. I just put it to the refresh area as I was told not to lol

lol forgot about the self.contents.clear. But yeah, that's all you needed to do. Sure it's extra drawing = more processing = worse performance, but it should not even be noticeable in the slightest.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Ranquil

Thank you! Now I have a battler floating there, yay~

Okay, time for a more thorough explanation. Now that I'm looking back at what I said about the battler, I don't wonder why you didn't understand what I meant lol.


So, the appearance of the actor with the ID of 001 (the only actor in the game btw) will change during the events of the game. I want a picture of the actor to show in the pause menu and reflect the changes as well. How I, with my complete lack of programming skills, imagined it would be the easiest to do would be by showing the battler of the actor, set in the database, in the menu so I could change the picture with events during the game, thus making the picture in the menu change.
I suppose there could be an another way to do it as well, but that how I though it would be the easiest to do. So, how can I set the script the get the filename of the battler of the actor?
Or do you have a better solution on hand?

I'd just like to note at this point that you've a great help so far KK20, because at this point I couldn't have figured all that out by myself. :)
Quote from: Some guy on FacebookLife is like a penis. It's short but it feels so long when it gets hard.


Quote from: Steven WinterburnBefore you diagnose yourself with depression or low self-esteem, first make sure that you are not, in fact, just surrounded by assholes.

KK20

Yes, you can use the 'Change Actor Graphic' command and do

@battler_sprite.bitmap = RPG::Cache.battler($game_player.battler_name, 0)


Glad to be of help~

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Ranquil

I tried that and the game just gave me an error message and then crashed every time I tried to open the menu. It said:


Script 'Scene_Menu' line 25: NoMethodError occurred.

undefined method `battler_name' for #<Game_Player:0x3cd6980>

I'm not sure but I think I'm supposed to specify which actor's battler is supposed to be shown. :D
Quote from: Some guy on FacebookLife is like a penis. It's short but it feels so long when it gets hard.


Quote from: Steven WinterburnBefore you diagnose yourself with depression or low self-esteem, first make sure that you are not, in fact, just surrounded by assholes.

KK20

Right, Game_Player < Game_Character, not Game_Battler.
If your actor is going to be the same, you can do

$game_actors[ID].battler_name


Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Ranquil

Thank you! Now it's working perfectly! :)
Quote from: Some guy on FacebookLife is like a penis. It's short but it feels so long when it gets hard.


Quote from: Steven WinterburnBefore you diagnose yourself with depression or low self-esteem, first make sure that you are not, in fact, just surrounded by assholes.