Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Error with 'Double Menu' in ToS Menu, The main options appear twice at times.
CelestOrion
post Dec 5 2011, 05:13 AM
Post #1


Level 8
Group Icon

Group: Revolutionary
Posts: 119
Type: Writer
RM Skill: Intermediate




Hello there. I'm using a script called the 'Tales of Symphonia Menu Compilations', found on Creation Asylum. However, I've tried fixing what appears to be a 'double-menu' glitch, where the 'items, stats, equip' options appear twice and stacked on top of each other. I'm not sure how to fix this, since I'm not too savvy with RGSS yet, so I was hoping that one of you might be able to help me work this bug out.

Here is a screenshot of the bug.



I've provided a link for the download of the project here, so that you can see it in action.
http://www.mediafire.com/?bf0lub99lky12ax

Thanks to anybody reading this inquiry.

This post has been edited by jessethehedgehog: Dec 5 2011, 05:16 AM


__________________________
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Dec 5 2011, 11:12 PM
Post #2


Level 50
Group Icon

Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed




How've you been?


To get rid of the double window, you need to find the lines:
pre

And change them to:
aft

And the code itself:
CODE
args = [s1, s2, s3, s4, s5, s6, s7]
if Vash_ToS::ICON
@command_window = Window_MenuCommand.new(626, args, Vash_ToS::ICON_NAME)
else
@command_window = Window_MenuCommand.new(626, args)
end






I also decided that I didn't like the way the cursor worked, so I've made a few alterations.... actually, quite a few alterations..... have a demo!
http://ge.tt/8fNTPoA?c


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
CelestOrion
post Dec 5 2011, 11:54 PM
Post #3


Level 8
Group Icon

Group: Revolutionary
Posts: 119
Type: Writer
RM Skill: Intermediate




For some odd reason, I'm not surprised in the least that it was you to come to my rescue, haha. How's it going, man?

Thanks for the demo, everything seems fixed in it, especially now having the skit window show up properly in the menu as well.

I had another question that had to do with the menu, though. Not a bug, but more of a 'mod request'.

In the status window, on the far right is where your character Battler graphic would go, but since this battle system changes how the battlers work entirely, I was wondering if the script for the Status window could be slightly modified so that it would pull up a picture from a different folder (Pictures, per say) that is associated filename-wise with the character in the database (ex: Arshes would pull up ArshesStatus.png or something similar based on database values). I actually think it would be a simple mod, but I don't understand that aspect of RGSS yet, haha.

This post has been edited by jessethehedgehog: Dec 6 2011, 07:48 PM


__________________________
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Dec 9 2011, 07:49 PM
Post #4


Level 50
Group Icon

Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed




Sorry for the delay, I accidentally broke my computer when I tried installing ChromeOS as a dual boot.

You'll need to look for the code on line 1152 of the ToS Menu Script
before

And change it to read:
after

CODE
bitmap = RPG::Cache.picture(@actor.name + "Status")
self.contents.blt(190, 400, bitmap, bitmap.rect)

And that should get it working for you smile.gif


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
CelestOrion
post Dec 10 2011, 10:38 PM
Post #5


Level 8
Group Icon

Group: Revolutionary
Posts: 119
Type: Writer
RM Skill: Intermediate




Hmm. I got the code implemented, and threw a sample test in there called 'TwilightStatus', which the script read just fine (as tested by other file names), yet when I load the status window, there is no picture there. Is there a certain resolution that the image must be in? I was using 200x480, since I thought it would have just been aligned on that side.

Sample Image I used


__________________________
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Dec 12 2011, 01:09 AM
Post #6


Level 50
Group Icon

Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed




http://ge.tt/9aX8J4B?c

I made a few more adjustments, it works better with your sample image, and the code got too complex for images, and too long for the spoilers, so just use this as your ToS Menu script sad.gif


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
CelestOrion
post Dec 12 2011, 05:59 AM
Post #7


Level 8
Group Icon

Group: Revolutionary
Posts: 119
Type: Writer
RM Skill: Intermediate




This is fantastic, NR! I don't know why it became complex for the images, since I thought it would have just been a simple code change, but it works just how I imagined it.

I have only one more scripting question, and THEN I PROMISE YOU I'M DONE. Unless things screw up for me halfway through game making, haha.

I wanted to add a 'Letter by Letter Message System' to this project, one that I believe you helped me implement way back in an earlier project. The only issue I have with it right now is just getting it to work with the other Skit Script, since they both involve Window_Message.

Here's a link to the script: Letter by Letter Message System

Here's an image of the first Syntax error I receive. If I were able to get past it, I'd know if there were other errors or not, haha.


__________________________
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Dec 13 2011, 05:43 AM
Post #8


Level 50
Group Icon

Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed




I believe that it's a problem with creation asylum (maybe they broke something during an upgrade?), I downloaded a version from rmrk (link) and it worked perfectly smile.gif


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
CelestOrion
post Dec 13 2011, 06:15 AM
Post #9


Level 8
Group Icon

Group: Revolutionary
Posts: 119
Type: Writer
RM Skill: Intermediate




