Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
Tenoukii

Title Screen & Battle Transition

Question

Hey (:

I want to try and move the selection box on the title screen so it looks like this:

Slide1-2.png

Obviously I want the windowskin around it, and the words not so far apart, but hopefully you get the idea.

 

And also, this is my new Battle Transition!-

Youtube Video ->Original Video

 

What do you all think? Is it good, should I keep it, bin it or what?

 

Thankss

Share this post


Link to post
Share on other sites

15 answers to this question

Recommended Posts

  • 0

The transition looks nice, nothing too flashy but definitely is a good transition to a battle!

 

Anywho for making the title screen like that, you would have to write you're own window class that inherits from Window_Selectable, so you can disable continue if there are no save files? I know you are learning scripting so are you requesting a script or would you rather be pointed in the right direction?

 

EDIT: Sorry I mean window_selectable

Edited by kellessdee

Share this post


Link to post
Share on other sites
  • 0

If (in terms of difficulty) it would be beyond basic ( :P ) to do myself, it's a request. but if it's quite easy to do then just some instructions with room to make small modifications would suit me down to the ground (:

Share this post


Link to post
Share on other sites
  • 0

It's not too difficult.

I'll give you the script to reference and explain it

 

SCRIPT:

 

#===============================================================================
# ** Window_Horizontal_Command
#-------------------------------------------------------------------------------
#   A command window that it is horizontal
#===============================================================================
class Window_Horizontal_Command < Window_Selectable
 #-----------------------------------------------------------------------------
 # * Object Initialization
 #     x, y    : coordinates to display window
 #     rows    : number of rows in command window
 #     commands: commands displayed in window
 #-----------------------------------------------------------------------------
 def initialize(x, y, rows, commands)
   super(x, y, 640, rows * 32 + 32)
   self.contents = Bitmap.new(self.width - 32, self.height - 32)
   # Set number of columns
   @column_max = commands.size / rows
   # If the number of commands is odd, increase the number of columns by 1)
   @column_max += 1 if commands.size % 2 > 0
   # Set number of items
   @item_max = commands.size
   @commands = commands
   # Set index at 0
   self.index = 0
   @commands.each_index {|i| draw_command(i, normal_color) }
 end

 #-----------------------------------------------------------------------------
 # * Draw Command
 #     index   : which command to draw
 #     color   : what color to draw command in
 #-----------------------------------------------------------------------------
 def draw_command(index, color)
   # Set font color
   self.contents.font.color = color
   # Draw Item
   w = self.width / @column_max
   x = index % @column_max * w + 4
   y = index / @column_max * 32
   self.contents.draw_text(x, y, w, 32, @commands[index])
 end

 #-----------------------------------------------------------------------------
 # * Disable Item
 #     index   : index of item being disabled
 #-----------------------------------------------------------------------------
 def disable_item(index)
   draw_command(index, disabled_color)
 end
end

This goes anywhere after Window_Selectable, it is called by Window_Horizontal_Command.new(x, y, number_of_rows, commands_array)So it's just like Window_Command, except you specify the number of rows instead of width, and the x and y coordinate. So to use with Scene_Title, change the Window_Command.new(192, [s1, s2, s3]) to Window_Horizontal_Command.new(0, 64, 1, [s1, s2, s3]) (change 0, 64,if you want the window somewhere else) and remove the 2 lines that say:

@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288

and then it should work.

 

 

What I did was create a new type of window, that inherits it's properties from Window_Selectable (which is designed to handle multiple columns as well)

So I made the initialize method to take the x coordinate, y coordinate the number of rows, and the commands.

It then passes them to Window_Selectable (notice rows is passed as rows * 32 + 32, this is to calculate the number of rows into pixels)

I then create the window's bitmap to draw_contents.

To get the number of columns, I need to divide the number of commands, by the number of rows. This works perfectly for an even number of commands. However, if you tried to make an odd number of commands (ex. 7 commands, 2 rows: 7 / 2 = 3.5, but unless specified ruby chops off of the decimal, as a fixnum or integer in other languages as opposed to a float) so since it will always round down, then if the number of commands is odd (if a number is even, itself % (modulus) 2 will make 0, if it is 1, then the number is odd) add an extra column (if first rows will have the larger number of items)

then you need to draw the commands. So for each index of commands, we call draw command. This method needs an index and a color. so we pass each index and set the color to normal_color (inherited from Window_Base) this will draw each method. to calculate WHERE to draw each item, we have to find out the width of each column (windows width/number of columns) then the x coordinate is the remainder of the index divided by number of columns times the width plus 4 (the plus 4 is simply to shift each item 4 pixels down, so it looks nicer in the cursor_rect) then the y coordinate is the index divided by the number of columns, times 32 (the size of each row)

 

Then to disable an item, you simply call the index of an item, and it will call draw_command(index, disabled_color) disabled_color is also inherited from Window_Base.

Share this post


Link to post
Share on other sites
  • 0

Hmm... I'm trying to use your script while I take a stab at making my own (so I could see what it would look like, and to SS it for the project post), but I get this little message when I test play:

 

Script 'Scene_Title' Line 41: NoMethodError occurred. undefined method 'back_opacity =' for nil:NilClass

 

(Line 41 =

     @command_window.back_opacity = 160

)

 

And I have no idea what that means :D

I've had those errors in the past and I just got frustrated trying to figure them out :P What does it mean, and whats the solution? ^_^

Share this post


Link to post
Share on other sites
  • 0

Well first off I'd like to mention that I made an error!

@column_max += 1 if commands.size % 2 > 0

should be

@column_max += 1 if commands.size % 2 > 0 && rows > 1

that way if there is only one row, it doesn't add an extra column, because in the case of 1 row, there is no need for taking in account the odd row out.

 

as for the error, what it means is At line 41, there was a method used that doesn't exist. The undefined method was "back_opacity" for Nil class. What nil class means, is the object you tried to call the method "back_opacity" from, was nil and did not exist. Make sure that line is AFTER you call @command_window = Window_Horizontal_Command.new(....) it needs to be created before methods can be used

Share this post


Link to post
Share on other sites
  • 0

Ah! I missed out a small bit of the script :P

Now thats fixed, just one last thing!

How would i change the sizes of whatever needs to be changed so that it all fits in on one window? (I don't think that makes sense, but hopefully you understand what I mean xD)

Share this post


Link to post
Share on other sites
  • 0

Like if you want to add more commands (say 8), and create a window that fits all the commands properly? Just create the window with more rows. @window = Window_Horizontal_Command(x, y, 2(this is the number of rows), [command1, command2, command3, command4, command5, command6, command7, command8])

 

is that what you mean? how to make the window larger? it is all dependant on the number of rows.

Share this post


Link to post
Share on other sites
  • 0

Errm.. never mind that then xD Would I just remove options by deleting them from the Scene_Title script?

 

EDIT: Okay! So I've deleted the option I wanted to delete (Shutdown) but now its turned the window into a scrolly one, showing like this:

 

New Game ----------------------- (this one option takes up the whole box)

(Pressing the down arrow scrolls down)(R+L Arrows do nothing here)

Continue ----------------------- (this one option takes up the whole box)

 

 

Also, you can't actually see the word 'Continue' (I just know its continue because I pressed it xD)

Does the strange diagram make sense, or do you want some screenshots because I know i'm not great at explaining.

Edited by Tenoukii

Share this post


Link to post
Share on other sites
  • 0

Well first off I'd like to mention that I made an error!

@column_max += 1 if commands.size % 2 > 0

should be

@column_max += 1 if commands.size % 2 > 0 && rows > 1

that way if there is only one row, it doesn't add an extra column, because in the case of 1 row, there is no need for taking in account the odd row out.

 

Yea that was the error I made in the original script. Did you do this? ^ that should fix it.

 

 

EDIT: actually that doesn't sound like that's what is causing the error :/

 

would you mind sending me the Scene_Title script, but just the initialize method? I need to see what you did and let you know whats up mmkay

Edited by kellessdee

Share this post


Link to post
Share on other sites
  • 0

Yeah, I did that when I first put the script it. Here's screenshots of what's going on:

 

titleerror.png

^ New Game Option

titleerror2.png

^ Where continue should be

 

 

 

The whole scroll down thing is quite cool, so I don't mind if that stays. But the Continue text obviously can't be invisible :D

Thankyouu

Edited by Tenoukii

Share this post


Link to post
Share on other sites
  • 0

Hmm interesting...do you mine sending me your Scene_Title script? I can't seem to replicate what you have there...so I am not sure why it is being displayed like that.

Share this post


Link to post
Share on other sites
  • 0
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs title screen processing.
#==============================================================================

class Scene_Title
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   # If battle test
   if $BTEST
     battle_test
     return
   end
   # Load database
   $data_actors        = load_data("Data/Actors.rxdata")
   $data_classes       = load_data("Data/Classes.rxdata")
   $data_skills        = load_data("Data/Skills.rxdata")
   $data_items         = load_data("Data/Items.rxdata")
   $data_weapons       = load_data("Data/Weapons.rxdata")
   $data_armors        = load_data("Data/Armors.rxdata")
   $data_enemies       = load_data("Data/Enemies.rxdata")
   $data_troops        = load_data("Data/Troops.rxdata")
   $data_states        = load_data("Data/States.rxdata")
   $data_animations    = load_data("Data/Animations.rxdata")
   $data_tilesets      = load_data("Data/Tilesets.rxdata")
   $data_common_events = load_data("Data/CommonEvents.rxdata")
   $data_system        = load_data("Data/System.rxdata")
   # Make system object
   $game_system = Game_System.new
   # Make title graphic
   @sprite = Sprite.new
   @sprite.bitmap = RPG::Cache.title($data_system.title_name)
   # Make command window
   s1 = "New Game"
   s2 = "Continue"
   @command_window = Window_Horizontal_Command.new(0, 0, 1, [s1, s2])
   @command_window.back_opacity = 160
   # Continue enabled determinant
   # Check if at least one save file exists
   # If enabled, make @continue_enabled true; if disabled, make it false
   @continue_enabled = false
   for i in 0..3
     if FileTest.exist?("Save#{i+1}.rxdata")
       @continue_enabled = true
     end
   end
   # If continue is enabled, move cursor to "Continue"
   # If disabled, display "Continue" text in gray
   if @continue_enabled
     @command_window.index = 1
   else
     @command_window.disable_item(1)
   end
   # Play title BGM
   $game_system.bgm_play($data_system.title_bgm)
   # Stop playing ME and BGS
   Audio.me_stop
   Audio.bgs_stop
   # 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 command window
   @command_window.dispose
   # Dispose of title graphic
   @sprite.bitmap.dispose
   @sprite.dispose
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # Update command window
   @command_window.update
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Branch by command window cursor position
     case @command_window.index
     when 0  # New game
       command_new_game
     when 1  # Continue
       command_continue
     end
   end
 end
 #--------------------------------------------------------------------------
 # * Command: New Game
 #--------------------------------------------------------------------------
 def command_new_game
   # Play decision SE
   $game_system.se_play($data_system.decision_se)
   # Stop BGM
   Audio.bgm_stop
   # Reset frame count for measuring play time
   Graphics.frame_count = 0
   # Make each type of game object
   $game_temp          = Game_Temp.new
   $game_system        = Game_System.new
   $game_switches      = Game_Switches.new
   $game_variables     = Game_Variables.new
   $game_self_switches = Game_SelfSwitches.new
   $game_screen        = Game_Screen.new
   $game_actors        = Game_Actors.new
   $game_party         = Game_Party.new
   $game_troop         = Game_Troop.new
   $game_map           = Game_Map.new
   $game_player        = Game_Player.new
   # Set up initial party
   $game_party.setup_starting_members
   # Set up initial map position
   $game_map.setup($data_system.start_map_id)
   # Move player to initial position
   $game_player.moveto($data_system.start_x, $data_system.start_y)
   # Refresh player
   $game_player.refresh
   # Run automatic change for BGM and BGS set with map
   $game_map.autoplay
   # Update map (run parallel process event)
   $game_map.update
   # Switch to map screen
   $scene = Scene_Map.new
 end
 #--------------------------------------------------------------------------
 # * Command: Continue
 #--------------------------------------------------------------------------
 def command_continue
   # If continue is disabled
   unless @continue_enabled
     # 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 load screen
   $scene = Scene_Load.new
 end
 #--------------------------------------------------------------------------
 # * Battle Test
 #--------------------------------------------------------------------------
 def battle_test
   # Load database (for battle test)
   $data_actors        = load_data("Data/BT_Actors.rxdata")
   $data_classes       = load_data("Data/BT_Classes.rxdata")
   $data_skills        = load_data("Data/BT_Skills.rxdata")
   $data_items         = load_data("Data/BT_Items.rxdata")
   $data_weapons       = load_data("Data/BT_Weapons.rxdata")
   $data_armors        = load_data("Data/BT_Armors.rxdata")
   $data_enemies       = load_data("Data/BT_Enemies.rxdata")
   $data_troops        = load_data("Data/BT_Troops.rxdata")
   $data_states        = load_data("Data/BT_States.rxdata")
   $data_animations    = load_data("Data/BT_Animations.rxdata")
   $data_tilesets      = load_data("Data/BT_Tilesets.rxdata")
   $data_common_events = load_data("Data/BT_CommonEvents.rxdata")
   $data_system        = load_data("Data/BT_System.rxdata")
   # Reset frame count for measuring play time
   Graphics.frame_count = 0
   # Make each game object
   $game_temp          = Game_Temp.new
   $game_system        = Game_System.new
   $game_switches      = Game_Switches.new
   $game_variables     = Game_Variables.new
   $game_self_switches = Game_SelfSwitches.new
   $game_screen        = Game_Screen.new
   $game_actors        = Game_Actors.new
   $game_party         = Game_Party.new
   $game_troop         = Game_Troop.new
   $game_map           = Game_Map.new
   $game_player        = Game_Player.new
   # Set up party for battle test
   $game_party.setup_battle_test_members
   # Set troop ID, can escape flag, and battleback
   $game_temp.battle_troop_id = $data_system.test_troop_id
   $game_temp.battle_can_escape = true
   $game_map.battleback_name = $data_system.battleback_name
   # Play battle start SE
   $game_system.se_play($data_system.battle_start_se)
   # Play battle BGM
   $game_system.bgm_play($game_system.battle_bgm)
   # Switch to battle screen
   $scene = Scene_Battle.new
 end
end

Share this post


Link to post
Share on other sites
  • 0

Very Strange... Are you using my script? Because It should work fine...when I copy your Title script into my editor, it runs the way you want it..

 

here, I have updated the script anyways, my script wouldn't disable the item correctly (I forgot to erase the item, then redraw it disabled)

 

#===============================================================================
# ** Window_Horizontal_Command
#-------------------------------------------------------------------------------
#   A command window that it is horizontal
#===============================================================================
class Window_Horizontal_Command < Window_Selectable
 #-----------------------------------------------------------------------------
 # * Object Initialization
 #     x, y    : coordinates to display window
 #     rows    : number of rows in command window
 #     commands: commands displayed in window
 #-----------------------------------------------------------------------------
 def initialize(x, y, rows, commands)
   super(x, y, 640, rows * 32 + 32)
   self.contents = Bitmap.new(self.width - 32, self.height - 32)
   # Set number of columns
   @column_max = commands.size / rows
   # If the number of commands is odd, increase the number of rows by 1)
   @column_max += 1 if commands.size % 2 > 0 && rows > 1
   # Set number of items
   @item_max = commands.size
   @commands = commands
   # Set index at 0
   self.index = 0
   refresh
 end

 #-----------------------------------------------------------------------------
 # * Refresh contents
 #-----------------------------------------------------------------------------
 def refresh
   @commands.each_index {|i| draw_command(i, normal_color) }
 end

 #-----------------------------------------------------------------------------
 # * Draw Command
 #     index   : which command to draw
 #     color   : what color to draw command in
 #-----------------------------------------------------------------------------
 def draw_command(index, color)
   # Set font color
   self.contents.font.color = color
   # Draw Item
   w = self.width / @column_max
   x = index % @column_max * w + 4
   y = index / @column_max * 32
   rect = Rect.new(x, y, w, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   self.contents.draw_text(x, y, w, 32, @commands[index])
 end

 #-----------------------------------------------------------------------------
 # * Disable Item
 #     index   : index of item being disabled
 #-----------------------------------------------------------------------------
 def disable_item(index)
   draw_command(index, disabled_color)
 end
end

 

did you modify my script at all? Because I can't see why it would draw the commands like that, you set it up correctly...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...