Huh, so it does. Well, that's rather convenient, haha. I think this practically wraps up all of the scripts that I need for the game, minus the Cooking system that all of the Tales games have. That could simply work off of a modified crafting/forging system. Basically, they work the same way, but have a different interface design.

I'll update this thread if I need anymore help, haha. Thanks for the help, Night, I really owe you one.

EDIT: Just remember, I posted before in Night5h4d3's thread for their Skit System, asking about how to change the dimensions for their template for faces. I never did receive a reply, so I was wondering if you could probably figure it out? The link is here: http://www.rpgrevolution.com/forums/index....showtopic=52804

I'm almost guaranteed that it starts on line 71, involving all of the 'math functions' that I'm too stupid to comprehend, haha.

This post has been edited by CelestOrion: Dec 13 2011, 06:22 AM


__________________________
Go to the top of the page
 
+Quote Post
   
CelestOrion
post Apr 2 2012, 04:41 PM
Post #10


Level 8
Group Icon

Group: Revolutionary
Posts: 119
Type: Writer
RM Skill: Intermediate




Bump. :<


__________________________
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Apr 3 2012, 04:33 AM
Post #11


Level 50
Group Icon

Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed




I think the easiest way to do this is to just append the new positions to the end, so we're looking for the code highlighted here at the end of line 89
spoilt since it stretches the forum


I'm going to make a new position at 0, 0 (the top left corner), and add make it the 19th position (continuing on from the 18th there).
We need to add a comma to the end of 18 to tell ruby that we have more values after this one, and then we add the new position
spoilt since it stretches the forum

The order is:
Position_Index => [Pixels_Across_Left, Pixels_From_Top],
And I've moved the } to a new line.

But if you make sure that the 3rd input to the new_face method is your new 19th position, then it works fine for me.



Just to let you know, the original mathematics finds the top corner position to put the picture, if you want the picture to be centered to the screen, and then moves that picture by a number of pixels vertically and then across, so it will look the same, independent of the screen resolution (which allows it to work with RMVX, and games using the resolution changing scripts).
But since you know the resolution of your game you don't have to worry about it happy.gif


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
CelestOrion
post Apr 3 2012, 11:25 PM
Post #12


Level 8
Group Icon

Group: Revolutionary
Posts: 119
Type: Writer
RM Skill: Intermediate




Yes, but isn't that just where it positions the existing image that was taken out of the template? What I'm trying to do is figure out how to resize the actual image template so that the images aren't read in a certain dimension, haha. For example, if I wanted the code to divide up a template by 150x150 pixels, I'd have to find out where in the code I could do this. I should have stated it before, lol.


__________________________
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Apr 4 2012, 02:58 AM
Post #13


Level 50
Group Icon

Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed




But you promised me that it was the template that started on line 71, so I thought that you were talking about this template:
http://img20.imageshack.us/img20/6615/spacedh.png
The template for the positioning of the faces.

I'm guessing that you're talking about the face graphic template:
http://img546.imageshack.us/img546/4058/skitfacetemplate.png

How it's 96 pixels across and 120 pixels down?
If that's the problem then use this code:
CODE
#==============================================================================
# N5_Module - Skit
#------------------------------------------------------------------------------
# By Night5h4d3
# Version 4.6.0.5
# Date 11/11/2010
# Last Update 8/2/2011
#==============================================================================
# • Support/Troubleshooting/FAQ's/Bugs:
# If what you have in mind falls under those categories, PM me at:
# http://www.rpgrevolution.com/
# (Username: Night5h4d3)
#------------------------------------------------------------------------------
# Pre-script redef
#------------------------------------------------------------------------------
module Graphics
  def self.width
    return 640
  end
  def self.height
    return 480
  end
end
#------------------------------------------------------------------------------
# • Key
#   <S> = New value in "string" format
#   <B> = New value in boolean format (true/false)
#   <H> = New value in hash format (I=>N)
#   <P> = Pointer to existing variable
#==============================================================================
module N5
#------------------------------------------------------------------------------
# • Skit Presets
#------------------------------------------------------------------------------
    # <S> This is the filename to use for the skit system
    #--------------------------------------------------------------------------
    Skit_BG       = "Skit_BG"
    #--------------------------------------------------------------------------
    # This is the filename to use for the skit system's activation button.
    # located in
    #--------------------------------------------------------------------------
    Skit_Button   = "Skit_Button"
    #--------------------------------------------------------------------------
    # <P> This is the button needed in order to activate the skit system
    #--------------------------------------------------------------------------
    Skit_Activate = Input::X
    #--------------------------------------------------------------------------
    # <S> This is the default music to play during a 'skit', this can be changed
    # later by using a call script ($game_system.skit_bgm = "<new BGM name>")
    #--------------------------------------------------------------------------
    Skit_BGM = ""
    #--------------------------------------------------------------------------
    # <S> Refers to the Icon used for new/un-watched skits, leave "" or nil
    # if you don't want an icon to be displayed next to new skits, they will be
    # italic if no icon is used.
    #--------------------------------------------------------------------------
    New_Skit_Icon = ""
    #--------------------------------------------------------------------------
    # <S> The term used in the menu for skits.
    #--------------------------------------------------------------------------
    Skits_Term = "Skits"
    #--------------------------------------------------------------------------
    # <B> Pause the interpreter while modifying faces, this will cause the
    # interpreter to stop until a face is created/reaches its destination.
    #--------------------------------------------------------------------------
    Pause_While = false
    #--------------------------------------------------------------------------
    # <H> The positioning used for the skit faces. > Do not change this unless
    # you know what you're doing! <
    #--------------------------------------------------------------------------
    SKIT_POS = { 0 => [(((Graphics.width-448)/2)+176),(((Graphics.height-(32*4))-120)/2)],
    1 => [(((Graphics.width-448)/2)+112), (((Graphics.height-(32*4))-120)/2)],
    2 => [(((Graphics.width-448)/2)+240), (((Graphics.height-(32*4))-120)/2)],
    3 => [(((Graphics.width-448)/2)+48), (((Graphics.height-(32*4))-120)/2)],
    4 => [(((Graphics.width-448)/2)+304), (((Graphics.height-(32*4))-120)/2)],
    5 => [(((Graphics.width-448)/2)+112), 32],
    6 => [(((Graphics.width-448)/2)+240), 32],
    7 => [(((Graphics.width-448)/2)+112), (((Graphics.height-(32*5))/2)+32)],  
    8 => [(((Graphics.width-448)/2)+240), (((Graphics.height-(32*5))/2)+32)],
    9 => [(((Graphics.width-448)/2)+48), 32],
    10 => [(((Graphics.width-448)/2)+304), 32],
    11 => [(((Graphics.width-448)/2)+48),(((Graphics.height-(32*5))/2)+32)],
    12 => [(((Graphics.width-448)/2)+304), (((Graphics.height-(32*5))/2)+32)],
    13 => [(((Graphics.width-448)/2)+176), 32],
    14 => [(((Graphics.width-448)/2)+176), (((Graphics.height-(32*5))/2)+32)],
    15 => [(((Graphics.width-448)/2)), (((Graphics.height-(32*5))/2)+32)],  
    16 => [(((Graphics.width-448)/2)+368), (((Graphics.height-(32*5))/2)+32)],
    17 => [(((Graphics.width-448)/2)), 32],
    18 => [(((Graphics.width-448)/2)+368), 32],
    19 => [0, 0],
    }
end
  
#==============================================================================
# How to use: |  Making use of this module is actually quite easy, first off
#=============+  when you want to make add a skit, code it's text in a common-
# event, then come here. find the most recent array that hasnt been used - in
# this case, C and rename it . And then we begin editing
# data, just enter in between the brackets [ ] the data in this format:
# NAME, COMMON EVENT NUMBER, MANDITORY?, USE CUSTOM MUSIC?
#   The name is what displays in the skit menu if you decide to re-play the
# skit.
#   The common event number is the number of the common event to run when this
# skit is active.  
#   Manditory? is either true or false, if true, the skit will activate without
# player's consent, this is if you want a skit that MUST be played at that
# moment.
#   Use custom music? set this as true if you want to use a custom song to play
# while the skit is playing, otherwise, the map BGM will continue to play.
#==============================================================================
module Skits
  FRIES_M = ["I want fries - Manditory ver.", 1, true, true]
  FRIES = ["I want fries", 2, false, false]
  C = []  
  # Append skits here
  # NOTE: MUST BE ALL CAPS
  
  
end

#==============================================================================
# * END CONFIGURATION ZONE
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
# The instance of this class is referenced by $game_temp.
#==============================================================================
class Game_Temp
  attr_accessor :newskit                  # new skit available flag
  attr_accessor :skit_beep                # play SE flag
  attr_accessor :last_bgm                 # memory of the last bgm played
  attr_accessor :last_bgs                 # memory of the last bgs played
  attr_accessor :skit_bg                  # snapshot of map screen for skit bg
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias n543_init initialize
  def initialize
    n543_init
    @skit_beep = false
    @newskit = false
    @last_bgm = nil
    @last_bgs = nil
    @skit_bg = nil
  end
end

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Get Skit BGM (N5)
  #--------------------------------------------------------------------------
  def skit_bgm
    if @skit_bgm == nil
      unless N5::Skit_BGM == nil or '' or ""
        return N5::Skit_BGM
      end
      return false
    else
      return @skit_bgm
    end
  end
  #--------------------------------------------------------------------------
  # * Set Skit BGM (N5)
  #     skit_bgm : new BGM
  #--------------------------------------------------------------------------
  def skit_bgm=(skit_bgm)
    @skit_bgm = skit_bgm
  end
end
#==============================================================================
# ** Game_Skit
#------------------------------------------------------------------------------
#  This class handles Skit variables. It includes the data of available and
# watched skits in addition to their names.
#==============================================================================
class Game_Skit
  attr_accessor   :skits
  attr_accessor   :watched
  attr_accessor   :names
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     skits : Current skits in list
  #   watched : Skits that have been watched (for displaying 'new' icon)
  #     names : Names to display for skit menu
  #--------------------------------------------------------------------------
  def initialize
    @skits = []
    @watched = []
    @names = []
    @skit_count_old = @skits.size
  end
  #--------------------------------------------------------------------------
  # * New Skits Available
  #--------------------------------------------------------------------------
  def new_skits?
    return true if @skits.size > @skit_count_old
  end
end

#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
#  An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================
class Interpreter
  #--------------------------------------------------------------------------
  # * Event Setup
  #     list     : list of event commands
  #     event_id : event ID
  #--------------------------------------------------------------------------
  alias n543_setup setup
  def setup(list, event_id = 0)
    n543_setup(list, event_id)
    @pause = false
  end
  #--------------------------------------------------------------------------
  # * Get Pause state
  #--------------------------------------------------------------------------
  def pause
    return @pause
  end
  #--------------------------------------------------------------------------
  # * Set Pause state
  #--------------------------------------------------------------------------
  def pause=(pause)
    @pause = pause
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Initialize loop count
    @loop_count = 0
    # Loop
    loop do
      # Add 1 to loop count
      @loop_count += 1
      # If 100 event commands ran
      if @loop_count > 100
        # Call Graphics.update for freeze prevention
        Graphics.update
        @loop_count = 0
      end
      # If map is different than event startup time
      if $game_map.map_id != @map_id
        # Change event ID to 0
        @event_id = 0
      end
      # If a child interpreter exists
      if @child_interpreter != nil
        # Update child interpreter
        @child_interpreter.update
        # If child interpreter is finished running
        unless @child_interpreter.running?
          # Delete child interpreter
          @child_interpreter = nil
        end
        # If child interpreter still exists
        if @child_interpreter != nil
          return
        end
      end
      # If waiting for message to end
      if @message_waiting
        return
      end
      # If pause while moving faces (N543 Skit System)
      unless N5::Pause_While
        if @pause == true
          return
        end
      end
      # If waiting for move to end
      if @move_route_waiting
        # If player is forcing move route
        if $game_player.move_route_forcing
          return
        end
        # Loop (map events)
        for event in $game_map.events.values
          # If this event is forcing move route
          if event.move_route_forcing
            return
          end
        end
        # Clear move end waiting flag
        @move_route_waiting = false
      end
      # If waiting for button input
      if @button_input_variable_id > 0
        # Run button input processing
        input_button
        return
      end
      # If waiting
      if @wait_count > 0
        # Decrease wait count
        @wait_count -= 1
        return
      end
      # If an action forcing battler exists
      if $game_temp.forcing_battler != nil
        return
      end
      # If a call flag is set for each type of screen
      if $game_temp.battle_calling or
         $game_temp.shop_calling or
         $game_temp.name_calling or
         $game_temp.menu_calling or
         $game_temp.save_calling or
         $game_temp.gameover
        return
      end
      # If list of event commands is empty
      if @list == nil
        # If main map event
        if @main
          # Set up starting event
          setup_starting_event
        end
        # If nothing was set up
        if @list == nil
          return
        end
      end
      # If return value is false when trying to execute event command
      if execute_command == false
        return
      end
      # Advance index
      @index += 1
    end
  end
end
  
#==============================================================================
# ** Window_Message
#------------------------------------------------------------------------------
#  This message window is used to display text.
#==============================================================================

class Window_Message < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    if $scene.is_a?(Scene_Skit)
      super(0, (Graphics.width/2)-16, Graphics.width, 160)
    else
      super((Graphics.height/2)-160, (Graphics.width/2)-16, Graphics.height, 160)
    end
    self.contents = Bitmap.new(width - 32, height - 32)
    self.visible = false
    self.z = 9998
    @fade_in = false
    @fade_out = false
    @contents_showing = false
    @cursor_width = 0
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # * Set Window Background and Position
  #--------------------------------------------------------------------------
  alias n543_rw reset_window
  def reset_window
    n543_rw
    case $game_system.message_position
    when 0  # Top
      self.y = 0
    when 1  # Middle
      self.y = (Graphics.height / 2) - (160 / 2)
    when 2  # Bottom
      self.y = (Graphics.height - 160)
    end
    if $scene.is_a?(Scene_Skit)
      self.opacity  = 0
    end
  end
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#  This class brings together map screen sprites, tilemaps, etc. It's used
# within the Scene_Map class.
#==============================================================================
class Spriteset_Map
  attr_accessor    :viewport1
  attr_accessor    :viewport2
  attr_accessor    :viewport3
end

class Window_PlayTime < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x = 0,y = 0,w = 160,h = 96)
    super(x,y,w,h)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
end
#==============================================================================
# ** Window_SkitCommand
#------------------------------------------------------------------------------
#  Similar to 'Menu_Command' but changed to adapt separate functionality for the
# skit system.
#==============================================================================
class Window_SkitCommand < Window_Selectable
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :commands                 # command
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     width      : window width
  #     commands   : command string array
  #     align      : alignment (0 left, 1 center, 2 right)
  #     column_max : digit count (if 2 or more, horizontal selection)
  #     row_max    : row count (0: match command count)
  #     spacing    : blank space when items are arrange horizontally
  #--------------------------------------------------------------------------
  def initialize(commands, align = 1, column_max = 1, row_max = 13)
    if row_max == 0
      row_max   = (commands.size + column_max - 1) / column_max
    end
    super(16,16,Graphics.width-32, Graphics.height-32)
    self.contents = Bitmap.new(width-32, height-32)
    @align      = align
    @commands   = commands
    @item_max   = commands.size
    @column_max = column_max
    refresh
    self.index  = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i)
    end
  end
  def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.width = (contents.width + 32) / @column_max - 32
    rect.height = 32
    rect.x = index % @column_max * (rect.width + 32)
    rect.y = index / @column_max * 32
    return rect
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index   : item number
  #     enabled : enabled flag. When false, draw semi-transparently.
  #--------------------------------------------------------------------------
  def draw_item(index, enabled = true)
    if N5::New_Skit_Icon != "" or nil
      rect        = item_rect(index)
      rect.x     += 4
      rect.width -= 8
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      unless @commands[index] == ""
        self.contents.blt(4, index * 24, RPG::Cache.icon(N5::New_Skit_Icon), Rect.new(0, 0, 24, 24))
      end
      rect2        = item_rect(index)
      rect2.x     += 28
      rect2.width -= 8
      self.contents.rect.clear_rect(rect2)
      self.contents.draw_text(rect2, @commands[index], @align)
    else
      rect = item_rect(index)
      rect.x     += 4
      rect.width -= 8
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      if $game_skit.watched.include?($game_skit.skits[index])
        self.contents.font.italic = false
        self.contents.font.bold = false
      else
        self.contents.font.italic = true
        self.contents.font.bold = true
      end
      self.contents.draw_text(rect, @commands[index], @align)
    end
  end
  def change_array_size(new_size)
    @item_max = new_size
  end
  def change_command(old_index, new_data, now_enabled = true)
    if @commands[old_index] == nil
      @commands.push new_data
    else
      @commands[old_index] = new_data
    end
    draw_item(old_index, now_enabled)
    refresh
  end
  def delete_command(delete)
    @commands[delete] = ""
    refresh
  end
end

#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs the title screen processing.
#==============================================================================
class Scene_Title
  #--------------------------------------------------------------------------
  # * Create Game Objects
  #--------------------------------------------------------------------------
  alias n5_command_new_game command_new_game
  def command_new_game
    $game_skit          = Game_Skit.new
    n5_command_new_game
  end
end

#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs the map screen processing.
#==============================================================================
class Scene_Map
  def initialize
    if FileTest.exist?("scr_N543.bmp")
      File.delete("scr_N543.bmp")
    end
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  alias n5_main main
  def main
    n5_main
    @button_sprite.dispose if $game_temp.newskit == false and @button_sprite != nil
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Loop
    loop do
      # Update map, interpreter, and player order
      # (this update order is important for when conditions are fulfilled
      # to run any event, and the player isn't provided the opportunity to
      # move in an instant)
      $game_map.update
      if @button_sprite == nil and $game_temp.newskit == true
        create_skit_button
      end
      compare_watched
      $game_system.map_interpreter.update
      $game_player.update
      # Update system (timer), screen
      $game_system.update
      $game_screen.update
      # Abort loop if player isn't place moving
      unless $game_temp.player_transferring
        break
      end
      # Run place move
      transfer_player
      # Abort loop if transition processing
      if $game_temp.transition_processing
        break
      end
    end
    # Update sprite set
    @spriteset.update
    # Update message window
    @message_window.update
    # If game over
    if $game_temp.gameover
      # Switch to game over screen
      $scene = Scene_Gameover.new
      return
    end
    # If returning to title screen
    if $game_temp.to_title
      # Change to title screen
      $scene = Scene_Title.new
      return
    end
    # If transition processing
    if $game_temp.transition_processing
      # Clear transition processing flag
      $game_temp.transition_processing = false
      # Execute transition
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    # If showing message window
    if $game_temp.message_window_showing
      return
    end
    # update button sprite
    @button_sprite.update unless $game_temp.newskit == false or @button_sprite != nil
    # If encounter list isn't empty, and encounter count is 0
    if $game_player.encounter_count == 0 and $game_map.encounter_list != []
      # If event is running or encounter is not forbidden
      unless $game_system.map_interpreter.running? or
             $game_system.encounter_disabled
        # Confirm troop
        n = rand($game_map.encounter_list.size)
        troop_id = $game_map.encounter_list[n]
        # If troop is valid
        if $data_troops[troop_id] != nil
          # Set battle calling flag
          $game_temp.battle_calling = true
          $game_temp.battle_troop_id = troop_id
          $game_temp.battle_can_escape = true
          $game_temp.battle_can_lose = false
          $game_temp.battle_proc = nil
        end
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # If event is running, or menu is not forbidden
      unless $game_system.map_interpreter.running? or
             $game_system.menu_disabled
        # Set menu calling flag or beep flag
        $game_temp.menu_calling = true
        $game_temp.menu_beep = true
      end
    end
    # If debug mode is ON and F9 key was pressed
    if $DEBUG and Input.press?(Input::F9)
      # Set debug calling flag
      $game_temp.debug_calling = true
    end
    # If player is not moving
    unless $game_player.moving?
      update_call_skit
      # Run calling of each screen
      if $game_temp.battle_calling
        call_battle
      elsif $game_temp.shop_calling
        call_shop
      elsif $game_temp.name_calling
        call_name
      elsif $game_temp.menu_calling
        call_menu
      elsif $game_temp.save_calling
        call_save
      elsif $game_temp.debug_calling
        call_debug
      end
    end
  end
  #--------------------------------------------------------------------------
  # * N5 Update Call Skit
  #--------------------------------------------------------------------------
  def update_call_skit
    return unless $game_temp.newskit == true
    if Input.trigger?(N5::Skit_Activate)
      $game_temp.skit_beep = true                     # Set SE play flag
      call_skit
    end
  end
  alias n543_call_menu call_menu
  def call_menu
      $game_temp.skit_bg = Sprite.new
      Win32API.new("screenshot", "Screenshot", "llllpll", "").call(0, 0, 640, 480, "scr_N543.bmp",
      Win32API.new("user32", "FindWindow", "pp", "l").call("RGSS Player", $1), 0)
      $game_temp.skit_bg.bitmap = Bitmap.new("scr_N543.bmp")
    n543_call_menu
  end
  #--------------------------------------------------------------------------
  # * N5 Compare Watched Skits
  #--------------------------------------------------------------------------
  def compare_watched
    if $game_skit.skits.size > 0
      for i in 0..$game_skit.skits.size - 1
        if $game_skit.watched.include?($game_skit.skits[i])
          next
        else
          @skit = $game_skit.skits[i]
          $game_temp.newskit = true
          create_skit_button
          $game_screen.update
          break
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * N5 Call Skit
  #--------------------------------------------------------------------------
  def call_skit
      $game_temp.skit_bg = Sprite.new
      Win32API.new("screenshot", "Screenshot", "llllpll", "").call(0, 0, 640, 480, "scr_N543.bmp",
      Win32API.new("user32", "FindWindow", "pp", "l").call("RGSS Player", $1), 0)
      $game_temp.skit_bg.bitmap = Bitmap.new("scr_N543.bmp")
    if $game_temp.skit_beep
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      $game_temp.skit_beep = false
    end
    @spriteset.update
    Graphics.update
    $game_player.straighten
    $scene = Scene_Skit.new(@skit)
  end
  #--------------------------------------------------------------------------
  # * N5 New Skit
  #--------------------------------------------------------------------------
  def new_skit(skit)
    @skit = skit
    $game_skit.names.push(@skit[0]) unless $game_skit.skits.include?(@skit)
    if @skit[2] == true and $scene.is_a?(Scene_Map) and !$game_skit.skits.include?(@skit)
      @spriteset.update
      Graphics.update
      $game_player.straighten
      $game_skit.skits.push(@skit)
      $game_temp.skit_bg = Sprite.new
      Win32API.new("screenshot", "Screenshot", "llllpll", "").call(0, 0, 640, 480, "scr_N543.bmp",
      Win32API.new("user32", "FindWindow", "pp", "l").call("RGSS Player", $1), 0)
      $game_temp.skit_bg.bitmap = Bitmap.new("scr_N543.bmp")
      $scene = Scene_Skit.new(@skit)
    else
      $game_skit.skits.push(@skit) unless $game_skit.skits.include?(@skit)
    end
  end
  #--------------------------------------------------------------------------
  # * N5 Create Skit Button
  #--------------------------------------------------------------------------
  def create_skit_button
    return if @button_sprite != nil or $game_temp.newskit == false
    @button_sprite = Sprite.new(@spriteset.viewport1)
    @button_sprite.bitmap = RPG::Cache.icon(N5::Skit_Button)
    @button_sprite.x = Graphics.width - @button_sprite.src_rect.width
    @button_sprite.y = Graphics.height - @button_sprite.src_rect.height
    @button_sprite.z = 900
  end
end

#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs the menu screen processing.
#==============================================================================
class Scene_Menu
  def main
    if FileTest.exist?("scr_N543.bmp")
      File.delete("scr_N543.bmp")
    end
    # Make command window
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = N5::Skits_Term  # N5
    s6 = "Save"
    s7 = "End Game"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @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)
      @command_window.disable_item(3)
    end
    # If no skits or a invalid number of skits exists
    if $game_skit.skits.size <= 0
      # Disable skits
      @command_window.disable_item(4)
    end
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(5)
    end

    # Make play time window
    @playtime_window = Window_PlayTime.new(0, 252, 160, 96)
    # Make steps window
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = 320
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 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
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose
  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)
        # 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)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4  # skit
        # If skits are unavailable
        if $game_skit.skits.size <= 0 and @command_window.index == 4 #N5
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
        return
        end
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Skit.new(nil, true)
      when 5  # 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 6  # 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

#==============================================================================
# ** Scene_Skit
#------------------------------------------------------------------------------
#  This class performs the basic Skit Processing.
#==============================================================================
class Scene_Skit
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(skit = nil, from_menu = false)
    @skit = skit unless skit == nil
    @from_menu = from_menu
    if !@from_menu
      @run_skit = true
    end
    @face_array = []
    @name_array = []
    @moving_face = []
    @number = -1
    @dest_x = []
    @dest_y = []
    @x = []
    @y = []
    @duration = []
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    @skitback_sprite = Sprite.new
    @skitback_sprite.bitmap = $game_temp.skit_bg.bitmap
    @skitback_sprite.color.set(16, 16, 16, 128)
    @message_window = Window_Message.new
    case @run_skit
    when true
      create_skit_interface
      if @skit[3]
        $game_temp.last_bgm = $game_system.playing_bgm
        $game_temp.last_bgs = $game_system.playing_bgs
        Audio.bgm_stop
        Audio.bgm_stop
      end
      run_skit
    when false
      create_skit_window
    end
    # 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
    # Terminatation
    terminate
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    @skitback_sprite.dispose
    @message_window.dispose
    if @run_skit
      @skit_interface.dispose  
    else
      if @skit_window != nil
        @skit_window.dispose
      end
    end
    for i in 0...@face_array.size
      @face_array[i].dispose
    end
    if @face_array != []
      @face_array.clear
      @name_array.clear
      @moving_face.clear
      @dest_x.clear
      @dest_y.clear
      @duration.clear
    end
    Audio.bgm_fade(20)
    Audio.bgs_fade(20)
    unless $game_temp.last_bgm == nil
      $game_temp.last_bgm.play
      $game_temp.last_bgs.play
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    @message_window.update
    if @run_skit
      @skit_interface.update
    else
      unless @skit_window != nil
        create_skit_window
      else
        @skit_window.update
        update_skit_selection
      end
    end
    if @moving_face.nitems == 0 and $game_system.map_interpreter.pause == false
      $game_system.map_interpreter.update
    end
    if !$game_system.map_interpreter.running? and @run_skit
      $game_temp.newskit = false
      $scene = Scene_Skit.new(nil, true)
    end
    if @moving_face.nitems > 0
      update_move_face
    end
  end
  #--------------------------------------------------------------------------
  # * Create Skit Window
  #--------------------------------------------------------------------------
  def create_skit_window
    @skit_window = Window_SkitCommand.new($game_skit.names)
  end
  #--------------------------------------------------------------------------
  # * Create Skit Interface
  #--------------------------------------------------------------------------
  def create_skit_interface
    @viewport1 = Viewport.new(0, 0, Graphics.width, Graphics.height)
    @skit_interface = Sprite.new(@viewport1)
    @skit_interface.bitmap = RPG::Cache.icon(N5::Skit_BG)
    @skit_interface.x = 0
    @skit_interface.y = 0
    @skit_interface.z = 100
  end
  #--------------------------------------------------------------------------
  # * Run Skit
  #--------------------------------------------------------------------------
  def run_skit
    if @skit[3]
      unless $game_system.skit_bgm == false
        Audio.bgm_play("Audio/BGM/" + $game_system.skit_bgm, 100, 100)
      end
    end
    $game_system.map_interpreter.setup($data_common_events[@skit[1]].list, 0)
    $game_skit.watched.push(@skit)
  end
  #--------------------------------------------------------------------------
  # * Add New Face
  #--------------------------------------------------------------------------
  def new_face(face_name, expr = 0, pos = 0, mirror = false, num = @face_array.size)
    if space_empty?(pos)
      @face_array[num] = Sprite.new(@viewport1)
      @face_array[num].bitmap = Bitmap.new(96,120)
      bitmap = RPG::Cache.icon(face_name)
      face_name =~ /((\d)+)x((\d)+)$/
      face_width, face_height = $1.to_i, $3.to_i
      face_width = 96 if face_width == 0
      face_height = 120 if face_height == 0
      rect = Rect.new(0, 0, 0, 0)
      rect.x = expr % 4 * face_width + (0) / 2
      rect.y = expr / 4 * face_height + (0) / 2
      rect.width = face_width
      rect.height = face_height
      @face_array[num].bitmap.blt(0, 0, bitmap, rect)
      @face_array[num].x = pos.is_a?(Array) ? pos[0] : N5::SKIT_POS[pos][0]
      @face_array[num].y = pos.is_a?(Array) ? pos[1] : N5::SKIT_POS[pos][1]
      @face_array[num].z = 200
      @face_array[num].mirror = mirror
      @name_array[num] = face_name
      @dest_x[num] = nil
      @dest_y[num] = nil
      bitmap.dispose
    end
  end
  #--------------------------------------------------------------------------
  # * Change Face
  #--------------------------------------------------------------------------
  def change_face(o, new_o, new_expr = nil, new_face = nil, mirror = false)
    verify_new(new_o)
    @new_orig = new_o.is_a?(Array) ? new_o : N5::SKIT_POS[new_o]
    for i in 0..@face_array.size - 1
      if (@face_array[i].x == N5::SKIT_POS[o][0].to_f) and (@face_array[i].y == N5::SKIT_POS[o][1].to_f)
        @number = i
        break
      end
    end
    if new_expr != nil
      if new_face != nil and @name_array[@number] != new_face
        bitmap = RPG::Cache.icon(new_face)
        @name_array[@number] = new_face
      else
        bitmap = RPG::Cache.icon(@name_array[@number])
      end
      @name_array[@number] =~ /((\d)+)x((\d)+)$/
      face_width, face_height = $1.to_i, $3.to_i
      face_width = 96 if face_width == 0
      face_height = 120 if face_height == 0
      rect = Rect.new(0, 0, 0, 0)
      rect.x = new_expr % 4 * face_width + (0) / 2
      rect.y = new_expr / 4 * face_height + (0) / 2
      rect.width = face_width
      rect.height = face_height
      @face_array[@number].bitmap.blt(0, 0, bitmap, rect)
      bitmap.dispose
    end
    @face_array[@number].mirror = mirror
    if N5::SKIT_POS[o] != @new_orig and (new_o.is_a?(Array) ? true : space_empty?(new_o))
      @dest_x[@number] = @new_orig[0].to_f
      @dest_y[@number] = @new_orig[1].to_f
      @duration[@number] = N5::SKIT_POS.has_value?(@new_orig) ? 45 : 50
      @moving_face[@number] = true
      $game_system.map_interpreter.pause = true
    end
  end
  #--------------------------------------------------------------------------
  # * Dispose Face
  #--------------------------------------------------------------------------
  def dispose_face(o)
    for i in 0..@face_array.size - 1
      if @face_array[i] != nil and (@face_array[i].x == N5::SKIT_POS[o][0].to_f) and (@face_array[i].y == N5::SKIT_POS[o][1].to_f)
        @face_array[i].dispose
        @face_array.delete_at(i)
        @name_array.delete_at(i)
        @moving_face.delete_at(i)
        @dest_x.delete_at(i)
        @dest_y.delete_at(i)
        @duration.delete_at(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Face
  #--------------------------------------------------------------------------
  def update_move_face
    for i in 0..@face_array.size - 1
      unless @duration[i] == nil
        if @duration[i] >= 1
          d = @duration[i]
          @face_array[i].x = (@face_array[i].x * (d - 1) + @dest_x[i]) / d
          @face_array[i].y = (@face_array[i].y * (d - 1) + @dest_y[i]) / d
          @duration[i] -= 1
        end
        if (@face_array[i].x == @dest_x[i]) and (@face_array[i].y == @dest_y[i])
          @dest_x[i] = nil
          @dest_y[i] = nil
        end
        if @dest_x[i] == nil and @dest_y[i] == nil
          @moving_face[i] = nil
        end
        if @dest_x.nitems == 0 and @dest_y.nitems == 0
          $game_system.map_interpreter.pause = false
          break
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Verify Position
  #--------------------------------------------------------------------------
  def verify_new(o)
    case o
    when Array
      return
    when 0..18
      return
    else
      raise IndexError,"Not a valid index!\nGiven #{o} required 0-18 or array."
    end
  end
  #--------------------------------------------------------------------------
  # * Space Empty?
  #--------------------------------------------------------------------------
  def space_empty?(pos)
    for i in 0..@face_array.size - 1
      if (@face_array[i].x == N5::SKIT_POS[pos][0].to_f) and (@face_array[i].y == N5::SKIT_POS[pos][1].to_f)
        if @moving_face[i]
          return true
        else
          print("IndexError\nPosition index #{pos} is currently occupied!")
        end
      else
        return true
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Skit Selection
  #--------------------------------------------------------------------------
  def update_skit_selection
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(4)
    elsif Input.trigger?(Input::C)
      $scene = Scene_Skit.new($game_skit.skits[@skit_window.index], false)
    end
  end
end

#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  This class performs the save and load screen processing.
#==============================================================================

class Scene_Save
  #--------------------------------------------------------------------------
  # * Write Save Data
  #     file : write file object (opened)
  #--------------------------------------------------------------------------
  alias n543_wsd write_save_data
  def write_save_data(file)
    n543_wsd(file)
    Marshal.dump($game_skit, file)
  end
end

class Scene_Load
  #--------------------------------------------------------------------------
  # * Read Save Data
  #     file : file object for reading (opened)
  #--------------------------------------------------------------------------
  alias n543_rsd read_save_data
  def read_save_data(file)
    n543_rsd(file)
    $game_skit = Marshal.load(file)
  end
end


And you need to format your picture to have the dimensions at the end of the face's name, so for example:
img

I've appended 10x20 to the end of the filename, telling the script that each face is 10 pixels across and 20 pixels down for that graphic.


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 22nd May 2013 - 01:08 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker