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

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

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 88
Hey everyone, I have a CMS script, its great; but I also use the Fog of War Script. The problem is that when opening the menu in a map with FOW, the FOW covers the menu. I hope someone can help me with that, here are the scripts.

Fog of War

Code: [Select]
#==============================================================================
# ** Fog of War
#------------------------------------------------------------------------------
# Version 2.0, 2005-11-21
# by Wachunga
#==============================================================================
=begin
 0.8 - original release
 0.85
   - added colour parameter to map names
   - fixed bug where map grids overlapped
 0.9
   - switched over to a tilemap (from a sprite)
   - now more compatible with minimap scripts (but they'll have to take
   extra tilemap into account)
 1.0
   - switched over to an autotile instead of using a custom tileset
     * edges looks nicer, but gradual fading had to be removed
     * colour parameter no longer possible (set by autotile)
   - move event (including jumping and speed changes) bug fixed
   - teleportation bug fixed
   - some optimization
   - made compatible with Cogwheel's Pixel Movement script
     (see http://www.rmxp.net/forums/index.php?showtopic=24716 for details)
 1.01
   - fixed bug when teleporting from map without fow to a map with fow
 2.0
   - now two independent types of fog of war:
      * static, which never returns (i.e. typical RTS "terrain" fog)
      * dynamic, which returns once out of visual range and can optionally
        hide map events (i.e. typical RTS "unit" fog)
   - now using a compact version of Near's Dynamic Maps script
   - fog of war is now above weather and normal fog
   - added support for much larger visual ranges (0 - 9)
   - added support for option to set up fog of war from a call script event
     command
   - optimization

 A map specified as having "fog of war" (fow) has tiles that are (fully or
 partially) obscured until the player gets within visual range. The amount of
 fow to disappear as the player moves depends on the visual range specified.
 Gamers with experience playing Real Time Strategy games like Warcraft, Age of
 Empires, etc. should be quite familiar with the concept.

 This script supports two kinds of fog of war: static and dynamic.

 Static fow is the kind that typically hides terrain in RTS games. It covers
 the entire map until the player explores the area, discovering the underlying
 terrain. Once static fow disappears from an area of the map, it stays gone
 indefinitely (even if loading a saved game, leaving the map and returning
 later, going to the menu, etc).

 Dynamic fow is identical to the static kind except that it doesn't stay gone
 forever: as soon as the player leaves visual range of an explored tile,
 dynamic fow covers it again. This kind of fow is typically used to hide enemy
 units in RTS games.

 SETUP:
 
 There's no need to add the autotile via the database. Just place the
 file in the autotile folder, import it, and change the FOW_AT_NAME constant
 to the appropriate filename. To change the colour of the fog of war you must
 create a new autotile. (However, opacity is customizable by constants below.)
 
 To indicate a map is to have either (or both) of these kinds of fog of war,
 include <fow> in its name (via "Map properties"). To enable both static and
 dynamic fow, you can either add nothing more (since it's the default), or
 add <s><d> (or <d><s>). To enable one or the other, just add the appropriate
 one (e.g. <s> for static, <d> for dynamic). You may also optionally specify a
 visual range between 0 and 9 in the map name (e.g. <5>), noting that 3 is
 the default. Here are some example map names:
 "your-map-name <fow><2>" (defaults to static&dynamic on; range specified as 2)
 "your-map-name <fow><s>" (only static fow is on; range defaults to 3)
 "your-map-name <fow><d><8>" (only dynamic fow is on; range specified as 8)
 
 Alternatively, fog of war can be setup via a call script event command using
 the fog_of_war global method. Detailed instructions are just before
 the method itself.

 Finally, an edited version of Near Fantastica's Dynamic Maps script needs
 to be below this one. You may find it at the following URL:
 http://www.rmxp.net/forums/index.php?showtopic=24716
 
 The ranges work as follows:
 range = 0 reveals just the square on which the player stands

 range = 1 is the same as range 0 plus four adjacent tiles
 i.e.   @
       @P@
        @

 range = 2 is the same as range 1 plus eight additional tiles
  i.e.  @
       @@@
      @@P@@
       @@@
        @

 range = 3 (default) is the same as range 2 plus twelve additional tiles
  i.e.  @
       @@@
      @@@@@
     @@@P@@@
      @@@@@
       @@@
        @

 etc.

 Note: I've taken great pains to optimize this script as much as possible
 (which unfortunately reduces the readability of the code). There shouldn't be
 much visible effect on frame rate.

=end

#------------------------------------------------------------------------------
 # filename of the fog of war autotile (used for both):
 FOW_AT_NAME = 'fow_default'
 # the opacity of static (non-returning) and dynamic (returning) fog of war
 # (value between 0 and 255)
 # note that static fow appears on top of its dynamic counterpart (if both on)
 FOW_STATIC_OPACITY = 255
 FOW_DYNAMIC_OPACITY = 100
 # whether or not dynamic fow hides map events
 FOW_DYNAMIC_HIDES_EVENTS = true
 # default range of fog of war (if not specified in map name)
 FOW_RANGE_DEFAULT = 3
#------------------------------------------------------------------------------
 # internal constants - no need to edit
 FOW = 0b00
 REVEALED = 0b01
 # tiles with no surrounding fog are flagged "SKIP" for efficiency
 SKIP = 0b10
#------------------------------------------------------------------------------

=begin
 Setup fog of war.
 
 This method is an alternative to using the default map name method, and
 is designed to be called from a call script event command. This allows
 fog of war to be dynamically enabled or disabled during gameplay.
 
 Parameters:
 static - if true, static fow enabled
 dynamic - if true, dynamic fow enabled
 (if both of the above are false, fow is totally disabled)
 range (optional) - the visual range of the player
                    * default is FOW_RANGE_DEFAULT
 reset (optional) - if true, fow for this map resets entirely (i.e. previously
                    explored areas are covered again)
                    * default is false
                    
 Sample calls:
 fog_of_war(true,true,5) - enable both static and dynamic fow with range of 5
 fog_of_war(false,false,3,true) - disable and reset both types of fow
=end
def fog_of_war(static, dynamic, range = FOW_RANGE_DEFAULT, reset = false)
  if static == nil or dynamic == nil
    print 'Two true/false parameters are required in call to fog_of_war.'
    exit
  elsif range < 0 or range > 9
    print 'Invalid range in call to fog_of_war (only 0-9 is valid).'
    exit
  end
  $game_map.fow_static = static
  $game_map.fow_dynamic = dynamic
  $game_map.fow_range = range
  if reset
    $game_map.fow_grid = nil
  end
  if not $game_map.fow_static and not $game_map.fow_dynamic
    $game_map.fow = false
    $scene.spriteset.fow_tilemap.dispose
    # set all events back to visible
    for i in $game_map.events.keys
      $game_map.events[i].transparent = false
    end
  else
    # static or dynamic fow (or both) are on
    $game_map.fow = true
    if $game_map.fow_grid == nil # only if not already defined
      $game_map.fow_grid = Table.new($game_map.width, $game_map.height, 2)
      for i in 0...$game_map.fow_grid.xsize
        for j in 0...$game_map.fow_grid.ysize
          $game_map.fow_grid[i,j,1] = $game_map.fow_grid[i,j,0] = FOW
        end
      end
    end
    if $game_map.fow_dynamic
      $game_map.fow_revealed = $game_map.fow_last_revealed = []
    end
    $scene.spriteset.initialize_fow
  end    
end

class Game_Map
 attr_accessor :fow
 attr_accessor :fow_static
 attr_accessor :fow_dynamic
 attr_accessor :fow_grid
 attr_accessor :fow_range
 attr_accessor :fow_revealed
 attr_accessor :fow_last_revealed

 alias wachunga_fow_gm_setup setup
 def setup(map_id)
   wachunga_fow_gm_setup(map_id)
   @fow = false
   @fow_dynamic = false
   @fow_static = false
   @fow_grid = nil
   @fow_range = nil
   # get any tags from the map name
   tags = $game_map.map_name.delete(' ').scan(/<[A-Za-z0-9_.,]+>/)
   if not tags.empty? and tags[0].upcase == ('<FOW>')
     tags.shift # remove FOW tag
     @fow = true
     if @fow_grid == nil # only if not already defined
       @fow_grid = Table.new(@map.width, @map.height, 2)
       for i in 0...@fow_grid.xsize
         for j in 0...@fow_grid.ysize
           @fow_grid[i,j,1] = @fow_grid[i,j,0] = FOW
         end
       end
     end
     # check if types of fog of war specified
     while not tags.empty?
       case tags[0].upcase
       when '<S>'
         @fow_static = true
       when '<D>'
         @fow_dynamic = true
       else
         x = tags[0].delete('<>').to_i
         @fow_range = x if x >= 0 and x <= 9
       end
       tags.shift
     end
     # if <FOW> tag found but neither static nor dynamic specified, assume both
     if @fow and not @fow_static and not @fow_dynamic
       @fow_static = true
       @fow_dynamic = true
     end
     # if no range specified, set to default
     if @fow_range == nil
       @fow_range = FOW_RANGE_DEFAULT
     end
     @fow_revealed = @fow_last_revealed = [] if @fow_dynamic
   end
 end

 def map_name
   return load_data('Data/MapInfos.rxdata')[@map_id].name
 end

=begin
 Updates the map's grid which keeps track of one or both of the following
 (depending on what is enabled for the current map):
 1) which tiles have been "discovered" (i.e. no static fog of war) based on
    where the player has already explored
 2) which tiles are currently not covered by dynamic fog of war (i.e. not in
    visual range)
=end
 def update_fow_grid
   px = $game_player.x
   py = $game_player.y
   x = px - @fow_range
   start_y = py
   y = start_y
   count = 1
   mod = 1
   # loop through all tiles in visible range
   until x == (px + @fow_range+1)
     i = count
     while i > 0
       if valid?(x,y)
         if @fow_static
           @fow_grid[x,y,1] |= REVEALED
         end
         if @fow_dynamic
           @fow_grid[x,y,0] = REVEALED if @fow_grid[x,y,0] == FOW
           @fow_revealed.push([x,y])
         end
       end
       y -= 1
       i -= 1
     end
     if x == px
       mod = -1
     end
     x += 1
     start_y += 1*mod
     y = start_y
     count += 2*mod
   end
   if @fow_dynamic
     if @fow_last_revealed != []
       # make dynamic fog return once out of visual range
       for t in @fow_last_revealed - @fow_revealed
         @fow_grid[t[0],t[1],0] = FOW
       end
     end
     @fow_last_revealed = @fow_revealed
     @fow_revealed = []
   end
 end  
 
end

#------------------------------------------------------------------------------

class Spriteset_Map

 attr_reader :fow_tilemap
  
 alias wachunga_fow_ssm_initialize initialize
 def initialize
   initialize_fow if $game_map.fow
   wachunga_fow_ssm_initialize
 end

=begin
 Initializes fog of war.
=end
 def initialize_fow
   @fow_tilemap = Tilemap.new    
   @fow_tilemap.map_data = Table.new($game_map.width, $game_map.height, 3)
   @fow_tilemap.priorities = Table.new(144)
   @fow_autotiles = Hash.new(0)
   j = 48 # starting autotile index
   for i in Autotile_Keys
     @fow_autotiles[i] = j
     j += 1
   end
   # add duplicates
   for i in Duplicate_Keys.keys
     @fow_autotiles[i] = @fow_autotiles[Duplicate_Keys[i]]
   end    
   if $game_map.fow_static
     for m in 0...$game_map.fow_grid.xsize
       for n in 0...$game_map.fow_grid.ysize
         # reset SKIP flag
         $game_map.fow_grid[m,n,1] &= ~SKIP
       end
     end
     at = Bitmap.new(96,128)
     at.blt(0,0,RPG::Cache.autotile(FOW_AT_NAME),\
            Rect.new(0,0,96,128),FOW_STATIC_OPACITY)      
     @fow_tilemap.autotiles[0] = at
     # set everything to fog
     for x in 0...$game_map.width
       for y in 0...$game_map.height
         @fow_tilemap.map_data[x,y,2] = 48 # fog
       end
     end
     # set to highest priority
     for i in 48...96
       @fow_tilemap.priorities[i] = 5
     end
   end
   if $game_map.fow_dynamic
     bm = Bitmap.new(96,128)
     bm.blt(0,0,RPG::Cache.autotile(FOW_AT_NAME),\
            Rect.new(0,0,96,128),FOW_DYNAMIC_OPACITY)
     @fow_tilemap.autotiles[1] = bm
     # unlike tilemap for static, set everything to clear
     for x in 0...$game_map.width
       for y in 0...$game_map.height
         @fow_tilemap.map_data[x,y,1] = 0
       end
     end
     # set to highest priority
     for i in 96...144
       @fow_tilemap.priorities[i] = 5
     end
   end
   $game_map.update_fow_grid
   update_fow_tilemap
   update_event_transparency if $game_map.fow_dynamic
 end
 
 
=begin
 Updates the (static and/or dynamic) fog of war tilemap based on the map's
 underlying grid.
=end
 def update_fow_tilemap
   if $game_map.fow_static
     checked = Table.new($game_map.width,$game_map.height)
     for j in 0...$game_map.width
       for k in 0...$game_map.height
         checked[j,k] = 0
       end
     end
   end
   dx = ($game_map.display_x/128).round
   dy = ($game_map.display_y/128).round
   # to increase performance, only process fow currently on the screen
   for x in dx-1 .. dx+21
     for y in dy-1 .. dy+16
       # check boundaries
       if not $game_map.valid?(x,y) then next end
       if $game_map.fow_dynamic
         if $game_map.fow_grid[x,y,0] == REVEALED
           @fow_tilemap.map_data[x,y,1] = 0 if @fow_tilemap.map_data[x,y,1]!=0
         else
           @fow_tilemap.map_data[x,y,1]=96 if @fow_tilemap.map_data[x,y,1]!=96
         end        
       end          
       if $game_map.fow_static
         if $game_map.fow_grid[x,y,1] == REVEALED # (but not SKIP)
           others = false;
           @fow_tilemap.map_data[x,y,2] = 0 if @fow_tilemap.map_data[x,y,2]!=0
           for i in x-1 .. x+1
             for j in y-1 .. y+1
               # check new boundaries
               if not $game_map.valid?(i,j) then next end
               if $game_map.fow_grid[i,j,1] == FOW
                 others = true # can't flag as SKIP because there's nearby fog
                 if checked[i,j] == 0
                   checked[i,j] = 1
                   # only fill if not already revealed
                   if @fow_tilemap.map_data[i,j,2] != 0
                     adj = check_adjacent(i,j,1,$game_map.fow_grid,REVEALED)
                     if adj != nil
                       @fow_tilemap.map_data[i,j,2] =
                         eval '@fow_autotiles[adj.to_i]'
                     end
                   end
                 end
               end
             end
           end
           if not others
             # no adjacent static fog found, so flag tile to avoid reprocessing
             $game_map.fow_grid[x,y,1] |= SKIP
           end
         end    
       end # fow_static
     end # for
   end # for
   if $game_map.fow_dynamic
     if $game_map.fow_static
       for x in dx-1 .. dx+21
         for y in dy-1 .. dy+16
           # erase dynamic fow if static fow is above it anyway
           if @fow_tilemap.map_data[x,y,2] == 48
             @fow_tilemap.map_data[x,y,1]=0 if @fow_tilemap.map_data[x,y,1]!=0
           end
         end
       end
     end
     # calculate autotiles for dynamic fow (around player)
     px = $game_player.x
     py = $game_player.y
     tiles = []
     x = px - ($game_map.fow_range+1)
     y_top = py
     mod_top = -1
     y_bot = py
     mod_bot = 1
     until x == px + ($game_map.fow_range+2)
       tiles.push([x,y_top]) if $game_map.valid?(x,y_top)
       tiles.push([x,y_bot]) if $game_map.valid?(x,y_bot)
       if x == px
         mod_top = 1
         mod_bot = -1
         x+=1
         next
       end
       y_top+=1*mod_top
       y_bot+=1*mod_bot
       tiles.push([x,y_top]) if $game_map.valid?(x,y_top)
       tiles.push([x,y_bot]) if $game_map.valid?(x,y_bot)
       x+=1      
     end
     tiles.uniq.each do |t|
       adj = check_adjacent(t[0],t[1],0,$game_map.fow_grid,REVEALED)
       if adj != nil
         @fow_tilemap.map_data[t[0],t[1],1] =
           (eval '@fow_autotiles[adj.to_i]') + 48
       end
     end
   end
 end

=begin
 Update event transparency based on dynamic fog.
 
 Note that if a specific character is passed as a parameter then only
 its transparency is updated; otherwise, all events are processed.
=end
 def update_event_transparency(pChar = nil)
   return if not FOW_DYNAMIC_HIDES_EVENTS
   if pChar == nil
     # check them all
     for i in $game_map.events.keys
       event = $game_map.events[i]
       if $game_map.fow_grid[event.x,event.y,0] == FOW
         event.transparent = true
       else
         event.transparent = false
       end
     end
   else
     # just check the one
     pChar.transparent=($game_map.fow_grid[pChar.x,pChar.y,0]==FOW) ?true:false
   end
 end
 
 # create a list of tiles adjacent to a specific tile that don't match a flag
 # (used for calculating tiles within an autotile)
 def check_adjacent(i,j,k,grid,flag)
   return if not $game_map.valid?(i,j) or grid == nil or flag == nil
   adj = ''
   if (i == 0)
     adj << '147'
   else
     if (j == 0) then adj << '1'
     else
       if (grid[i-1,j-1,k] != flag) then adj << '1' end
     end
     if (grid[i-1,j,k] != flag) then adj << '4' end
     if (j == $game_map.height-1) then adj << '7'
     else
       if (grid[i-1,j+1,k] != flag) then adj << '7' end
     end
   end
   if (i == $game_map.width-1)
     adj << '369'
   else
     if (j == 0) then adj << '3'
     else
       if (grid[i+1,j-1,k] != flag) then adj << '3' end
     end
     if (grid[i+1,j,k] != flag) then adj << '6' end
     if (j == $game_map.height-1) then adj << '9'
     else
       if (grid[i+1,j+1,k] != flag) then adj << '9' end
     end
   end
   if (j == 0)
     adj << '2'
   else
     if (grid[i,j-1,k] != flag) then adj << '2' end
   end
   if (j == $game_map.height-1)
     adj << '8'
   else
     if (grid[i,j+1,k] != flag) then adj << '8' end
   end
   # if no adjacent fog, set it as 0
   if (adj == '') then adj = '0' end
   # convert to an array, sort, and then back to a string
   return adj.split(//).sort.join
 end

 alias wachunga_fow_ssm_dispose dispose
 def dispose
   @fow_tilemap.dispose if @fow_tilemap != nil
   wachunga_fow_ssm_dispose
 end

 alias wachunga_fow_ssm_update update
 def update
   if $game_map.fow
     @fow_tilemap.ox = $game_map.display_x / 4
     @fow_tilemap.oy = $game_map.display_y / 4
     @fow_tilemap.update
   end
   wachunga_fow_ssm_update
 end
end

#------------------------------------------------------------------------------

class Game_Character
  alias wachunga_fow_gch_initialize initialize
  def initialize
    wachunga_fow_gch_initialize
    @last_x = @x
    @last_y = @y
  end

  alias wachunga_fow_gch_update_move update_move
  def update_move
    wachunga_fow_gch_update_move
    if $game_map.fow
      if $game_map.fow_dynamic and (@x != @last_x or @y != @last_y)\
        and self != $game_player
        # check if character entered/left player's visual range
        $scene.spriteset.update_event_transparency(self)
      end
    end
    @last_x = @x
    @last_y = @y
  end
end

#------------------------------------------------------------------------------

class Game_Player

 def update_jump
   super
   # only update when about to land, not revealing anything jumped over
   if $game_map.fow and @jump_count == 0
     $game_map.update_fow_grid
     $scene.spriteset.update_event_transparency if $game_map.fow_dynamic
     $scene.spriteset.update_fow_tilemap
   end
 end

 def update_move
   if $game_map.fow and (@x != @last_x or @y != @last_y)
     unless jumping?
       $game_map.update_fow_grid
       $scene.spriteset.update_event_transparency if $game_map.fow_dynamic
       $scene.spriteset.update_fow_tilemap
     end
   end
   super
 end

end

#------------------------------------------------------------------------------

class Scene_Map
 attr_reader :spriteset
end

=begin
       Autotile in column 2:

row\col| 1  2  3  4  5  6  7  8
    ---------------------------
    1 | 48 49 50 51 52 53 54 55
    2 | 56 57 58 59 60 61 62 63
    3 | 64 65 66 67 68 69 70 71
    4 | 72 73 74 75 76 77 78 79
    5 | 80 81 82 83 84 85 86 87
    6 | 88 89 90 91 92 93 94 95

    The function to return the index of a single tile within an autotile
    (given by at_index) is (at_index-1)*48 + col-1 + (row-1)*8
    (where row, col, and at_index are again NOT zero-indexed)
=end

=begin
   The following array lists systematic keys which are based on adjacent
   walls (where 'W' is the wall itself):
   1 2 3
   4 W 6
   7 8 9
   e.g. 268 is the key that will be used to refer to the autotile
   which has adjacent walls north, east, and south.  For the Castle Prison
   tileset (autotile #1), this is 67.

   (It's a bit unwieldy, but it works.)
=end

 Autotile_Keys = [
 12346789,
 2346789,
 1246789,
 246789,
 1234678,
 234678,
 124678,
 24678,

 1234689,
 234689,
 124689,
 24689,
 123468,
 23468,
 12468,
 2468,

 23689,
 2689,
 2368,
 268,
 46789,
 4678,
 4689,
 468,

 12478,
 1248,
 2478,
 248,
 12346,
 2346,
 1246,
 246,

 28,
 46,
 689,
 68,
 478,
 48,
 124,
 24,

 236,
 26,
 8,
 6,
 2,
 4,
 0 ]

 # many autotiles handle multiple situations
 # this hash keeps track of which keys are identical
 # to ones already defined above
 Duplicate_Keys = {
 123689 => 23689,
 236789 => 23689,
 1236789 => 23689,
 34689 => 4689,
 14689 => 4689,
 134689 => 4689,
 14678 => 4678,
 34678 => 4678,
 134678 => 4678,
 146789 => 46789,
 346789 => 46789,
 1346789 => 46789,
 23467 => 2346,
 23469 => 2346,
 234679 => 2346,
 123467 => 12346,
 123469 => 12346,
 1234679 => 12346,
 12467 => 1246,
 12469 => 1246,
 124679 => 1246,
 124789 => 12478,
 123478 => 12478,
 1234789 => 12478,
 146 => 46,
 346 => 46,
 467 => 46,
 469 => 46,
 1346 => 46,
 1467 => 46,
 1469 => 46,
 3467 => 46,
 3469 => 46,
 4679 => 46,
 13467 => 46,
 13469 => 46,
 14679 => 46,
 34679 => 46,
 134679 => 46,
 128 => 28,
 238 => 28,
 278 => 28,
 289 => 28,
 1238 => 28,
 1278 => 28,
 1289 => 28,
 2378 => 28,
 2389 => 28,
 2789 => 28,
 12378 => 28,
 12389 => 28,
 12789 => 28,
 23789 => 28,
 123789 => 28,

 1247 => 124,
 2369 => 236,
 147 => 4,
 247 => 24,
 14 => 4,
 47 => 4,
 1478 => 478,
 3478 => 478,
 4789 => 478,
 134789 => 478,
 14789 => 478,
 13478 => 478,
 34789 => 478,
 1234 => 124,
 1247 => 124,
 1249 => 124,
 12347 => 124,
 12349 => 124,
 12479 => 124,
 123479 => 124,
 1236 => 236,
 2367 => 236,
 2369 => 236,
 12367 => 236,
 12369 => 236,
 23679 => 236,
 123679 => 236,
 12368 => 2368,
 23678 => 2368,
 123678 => 2368,
 12348 => 1248,
 12489 => 1248,
 123489 => 1248,
 1689 => 689,
 3689 => 689,
 6789 => 689,
 13689 => 689,
 16789 => 689,
 36789 => 689,
 136789 => 689,
 12689 => 2689,
 26789 => 2689,
 126789 => 2689,
 23478 => 2478,
 24789 => 2478,
 234789 => 2478,

 12 => 2,
 23 => 2,
 27 => 2,
 29 => 2,
 123 => 2,
 127 => 2,
 129 => 2,
 237 => 2,
 239 => 2,
 279 => 2,
 1237 => 2,
 1239 => 2,
 1279 => 2,
 2379 => 2,
 12379 => 2,


 14 => 4,
 47 => 4,
 34 => 4,
 49 => 4,
 147 => 4,
 134 => 4,
 347 => 4,
 349 => 4,
 149 => 4,
 479 => 4,
 1347 => 4,
 1479 => 4,
 1349 => 4,
 3479 => 4,
 13479 => 4,

 16 => 6,
 36 => 6,
 67 => 6,
 69 => 6,
 136 => 6,
 167 => 6,
 169 => 6,
 367 => 6,
 369 => 6,
 679 => 6,
 1369 => 6,
 3679 => 6,
 1367 => 6,
 1679 => 6,
 13679 => 6,

 78 => 8,
 89 => 8,
 18 => 8,
 38 => 8,
 138 => 8,
 789 => 8,
 178 => 8,
 189 => 8,
 378 => 8,
 389 => 8,
 1789 => 8,
 3789 => 8,
 1378 => 8,
 1389 => 8,
 13789 => 8,

 1468 => 468,
 3468 => 468,
 13468 => 468,

 2467 => 246,
 2469 => 246,
 24679 => 246,

 2348 => 248,
 2489 => 248,
 23489 => 248,

 1268 => 268,
 2678 => 268,
 12678 => 268,

 148 => 48,
 348 => 48,
 489 => 48,
 1348 => 48,
 1489 => 48,
 3489 => 48,
 13489 => 48,

 168 => 68,
 368 => 68,
 678 => 68,
 1368 => 68,
 1678 => 68,
 3678 => 68,
 13678 => 68,

 234 => 24,
 247 => 24,
 249 => 24,
 2347 => 24,
 2349 => 24,
 2479 => 24,
 23479 => 24,

 126 => 26,
 267 => 26,
 269 => 26,
 1267 => 26,
 1269 => 26,
 2679 => 26,
 12679 => 26,
 }

**
Rep: +0/-0Level 88
Sorry for the triple post, the second code didn't fit a single one.

CMS First part
Code: [Select]
#=============================================================
# 1-Scene Custom Menu System
#=============================================================
# LegACy 
# Version 1.17b
# 7.29.06
#=============================================================
# This script is a further development of Hydrolic's CMS
# request. I enhance it toward every aspect of a menu system
# so now it all operates in one scene full of animation.
# There's an animated sprite and element wheel features.
# There's also different category for items implemented.
# Now there's enhanced equipment features as well as faceset
# features. Don't forget the icon command feature, too!
# The newest version now has an integrated party swapper!
#
# To put items into different catagory, simply apply
# attributes to them, you can apply more than 1 attributes
# to each item. In default, the attributes are :
# :: 17 > Recovery items
# :: 18 > Weaponry
# :: 19 > Armor
# :: 20 > Accessories
# :: 21 > Key Items
# :: 22 > Miscellanous Items
#
# Faceset pictures should be 'Potrait_', or 'Class_' if you based it
# on actor's class, followed with the ID of the actor. So for Arshes
# it will either 'Potrait_1' or 'Class_1'
#
# For customization, look in LegACy class, further explanation's
# located there.
#
# Special thanks to Hydrolic for the idea, Diego for the
# element wheel, SephirotSpawn for sprite animation, KGC
# for the his AlterEquip script and Squall for his ASM.
#=============================================================

  #==============================================================================
  # ** LegACy's Script Customization (CMS)
  #==============================================================================
  class LegACy
    #--------------------------------------------------------------------------
    # * Custom Scripts Support
    #--------------------------------------------------------------------------
    AMS             = false                       # True if you're using AMS script.
    ATS             = false                       # True if you're using ATS script.
    ABS             = false                       # True if you're using Near's ABS script.
    PREXUS          = false                       # True if you're using Prexus' ABS script.
    #--------------------------------------------------------------------------
    # * Features Customization Constants
    #--------------------------------------------------------------------------
    ANIMATED        = false                # True if you want to have animated chara feature.
    EXTRA_EQUIP     = false                       # True if you want to use Enhanced Equipment feature.
    PARTY_SWAP      = true                        # True if you want to use Party Swapper feature.
    BATTLE_BAR      = false                   # True if you want to have bar for battle system.
    ICON            = true                        # True if you want to have icon on command_window.
    MAX_PARTY       = 4                           # Number of max member in the party.
    SAVE_NUMBER     = 10                          # Number of save slot available
    #--------------------------------------------------------------------------
    # * Item Grouping Customization Constants
    #--------------------------------------------------------------------------
    ITEMS           = [17, 19, 21, 18, 20, 22]    # Attributes ID for Item Catagory in order.
    #--------------------------------------------------------------------------
    # * Display Customization Constants
    #--------------------------------------------------------------------------
    WIN_OPACITY     = 200                         # Opacity of CMS' windows
    WIN_Z           = 201                         # Z value of CMS' windows
    ICON_NAME       = ['menu', 'item']            # Image name for icon, first is for main menu while the second is for item command.
    POTRAIT         = [false, false]              # True if you want to use faceset instead of charset display, first is for front menu while the second is for status window.
    CLASS_POTRAIT   = [false, false]              # True if you want to base the faceset on class instead of actor, first is for front menu while the second is for status window.
    POTRAIT_DIR     = 'Potrait_'                  # Image name for actor-based faceset.
    CLASS_DIR       = 'Class_'                    # Image name for class-based faceset.
    STAT_BAR        = [false, false, true]        # Windows where the stat bar appears.
    BAR_COLOR       = [Color.new(255, 0, 0, 200), # Color for bars.
                      Color.new(255, 255, 0, 200),
                      Color.new(0, 255, 255, 200),
                      Color.new(200, 64, 64, 255),
                      Color.new(64, 128, 64, 255),           
                      Color.new(160, 100, 160, 255),
                      Color.new(128, 128, 200, 255)]
    #--------------------------------------------------------------------------
    # * Element Wheel Customization Constants
    #--------------------------------------------------------------------------
    ELEMENT_NUMBER  = 8                          # Number of elements applied in the element wheel.
    ELEMENTS        = [1, 2, 3, 4, 5, 6, 7, 8]   # Elements that appear on the element wheel, in order.
  end
 
  #==============================================================================
  # ** Bitmap
  #==============================================================================
  class Bitmap
    def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
      distance = (start_x - end_x).abs + (start_y - end_y).abs
      if end_color == start_color
        for i in 1..distance
          x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
          y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
          if width == 1
            self.set_pixel(x, y, start_color)
           else
            self.fill_rect(x, y, width, width, start_color)
          end
        end
      else
        for i in 1..distance
          x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
          y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
          r = start_color.red   * (distance-i)/distance + end_color.red   * i/distance
          g = start_color.green * (distance-i)/distance + end_color.green * i/distance
          b = start_color.blue  * (distance-i)/distance + end_color.blue  * i/distance
          a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
          if width == 1
            self.set_pixel(x, y, Color.new(r, g, b, a))
          else
            self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
          end
        end
      end
    end
  end

  #==============================================================================
  # ** Game_Actor
  #------------------------------------------------------------------------------
  #  This class handles the actor. It's used within the Game_Actors class
  #  ($game_actors) and refers to the Game_Party class ($game_party).
  #==============================================================================
  class Game_Actor < Game_Battler
    #--------------------------------------------------------------------------
    # * Get Current Experience Points
    #--------------------------------------------------------------------------
    def now_exp
      return @exp - @exp_list[@level]
    end
    #--------------------------------------------------------------------------
    # * Get Needed Experience Points
    #--------------------------------------------------------------------------
    def next_exp
      return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
    end
  end 
 
  #==============================================================================
  # ** Game_Party
  #------------------------------------------------------------------------------
  #  This class handles the party. It includes information on amount of gold
  #  and items. Refer to "$game_party" for the instance of this class.
  #==============================================================================
  class Game_Party
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    attr_accessor   :reserve                   # reserve actors
     #--------------------------------------------------------------------------
    # * Alias Initialization
    #--------------------------------------------------------------------------
    alias legacy_CMS_gameparty_init initialize
     #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      # Create reserve actor array
      @reserve = []
      legacy_CMS_gameparty_init
    end
    #--------------------------------------------------------------------------
    # * Add an Actor
    #     actor_id : actor ID
    #--------------------------------------------------------------------------
    def add_actor(actor_id)
      # Get actor
      actor = $game_actors[actor_id]
      # If the party has less than 4 members and this actor is not in the party
      if @actors.size < LegACy::MAX_PARTY and not @actors.include?(actor)
        # Add actor
        @actors.push(actor)
      else
        @reserve.push(actor)
      end
      # Refresh player
      $game_player.refresh
    end
    #--------------------------------------------------------------------------
    # * Remove Actor
    #     actor_id : actor ID
    #--------------------------------------------------------------------------
    def remove_actor(actor_id)
      # Get actor
      actor = $game_actors[actor_id]
      # Delete actor
      @actors.delete(actor) if @actors.include?(actor)
      @reserve.delete(actor) if @reserve.include?(actor)
      # Refresh player
      $game_player.refresh
    end   
   
  end
 
  #==============================================================================
  # ** Game_Map
  #------------------------------------------------------------------------------
  #  This class handles the map. It includes scrolling and passable determining
  #  functions. Refer to "$game_map" for the instance of this class.
  #==============================================================================
  class Game_Map
    #--------------------------------------------------------------------------
    # * Get Map Name
    #--------------------------------------------------------------------------
    def name
       load_data("Data/MapInfos.rxdata")[@map_id].name
    end 
  end 
 
  #==============================================================================
  # ** Window_Base
  #------------------------------------------------------------------------------
  #  This class is for all in-game windows.
  #==============================================================================
  class Window_Base < Window
    FONT_SIZE          = 16
    GRAPH_SCALINE_COLOR        = Color.new(255, 255, 255, 128)
    GRAPH_SCALINE_COLOR_SHADOW = Color.new(  0,   0,   0, 192)
    GRAPH_LINE_COLOR           = Color.new(255, 255,  64, 255)
    GRAPH_LINE_COLOR_MINUS     = Color.new( 64, 255, 255, 255)
    GRAPH_LINE_COLOR_PLUS      = Color.new(255,  64,  64, 255)   
   
    def draw_actor_element_radar_graph(actor, x, y, radius = 43)     
      cx = x + radius + FONT_SIZE + 48
      cy = y + radius + FONT_SIZE + 32
      for loop_i in 0..LegACy::ELEMENT_NUMBER
        if loop_i != 0
        @pre_x  = @now_x
        @pre_y  = @now_y
        @pre_ex = @now_ex
        @pre_ey = @now_ey
        @color1 = @color2
      end
      if loop_i == LegACy::ELEMENT_NUMBER
        eo = LegACy::ELEMENTS[0]
      else
        eo = LegACy::ELEMENTS[loop_i]
      end
      er = actor.element_rate(eo)
      estr = $data_system.elements[eo]
      @color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
      er = er.abs
      th = Math::PI * (0.5 - 2.0 * loop_i / LegACy::ELEMENT_NUMBER)
      @now_x  = cx + (radius * Math.cos(th)).floor
      @now_y  = cy - (radius * Math.sin(th)).floor
      @now_wx = cx - 6 + ((radius + FONT_SIZE * 3 / 2) * Math.cos(th)).floor - FONT_SIZE
      @now_wy = cy - ((radius + FONT_SIZE * 1 / 2) * Math.sin(th)).floor - FONT_SIZE/2
      @now_vx = cx + ((radius + FONT_SIZE * 8 / 2) * Math.cos(th)).floor - FONT_SIZE
       @now_vy = cy - ((radius + FONT_SIZE * 3 / 2) * Math.sin(th)).floor - FONT_SIZE/2
       @now_ex = cx + (er*radius/100 * Math.cos(th)).floor
       @now_ey = cy - (er*radius/100 * Math.sin(th)).floor
       if loop_i == 0
         @pre_x  = @now_x
         @pre_y  = @now_y
         @pre_ex = @now_ex
         @pre_ey = @now_ey
         @color1 = @color2
       else       
       end
       next if loop_i == 0
       self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
       self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
       self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
       self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
       self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
       self.contents.font.color = system_color
       self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*3.1, FONT_SIZE, estr, 1)
       self.contents.font.color = Color.new(255,255,255,128)
       self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, er.to_s + "%", 2)
       self.contents.font.color = normal_color
     end
   end
    #--------------------------------------------------------------------------
    # Draw Stat Bar
    #     actor  : actor
    #     x      : bar x-coordinate
    #     y      : bar y-coordinate
    #     stat   : stat to be displayed
    #--------------------------------------------------------------------------
    def draw_LegACy_bar(actor, x, y, stat, width = 156, height = 7)
      bar_color = Color.new(0, 0, 0, 255)
      end_color = Color.new(255, 255, 255, 255)
      max = 999
      case stat
      when "hp"
        bar_color = Color.new(150, 0, 0, 255)
        end_color = Color.new(255, 255, 60, 255)
        min = actor.hp
        max = actor.maxhp
      when "sp"
        bar_color = Color.new(0, 0, 155, 255)
        end_color = Color.new(255, 255, 255, 255)
        min = actor.sp
        max = actor.maxsp
      when "exp"
        bar_color = Color.new(0, 155, 0, 255)
        end_color = Color.new(255, 255, 255, 255)
        unless actor.level == $data_actors[actor.id].final_level
          min = actor.now_exp
          max = actor.next_exp
        else
          min = 1
          max = 1
        end 
      when 'atk'
        bar_color = LegACy::BAR_COLOR[0]
        min = actor.atk
      when 'pdef'
        bar_color = LegACy::BAR_COLOR[1]
        min = actor.pdef
      when 'mdef'
        bar_color = LegACy::BAR_COLOR[2]
        min = actor.mdef
      when 'str'
        bar_color = LegACy::BAR_COLOR[3]
        min = actor.str
      when 'dex'
        bar_color = LegACy::BAR_COLOR[4]
        min = actor.dex
      when 'agi'
        bar_color = LegACy::BAR_COLOR[5]
        min = actor.agi
      when 'int'
        bar_color = LegACy::BAR_COLOR[6]
        min = actor.int
      end
      max = 1 if max == 0
      # Draw Border
      for i in 0..height
        self.contents.fill_rect(x + i, y + height - i, width + 1, 1,
        Color.new(50, 50, 50, 255))
      end
      # Draw Background
      for i in 1..(height - 1)
        r = 100 * (height - i) / height + 0 * i / height
        g = 100 * (height - i) / height + 0 * i / height
        b = 100 * (height - i) / height + 0 * i / height
        a = 255 * (height - i) / height + 255 * i / height
        self.contents.fill_rect(x + i, y + height - i, width, 1,
        Color.new(r, b, g, a))
      end
      # Draws Bar
      for i in 1..( (min.to_f / max.to_f) * width - 1)
        for j in 1..(height - 1)
          r = bar_color.red * (width - i) / width + end_color.red * i / width
          g = bar_color.green * (width - i) / width + end_color.green * i / width
          b = bar_color.blue * (width - i) / width + end_color.blue * i / width
          a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
          self.contents.fill_rect(x + i + j, y + height - j, 1, 1,
          Color.new(r, g, b, a))
        end
      end
      case stat
      when "hp"
        draw_actor_hp(actor, x - 1, y - 18)
      when "sp"
        draw_actor_sp(actor, x - 1, y - 18)
      when "exp"
        draw_actor_exp(actor, x - 1, y - 18)
      end
    end
    #--------------------------------------------------------------------------
    # * Draw Sprite
    #--------------------------------------------------------------------------
    def draw_LegACy_sprite(x, y, name, hue, frame)
      bitmap = RPG::Cache.character(name, hue)
      cw = bitmap.width / 4
      ch = bitmap.height / 4
      # Current Animation Slide
      case frame
        when 0 ;b = 0
        when 1 ;b = cw
        when 2 ;b = cw * 2
        when 3 ;b = cw * 3
      end
      # Bitmap Rectange
      src_rect = Rect.new(b, 0, cw, ch)
      # Draws Bitmap     
      self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
    end
    #--------------------------------------------------------------------------
    # * Get Upgrade Text Color
    #--------------------------------------------------------------------------
    def up_color
      return Color.new(74, 210, 74)
    end
    #--------------------------------------------------------------------------
    # * Get Downgrade Text Color
    #--------------------------------------------------------------------------
    def down_color
      return Color.new(170, 170, 170)
    end
    #--------------------------------------------------------------------------
    # * Draw Potrait
    #     actor : actor
    #     x     : draw spot x-coordinate
    #     y     : draw spot y-coordinate
    #--------------------------------------------------------------------------
    def draw_actor_potrait(actor, x, y, classpotrait = false, width = 96, height = 96)
      classpotrait ? bitmap = RPG::Cache.picture(LegACy::CLASS_DIR + actor.class_id.to_s) :
        bitmap = RPG::Cache.picture(LegACy::CLASS_DIR + actor.id.to_s)
      src_rect = Rect.new(0, 0, width, height)
      self.contents.blt(x, y, bitmap, src_rect)
    end
    #--------------------------------------------------------------------------
    # * Draw parameter
    #     actor : actor
    #     x     : draw spot x-coordinate
    #     y     : draw spot y-coordinate
    #     type  : parameter type
    #------------------------------------------------------------------------
    def draw_actor_parameter(actor, x, y, type, width = 120, bar = false)
      case type
      when 0
        parameter_name = $data_system.words.atk
        parameter_value = actor.atk
        stat = 'atk'
      when 1
        parameter_name = $data_system.words.pdef
        parameter_value = actor.pdef
        stat = 'pdef'
      when 2
        parameter_name = $data_system.words.mdef
        parameter_value = actor.mdef
        stat = 'mdef'
      when 3
        parameter_name = $data_system.words.str
        parameter_value = actor.str
        stat = 'str'
      when 4
        parameter_name = $data_system.words.dex
        parameter_value = actor.dex
        stat = 'dex'
      when 5
        parameter_name = $data_system.words.agi
        parameter_value = actor.agi
        stat = 'agi'
      when 6
        parameter_name = $data_system.words.int
        parameter_value = actor.int
        stat = 'int'
      when 7
        parameter_name = "Evasion"
        parameter_value = actor.eva
        stat = 'eva'
      end
      if bar == true && stat != 'eva'
        draw_LegACy_bar(actor, x + 16, y + 21, stat, width - 16, 5)
      end
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 120, 32, parameter_name)
      self.contents.font.color = normal_color
      self.contents.draw_text(x + width, y, 36, 32, parameter_value.to_s, 2)
    end
  end
 
  #==============================================================================
  # ** Window_NewCommand
  #------------------------------------------------------------------------------
  #  This window deals with general command choices.
  #==============================================================================

  class Window_NewCommand < Window_Selectable
    #--------------------------------------------------------------------------
    # * Object Initialization
    #     width    : window width
    #     commands : command text string array
    #--------------------------------------------------------------------------
    def initialize(width, commands, icon = nil)
      # Compute window height from command quantity
      super(0, 0, width, commands.size / 3 * 32 + 32)
      @item_max = commands.size
      @commands = commands
      @icon = icon
      @column_max = 3
      self.contents = Bitmap.new(width - 32, @item_max/3 * 32)
      refresh
      self.index = 0
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      for i in 0...@item_max
        draw_item(i, normal_color)
      end
    end
    #--------------------------------------------------------------------------
    # * Draw Item
    #     index : item number
    #     color : text color
    #--------------------------------------------------------------------------
    def draw_item(index, color)
      self.contents.font.color = color
      self.contents.font.size = 20
      self.contents.font.bold = true
      rect = Rect.new((109 * (index / 2)), 32 * (index % 2), self.width / @column_max - 12, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      unless @icon == nil
        bitmap = RPG::Cache.icon(@icon + index.to_s)
        self.contents.blt((106 * (index / 2)), 32 * (index % 2) + 4, bitmap, Rect.new(0, 0, 24, 24))
      end     
      self.contents.draw_text(rect, @commands[index])
    end
    #--------------------------------------------------------------------------
    # * Disable Item
    #     index : item number
    #--------------------------------------------------------------------------
    def disable_item(index)
      draw_item(index, disabled_color)
    end
  end

  #==============================================================================
  # ** Window_NewMenuStatus
  #------------------------------------------------------------------------------
  #  This window displays party member status on the menu screen.
  #==============================================================================

  class Window_NewMenuStatus < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      $game_party.actors.size < 4 ? i = 14 : i = 0
      $game_party.actors.size == 1 ? i = 24 : i = i
      super(0, 0, 480, ($game_party.actors.size * 84) + i)
      self.contents = Bitmap.new(width - 32, height - 32)
      refresh
      self.active = false
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      for i in 0...$game_party.actors.size
        x = 4
        y = (i * 76) - 6
        actor = $game_party.actors[i]
        self.contents.font.size = 19
        self.contents.font.bold = true
        draw_actor_class(actor, x, y - 1)
        draw_actor_state(actor, x + 160, y - 1)
        self.contents.font.size = 15
        draw_actor_parameter(actor, x, y + 14, 0, 120, LegACy::STAT_BAR[0])
        draw_actor_parameter(actor, x, y + 29, 1, 120, LegACy::STAT_BAR[0])
        draw_actor_parameter(actor, x, y + 44, 2, 120, LegACy::STAT_BAR[0])
        draw_actor_parameter(actor, x, y + 59, 3, 120, LegACy::STAT_BAR[0])
        draw_actor_parameter(actor, x + 240, y + 14, 4, 120, LegACy::STAT_BAR[0])
        draw_actor_parameter(actor, x + 240, y + 29, 5, 120, LegACy::STAT_BAR[0])
        draw_actor_parameter(actor, x + 240, y + 44, 6, 120, LegACy::STAT_BAR[0])
        draw_LegACy_bar(actor, x + 240, y + 75, 'exp')
      end
    end   
  end

  #==============================================================================
  # ** Window_Actor
  #------------------------------------------------------------------------------
  #  This window displays party member status on the menu screen.
  #==============================================================================

  class Window_Actor < Window_Selectable
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    attr_accessor :party                    # party switcher
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      $game_party.actors.size < 4 ? i = 14 : i = 0     
      $game_party.actors.size == 1 ? i = 24 : i = i
      super(0, 0, 160, ($game_party.actors.size * 84) + i)
      self.contents = Bitmap.new(width - 32, height - 32)
      @frame = 0
      @party = false
      refresh
      self.active = false
      self.index = -1
    end   
    #--------------------------------------------------------------------------
    # * Returning Party Swapping State
    #--------------------------------------------------------------------------
    def party
      return @party
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      #@party ? @item_max = $game_party.actors.size : @item_max = 4
      @item_max = $game_party.actors.size # if $game_party.actors.size <= 4
      $game_party.actors.size < 4 ? i = 14 : i = 0     
      $game_party.actors.size == 1 ? i = 24 : i = i
      self.contents = Bitmap.new(width - 32, (@item_max * 84) + i - 32)
      for i in 0...@item_max
        x = 4
        y = (i * 77) - 12
        actor = $game_party.actors[i]
        self.contents.font.size = 17
        self.contents.font.bold = true
        LegACy::POTRAIT[0] ? draw_actor_potrait(actor, x, y - 1, LegACy::CLASS_POTRAIT[0]) : draw_LegACy_sprite(x + 20,
        y + 57, actor.character_name, actor.character_hue, @frame)
        draw_actor_name(actor, x + 52, y + 6)
        draw_actor_level(actor, x + 52, y + 24)
        draw_LegACy_bar(actor, x - 3, y + 60, 'hp', 120)
        draw_LegACy_bar(actor, x - 3, y + 75, 'sp', 120)
      end
    end
    #--------------------------------------------------------------------------
    # * Cursor Rectangle Update
    #--------------------------------------------------------------------------
    def update_cursor_rect       
      @index > 3 ? self.oy = (@index - 3) * 77 : self.oy = 0
      if @index < 0
        self.cursor_rect.empty
      else
        self.cursor_rect.set(-4, (@index * 77) - 2 - self.oy, self.width - 24, 77)
      end
    end
    #--------------------------------------------------------------------------
    # Frame Update
    #--------------------------------------------------------------------------
    def frame_update     
      @frame == 3 ? @frame = 0 : @frame += 1
      refresh
    end
  end
 
  #==============================================================================
  # ** Window_Stat
  #------------------------------------------------------------------------------
  #  This window displays play time on the menu screen.
  #==============================================================================

  class Window_Stat < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      super(0, 0, 320, 96)
      self.contents = Bitmap.new(width - 32, height - 32)
      refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      self.contents.font.color = system_color
      self.contents.font.size = 18
      self.contents.font.bold = true
      @total_sec = Graphics.frame_count / Graphics.frame_rate
      hour = @total_sec / 60 / 60
      min = @total_sec / 60 % 60
      sec = @total_sec % 60
      text = sprintf("%02d:%02d:%02d", hour, min, sec)
      self.contents.draw_text(4, -4, 120, 32, "Play Time")
      cx = contents.text_size($data_system.words.gold).width
      self.contents.draw_text(4, 18, 120, 32, "Step Count")
      self.contents.draw_text(4, 38, cx, 32, $data_system.words.gold, 2)
      self.contents.font.color = normal_color     
      if LegACy::ATS
        self.contents.draw_text(144, -4, 120, 32, $ats.clock, 2)
      else
        self.contents.draw_text(144, -4, 120, 32, text, 2)
      end
      self.contents.draw_text(144, 18, 120, 32, $game_party.steps.to_s, 2)
      self.contents.draw_text(144, 40, 120, 32, $game_party.gold.to_s, 2)
    end
    #--------------------------------------------------------------------------
    # * Frame Update
    #--------------------------------------------------------------------------
    def update
      super
      if Graphics.frame_count / Graphics.frame_rate != @total_sec
        refresh
      end
    end
  end
 
  #==============================================================================
  # ** Window_Location
  #------------------------------------------------------------------------------
  #  This window displays current map name.
  #==============================================================================
 
  class Window_Location < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      super(0, 0, 640, 48)
      self.contents = Bitmap.new(width - 32, height - 32)
      refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      self.contents.font.color = system_color 
      self.contents.font.bold = true
      self.contents.font.size = 20
      self.contents.draw_text(4, -4, 120, 24, "Location")
      self.contents.font.color = normal_color
      self.contents.draw_text(170, -4, 400, 24, $game_map.name.to_s, 2)
    end   
  end
 
  #==============================================================================
  # ** Window_NewHelp
  #------------------------------------------------------------------------------
  #  This window shows skill and item explanations along with actor status.
  #==============================================================================

  class Window_NewHelp < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      super(0, 0, 640, 48)
      self.contents = Bitmap.new(width - 32, height - 32)
    end
    #--------------------------------------------------------------------------
    # * Set Text
    #  text  : text string displayed in window
    #  align : alignment (0..flush left, 1..center, 2..flush right)
    #--------------------------------------------------------------------------
    def set_text(text, align = 0)
      self.contents.font.bold = true
      self.contents.font.size = 20
      # If at least one part of text and alignment differ from last time
      if text != @text or align != @align
        # Redraw text
        self.contents.clear
        self.contents.font.color = normal_color
        self.contents.draw_text(4, -4, self.width - 40, 24, text, align)
        @text = text
        @align = align
        @actor = nil
      end
      self.visible = true
    end
  end

  #==============================================================================
  # ** Window_NewItem
  #------------------------------------------------------------------------------
  #  This window displays items in possession on the item and battle screens.
  #==============================================================================

  class Window_NewItem < Window_Selectable
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      super(0, 96, 480, 336)
      @column_max = 2
      @attribute = LegACy::ITEMS[0]
      refresh
      self.index = 0
      self.active = false
    end
    #--------------------------------------------------------------------------
    # * Get Item
    #--------------------------------------------------------------------------
    def item
      return @data[self.index]
    end
    #--------------------------------------------------------------------------
    # * Updates Window With New Item Type
    #     attribute : new item type
    #--------------------------------------------------------------------------
    def update_item(attribute)
      @attribute = attribute
      refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      if self.contents != nil
        self.contents.dispose
        self.contents = nil
      end
      @data = []
      # Add item
      for i in 1...$data_items.size
        if $game_party.item_number(i) > 0 and
          $data_items[i].element_set.include?(@attribute)
          @data.push($data_items[i])
        end
      end
      # Also add weapons and armors
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0 and
          $data_weapons[i].element_set.include?(@attribute)
          @data.push($data_weapons[i])
        end
      end
     for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0 and
          $data_armors[i].guard_element_set.include?(@attribute)
          @data.push($data_armors[i])
        end
      end
      # If item count is not 0, make a bit map and draw all items
      @item_max = @data.size
      if @item_max > 0
        self.contents = Bitmap.new(width - 32, row_max * 32)
        for i in 0...@item_max
          draw_item(i)
        end
      end
    end
    #--------------------------------------------------------------------------
    # * Draw Item
    #     index : item number
    #--------------------------------------------------------------------------
    def draw_item(index)
      item = @data[index]
      case item
      when RPG::Item
        number = $game_party.item_number(item.id)
      when RPG::Weapon
        number = $game_party.weapon_number(item.id)
      when RPG::Armor
        number = $game_party.armor_number(item.id)
      end
      if item.is_a?(RPG::Item) and
         $game_party.item_can_use?(item.id)
        self.contents.font.color = normal_color
      else
        self.contents.font.color = disabled_color
      end
      x = 4 + index % 2 * (208 + 32)
      y = index / 2 * 32
      rect = Rect.new(x, y, self.width / @column_max - 32, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      bitmap = RPG::Cache.icon(item.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.draw_text(x + 28, y, 132, 32, item.name, 0)
      self.contents.draw_text(x + 160, y, 16, 32, ":", 1)
      self.contents.draw_text(x + 176, y, 24, 32, number.to_s, 2)
    end
    #--------------------------------------------------------------------------
    # * Help Text Update
    #--------------------------------------------------------------------------
    def update_help
      @help_window.set_text(self.item == nil ? "" : self.item.description)
    end
  end
 
  #==============================================================================
  # ** Window_NewSkill
  #------------------------------------------------------------------------------
  #  This window displays usable skills on the skill screen.
  #==============================================================================

  class Window_NewSkill < Window_Selectable
    #--------------------------------------------------------------------------
    # * Object Initialization
    #     actor : actor
    #--------------------------------------------------------------------------
    def initialize(actor)
      super(0, 96, 480, 336)
      @actor = actor
      @column_max = 2
      refresh
      self.index = 0
      self.active = false     
    end
    #--------------------------------------------------------------------------
    # * Acquiring Skill
    #--------------------------------------------------------------------------
    def skill
      return @data[self.index]
    end
    #--------------------------------------------------------------------------
    # * Updates Window With New Actor
    #     actor : new actor
    #--------------------------------------------------------------------------
    def update_actor(actor)
      @actor = actor
      refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      if self.contents != nil
        self.contents.dispose
        self.contents = nil
      end
      @data = []
      for i in 0...@actor.skills.size
        skill = $data_skills[@actor.skills[i]]
        if skill != nil
          @data.push(skill)
        end
      end
      # If item count is not 0, make a bit map and draw all items
      @item_max = @data.size
      if @item_max > 0
        self.contents = Bitmap.new(width - 32, row_max * 32)
        for i in 0...@item_max
          LegACy::PREXUS ? draw_prexus_item(i) : draw_item(i)
        end
      end
    end
    #--------------------------------------------------------------------------
    # * Draw Item
    #     index : item number
    #--------------------------------------------------------------------------
    def draw_item(index)
      skill = @data[index]
      if @actor.skill_can_use?(skill.id)
        self.contents.font.color = normal_color
      else
        self.contents.font.color = disabled_color
      end
      x = 4 + index % 2 * (208 + 32)
      y = index / 2 * 32
      rect = Rect.new(x, y, self.width / @column_max - 32, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      bitmap = RPG::Cache.icon(skill.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.draw_text(x + 28, y, 124, 32, skill.name, 0)
      self.contents.draw_text(x + 152 , y, 48, 32, skill.sp_cost.to_s, 2)
    end
    #--------------------------------------------------------------------------
    # * Draw Item (For Prexus ABS)
    #     index : item number
    #--------------------------------------------------------------------------
    def draw_prexus_item(index)
      skill = @data[index]
      if @actor.skill_can_use?(skill.id)
        if $ABS.player.abs.hot_key.include?(skill.id)
          self.contents.font.color = Color.new(0, 225, 0, 255)
        else
          self.contents.font.color = normal_color
        end
      else
        if $ABS.player.abs.hot_key.include?(skill.id)
          self.contents.font.color = Color.new(0, 225, 0, 160)
        else
          self.contents.font.color = disabled_color
        end
      end
      x = 4 + index % 2 * (208 + 32)
      y = index / 2 * 32
      rect = Rect.new(x, y, self.width / @column_max - 32, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      bitmap = RPG::Cache.icon(skill.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.draw_text(x + 28, y, 124, 32, skill.name, 0)
      self.contents.draw_text(x + 152 , y, 48, 32, skill.sp_cost.to_s, 2)
    end
    #--------------------------------------------------------------------------
    # * Help Text Update
    #--------------------------------------------------------------------------
    def update_help
      @help_window.set_text(self.skill == nil ? "" : self.skill.description)
    end
  end
 
  #==============================================================================
  # ** Window_Hotkey
  #------------------------------------------------------------------------------
  #  This window displays the skill shortcut
  #==============================================================================
 
  class Window_Hotkey < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      super(0, 336, 480, 96)
      self.contents = Bitmap.new(width - 32, height - 32)
      refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      self.contents.font.size = 18
      self.contents.font.bold = true
      self.contents.font.color = system_color
      self.contents.draw_text(4, 0, 32, 32, 'H')
      self.contents.draw_text(4, 32, 32, 32, 'J')
      self.contents.draw_text(228, 0, 32, 32, 'K')
      self.contents.draw_text(228, 32, 32, 32, 'L')
      self.contents.font.color = normal_color
      for i in 0...4
        if ABS.skill_key[i] == nil
          self.contents.draw_text((i / 2 * 224) + 54, 32 * (i % 2), 124, 32, 'Not assigned')
          next
        end       
        skill = $data_skills[ABS.skill_key[i + 1]]       
        bitmap = RPG::Cache.icon(skill.icon_name)
        self.contents.blt((i / 2 * 224) + 26, (32 * (i % 2)) + 4, bitmap, Rect.new(0, 0, 24, 24))
        self.contents.draw_text((i / 2 * 224) + 54, 32 * (i % 2), 124, 32, skill.name)
        self.contents.draw_text((i / 2 * 224) + 178, 32 * (i % 2), 32, 32, skill.sp_cost.to_s, 2)
      end
    end
  end

  #==============================================================================
  # ** Window_EquipStat
  #------------------------------------------------------------------------------<
« Last Edit: January 07, 2007, 08:14:03 AM by sanchezinc »

**
Rep: +0/-0Level 88
And the rest of the code. Remember this and the one before, blong to the same script.

Code: [Select]
#==============================================================================
  # ** Window_Status
  #------------------------------------------------------------------------------
  #  This window displays full status specs on the status screen.
  #==============================================================================

  class Window_NewStatus < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #     actor      : actor
    #--------------------------------------------------------------------------
    def initialize(actor)
      super(0, 96, 640, 336)
      self.contents = Bitmap.new(width - 32, height - 32)
      @actor = actor
      refresh
      self.active = false
    end
    #--------------------------------------------------------------------------
    # * Updates Window With New Actor
    #     actor : new actor
    #--------------------------------------------------------------------------   
    def update_actor(actor)
      @actor = actor
      refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      self.contents.font.size = 22
      self.contents.font.bold = false
      draw_actor_name(@actor, 12, 0)
      if LegACy::POTRAIT[1]
        draw_actor_potrait(@actor, 12, 40, LegACy::POTRAIT[1])
        draw_LegACy_bar(@actor, 120, 60, 'hp', 200)
        draw_LegACy_bar(@actor, 120, 92, 'sp', 200)
        draw_LegACy_bar(@actor, 120, 124, 'exp', 200)
      else
        draw_actor_graphic(@actor,         40, 120)
        draw_LegACy_bar(@actor, 96, 60, 'hp', 200)
        draw_LegACy_bar(@actor, 96, 92, 'sp', 200)
        draw_LegACy_bar(@actor, 96, 124, 'exp', 200)
      end     
      draw_actor_class(@actor, 262, 0)
      draw_actor_level(@actor, 184, 0)
      draw_actor_state(@actor, 96, 0)     
      self.contents.font.size = 17
      self.contents.font.bold = true
      for i in 0..7
        draw_actor_parameter(@actor, 386, (i * 20) - 6, i, 120, LegACy::STAT_BAR[2])
      end
      self.contents.font.color = system_color
      self.contents.font.size = 16
      draw_actor_element_radar_graph(@actor, 48, 136)
      self.contents.font.size = 18
      self.contents.font.color = system_color
      self.contents.draw_text(380, 156, 96, 32, "Equipment")
      self.contents.draw_text(300, 180, 96, 32, "Weapon")
      self.contents.draw_text(300, 204, 96, 32, "Shield")
      self.contents.draw_text(300, 228, 96, 32, "Helmet")
      self.contents.draw_text(300, 252, 96, 32, "Armor")
      self.contents.draw_text(300, 276, 96, 32, "Accessory")
      equip = $data_weapons[@actor.weapon_id]
      if  @actor.equippable?(equip)
        draw_item_name($data_weapons[@actor.weapon_id], 406, 180)
      else
        self.contents.font.color = knockout_color
        self.contents.draw_text(406, 180, 192, 32, "Nothing equipped")
      end
      equip1 = $data_armors[@actor.armor1_id]
        if  @actor.equippable?(equip1)
        draw_item_name($data_armors[@actor.armor1_id], 406, 204)
      else
        self.contents.font.color = crisis_color
        self.contents.draw_text(406, 204, 192, 32, "Nothing equipped")
      end
      equip2 = $data_armors[@actor.armor2_id]
        if  @actor.equippable?(equip2)
        draw_item_name($data_armors[@actor.armor2_id], 406, 228)
      else
        self.contents.font.color = crisis_color
        self.contents.draw_text(406, 228, 192, 32, "Nothing equipped")
      end
      equip3 = $data_armors[@actor.armor3_id]
        if  @actor.equippable?(equip3)
        draw_item_name($data_armors[@actor.armor3_id], 406, 252)
      else
        self.contents.font.color = crisis_color
        self.contents.draw_text(406, 252, 192, 32, "Nothing equipped")
      end
      equip4 = $data_armors[@actor.armor4_id]
        if  @actor.equippable?(equip4)
        draw_item_name($data_armors[@actor.armor4_id], 406, 276)
      else
        self.contents.font.color = crisis_color
        self.contents.draw_text(406, 276, 192, 32, "Nothing equipped")
      end   
    end   
    def dummy
      self.contents.font.color = system_color
      self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
      self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
      self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
      self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
      self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
      draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
      draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
      draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
      draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
      draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
    end   
  end
 
  #==============================================================================
  # ** Window_Files
  #------------------------------------------------------------------------------
  # This window shows a list of recorded save files.
  #==============================================================================

  class Window_File < Window_Selectable
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize()
      super(0, 96, 320, 336)
      self.contents = Bitmap.new(width - 32, LegACy::SAVE_NUMBER * 32)
      index = $game_temp.last_file_index == nil ? 0 : $game_temp.last_file_index
      self.index = index
      self.active = false
      @item_max = LegACy::SAVE_NUMBER
      refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      self.contents.font.color = normal_color
      time_stamp = Time.at(0)
      for i in 0...LegACy::SAVE_NUMBER
        filename = "Save#{i + 1}.rxdata"
        self.contents.draw_text(1, i * 32, 32, 32, (i + 1).to_s, 1)
        if FileTest.exist?(filename)
          size = File.size(filename)
          if size.between?(1000, 999999)
            size /= 1000
            size_str = "#{size} KB"
          elsif size > 999999
            size /= 1000000
            size_str = "#{size} MB"
          else
            size_str = size.to_s
          end
          time_stamp = File.open(filename, "r").mtime
          date = time_stamp.strftime("%m/%d/%Y")
          time = time_stamp.strftime("%H:%M")
          self.contents.font.size = 20
          self.contents.font.bold = true
          self.contents.draw_text(38, i * 32, 120, 32, date)
          self.contents.draw_text(160, i * 32, 100, 32, time)
          self.contents.draw_text(0, i * 32, 284, 32, size_str, 2)
        end
      end
    end
  end

  #==============================================================================
  # ** Window_FileStat
  #------------------------------------------------------------------------------
  # This window shows the status of the currently selected save file
  #==============================================================================

  class Window_FileStatus < Window_Base
   #--------------------------------------------------------------------------
    # * Object Initialization
    #     save_window      : current save file
    #--------------------------------------------------------------------------
    def initialize(save_window)
      super(0, 96, 320, 336)
      self.contents = Bitmap.new(width - 32, height - 32)
      @save_window = save_window
      @index = @save_window.index
      refresh
    end
    #--------------------------------------------------------------------------
    # # Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      filename = "Save#{@index + 1}.rxdata"
      return unless FileTest.exist?(filename)
      file = File.open(filename, "r")
      Marshal.load(file)
      frame_count = Marshal.load(file)
      for i in 0...6
        Marshal.load(file)
      end
      party = Marshal.load(file)
      Marshal.load(file)
      map = Marshal.load(file)
      self.contents.font.size = 20
      self.contents.font.bold = true
      for i in 0...party.actors.size
        actor = party.actors[i]
        x = 4
        y = i * 56
        draw_LegACy_bar(actor, x + 112, y + 14, 'hp', 160)
        draw_LegACy_bar(actor, x + 112, y + 36, 'sp', 160)
        draw_actor_name(actor, x + 40, y - 2)
        draw_actor_level(actor, x + 40, y + 22)
        draw_actor_graphic(actor, x + 10, y + 48)       
      end
      total_sec = frame_count / Graphics.frame_rate
      hour = total_sec / 60 / 60
      min = total_sec / 60 % 60
      sec = total_sec % 60
      text = sprintf("%02d:%02d:%02d", hour, min, sec)
      map_name = load_data("Data/MapInfos.rxdata")[map.map_id].name
      self.contents.font.color = system_color
      self.contents.draw_text(4, 224, 96, 32, "Play Time ")
      self.contents.draw_text(4, 252, 96, 32, $data_system.words.gold)
      self.contents.draw_text(4, 280, 96, 32, "Location ")
      self.contents.draw_text(104, 224, 16, 32, ":")
      self.contents.draw_text(104, 252, 16, 32, ":")
      self.contents.draw_text(104, 280, 16, 32, ":")
      self.contents.font.color = normal_color
      self.contents.draw_text(120, 224, 144, 32, text)
      self.contents.draw_text(120, 252, 144, 32, party.gold.to_s)
      self.contents.draw_text(120, 280, 144, 32, map_name)
    end
    #--------------------------------------------------------------------------
    # * Update
    #--------------------------------------------------------------------------
    def update
      if @index != @save_window.index
        @index = @save_window.index
        refresh
      end
      super
    end
  end
 
  #==============================================================================
  # ** 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
      @update_frame = 0
      @targetactive = false
      @exit = false
      @actor = $game_party.actors[0]
      @old_actor = nil     
    end
    #--------------------------------------------------------------------------
    # * Main Processing
    #--------------------------------------------------------------------------
    def main
      # Make command window
      if LegACy::ICON
        s1 = '     ' + $data_system.words.item
        s2 = '     ' + $data_system.words.skill
        s3 = '    ' + $data_system.words.equip
        s4 = '    ' + 'Status'
        s5 = '    ' + 'Save'
        s6 = '    ' + 'Exit'
        t1 = '     ' + 'Recov.'
        t2 = '      ' + 'Weapon'
        t3 = '     ' + 'Armor'
        t4 = '      ' + 'Accessory'
        t5 = '    ' + 'Quest'
        t6 = '    ' + 'Misc.'
      else
        s1 = ' ' + $data_system.words.item
        s2 = ' ' + $data_system.words.skill
        s3 = ' ' + $data_system.words.equip
        s4 = ' ' + 'Status'
        s5 = 'Save'
        s6 = 'Exit'
        t1 = ' ' + 'Recov.'
        t2 = ' ' + 'Weapon'
        t3 = ' ' + 'Armor'
        t4 = ' ' + 'Accessory'
        t5 = 'Quest'
        t6 = 'Misc.'
      end     
      u1 = 'To Title'
      u2 = 'Quit'
      v1 = 'Optimize'
      v2 = 'Unequip All'
      @command_window = Window_NewCommand.new(320, [s1, s2, s3, s4, s5, s6])
      @command_window = Window_NewCommand.new(320, [s1, s2, s3, s4, s5, s6], LegACy::ICON_NAME[0]) if LegACy::ICON
      @command_window.y = -96
      @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 save is forbidden
      if $game_system.save_disabled
        # Disable save
        @command_window.disable_item(4)
      end
      # Make stat window
      @stat_window = Window_Stat.new
      @stat_window.x = 320
      @stat_window.y = -96
      # Make status window
      @status_window = Window_NewMenuStatus.new
      @status_window.x = 640
      @status_window.y = 96
      @location_window = Window_Location.new
      @location_window.y = 480
      @actor_window = Window_Actor.new
      @actor_window.x = -160
      @actor_window.y = 96
      @itemcommand_window = Window_NewCommand.new(320, [t1, t2, t3, t4, t5, t6])
      @itemcommand_window = Window_NewCommand.new(320, [t1, t2, t3, t4, t5, t6], LegACy::ICON_NAME[1]) if LegACy::ICON
      @itemcommand_window.x = -320
      @itemcommand_window.active = false
      @help_window = Window_NewHelp.new
      @help_window.x = -640
      @help_window.y = 432
      @item_window = Window_NewItem.new
      @item_window.x = -480     
      @item_window.help_window = @help_window
      @skill_window = Window_NewSkill.new(@actor)
      @skill_window.x = -480     
      @skill_window.help_window = @help_window
      if LegACy::ABS
        @hotkey_window = Window_Hotkey.new
        @hotkey_window.x = -480
      end
      @equipstat_window = Window_EquipStat.new(@actor)
      @equipstat_window.x = -480
      @equip_window = Window_Equipment.new(@actor)
      @equip_window.x = -240
      @equip_window.help_window = @help_window
      @equipitem_window = Window_EquipmentItem.new(@actor, 0)
      @equipitem_window.x = -240
      @equipitem_window.help_window = @help_window
      @equipenhanced_window = Window_Command.new(160, [v1, v2])
      @equipenhanced_window.x = -160
      @equipenhanced_window.active = false
      @playerstatus_window = Window_NewStatus.new(@actor)
      @playerstatus_window.x = -640
      @file_window = Window_File.new
      @file_window.x = -640
      @filestatus_window = Window_FileStatus.new(@file_window)
      @filestatus_window.x = -320
      @end_window = Window_Command.new(120, [u1, u2])
      @end_window.x = 640
      @end_window.active = false
      @spriteset = Spriteset_Map.new
      @windows = [@command_window, @stat_window, @status_window,
        @location_window, @actor_window, @itemcommand_window,@help_window,
        @item_window, @skill_window, @equipstat_window, @equip_window,
        @equipitem_window, @equipenhanced_window, @playerstatus_window,
        @file_window, @filestatus_window, @end_window]
      @windows.push(@hotkey_window) if LegACy::ABS
      @windows.each {|i| i.opacity = LegACy::WIN_OPACITY}
      @windows.each {|i| i.z = LegACy::WIN_Z}
      # 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     
      @spriteset.dispose
      @windows.each {|i| i.dispose}
    end
    #--------------------------------------------------------------------------
    # * Frame Update
    #--------------------------------------------------------------------------
    def update
      # Update windows
      @windows.each {|i| i.update}
      animate     
      menu_update
      update_scroll if @skill_window.active || @equip_window.active || @playerstatus_window.active
      if LegACy::ANIMATED       
        @update_frame += 1
        if @update_frame == 3
          @update_frame = 0
          @actor_window.frame_update
        end
      end     
    end
    #--------------------------------------------------------------------------
    # * Animating windows.
    #--------------------------------------------------------------------------
    def animate
      if @command_window.active && @skill_window.x == -480 && @file_window.x == -640
        @command_window.y += 6 if @command_window.y < 0
        @stat_window.y += 6 if @stat_window.y < 0
        @actor_window.x += 10 if @actor_window.x < 0
        @status_window.x -= 30 if @status_window.x > 160
        @location_window.y -= 3 if @location_window.y > 432
      elsif @exit == true
        @command_window.y -= 6 if @command_window.y > -96
        @stat_window.y -= 6 if @stat_window.y > -96
        @actor_window.x -= 10 if @actor_window.x > -160
        @status_window.x += 30 if @status_window.x < 640
        @location_window.y += 3 if @location_window.y < 480
        $scene = Scene_Map.new if @location_window.y == 480
      end
      if @itemcommand_window.active       
        if @itemcommand_window.x < 0
          @stat_window.x += 40
          @command_window.x += 40
          @itemcommand_window.x += 40
        end
      else
        if @itemcommand_window.x > -320 && @command_window.active
          @stat_window.x -= 40
          @command_window.x -= 40
          @itemcommand_window.x -= 40
        end
      end
      if @item_window.active       
        if @item_window.x < 0
          @location_window.x += 40
          @help_window.x += 40
          @status_window.x += 30
          @actor_window.x += 30
          @item_window.x += 30
        end
      elsif @targetactive != true
        if @item_window.x > -480 && @command_window.index == 0
          @help_window.x -= 40
          @location_window.x -= 40
          @item_window.x -= 30
          @actor_window.x -= 30
          @status_window.x -= 30
        end
      end
      if @skill_window.active       
        if @skill_window.x < 0
          @location_window.x += 40
          @help_window.x += 40
          @status_window.x += 30
          @actor_window.x += 30
          @hotkey_window.x += 30 if @actor_window.index == 0 && LegACy::ABS
          @skill_window.x += 30
        end
      elsif @targetactive != true
        if @skill_window.x > -480 && @command_window.index == 3
          @help_window.x -= 40
          @location_window.x -= 40
          @skill_window.x -= 30
          if LegACy::ABS
            @hotkey_window.x -= 30 if @hotkey_window.x > -480
          end
          @actor_window.x -= 30         
          @status_window.x -= 30
        end
      end
      if @equip_window.active       
        if @equipstat_window.x < 0
          @status_window.x += 48
          @actor_window.x += 48
          @equip_window.x += 48
          @equipitem_window.x += 48
          @equipstat_window.x += 48         
          @location_window.x += 64
          @help_window.x += 64
        end
      elsif ! @equipitem_window.active && ! @equipenhanced_window.active
        if @equipstat_window.x > -480 && @command_window.index == 1
          @equipstat_window.x -= 48
          @equip_window.x -= 48
          @equipitem_window.x -= 48
          @actor_window.x -= 48
          @status_window.x -= 48
          @help_window.x -= 64
          @location_window.x -= 64
        end
      end
      if @equipenhanced_window.active       
        if @equipenhanced_window.x < 0
          @stat_window.x += 16
          @command_window.x += 16
          @equipenhanced_window.x += 16
        end
      else
        if @equipenhanced_window.x > -160 && @equip_window.active
          @equipenhanced_window.x -= 16
          @stat_window.x -= 16
          @command_window.x -= 16
        end
      end
      if @playerstatus_window.active       
        if @playerstatus_window.x < 0
          @status_window.x += 40
          @actor_window.x += 40
          @playerstatus_window.x += 40
        end
      else
        if @playerstatus_window.x > -640 && @command_window.index == 4
          @playerstatus_window.x -= 40
          @actor_window.x -= 40
          @status_window.x -= 40
        end
      end
      if @file_window.active       
        if @file_window.x < 0
          @status_window.x += 40
          @actor_window.x += 40
          @filestatus_window.x += 40
          @file_window.x += 40
        end
      else
        if @file_window.x > -640
          @file_window.x -= 40
          @filestatus_window.x -= 40     
          @actor_window.x -= 40
          @status_window.x -= 40     
        end
      end
      if @end_window.active       
        if @end_window.x > 520
          @stat_window.x -= 10
          @command_window.x -= 10
          @end_window.x -= 10
        end
      else
        if @end_window.x < 640 && @command_window.index == 5
          @end_window.x += 10
          @stat_window.x += 10
          @command_window.x += 10
        end
      end
    end
    #--------------------------------------------------------------------------
    # * Checking Update Method Needed
    #--------------------------------------------------------------------------
    def menu_update
      if @command_window.active && @command_window.y == 0 && @command_window.x == 0 then update_command
      elsif @item_window.x == -480 && @itemcommand_window.active && @itemcommand_window.x == 0 then update_itemcommand
      elsif @item_window.active && @item_window.x == 0 then update_item
      elsif @skill_window.active then update_skill
      elsif @targetactive == true then update_target
      elsif @equip_window.active && @equip_window.x == 240 then update_equip
      elsif @equipitem_window.active then update_equipment
      elsif @equipenhanced_window.x == 0 then update_extraequip
      elsif @playerstatus_window.x == 0 then update_playerstatus
      elsif @file_window.x == 0 then update_save
      elsif @actor_window.active && @actor_window.x == 0 then update_status
      elsif @end_window.active then update_end     
      end
    end
    #--------------------------------------------------------------------------
    # * Windows Actor Scrolling Update
    #--------------------------------------------------------------------------
    def update_scroll
      if Input.trigger?(Input::R)
        # Play cursor SE
        $game_system.se_play($data_system.cursor_se)
        # To next actor
        if $game_party.actors.size - 1 == @actor_window.index
          @actor_window.index = 0
        else
          @actor_window.index += 1
        end       
        actor = $game_party.actors[@actor_window.index]
        if @skill_window.active
          if LegACy::ABS
            @actor_window.index == 0 ? @skill_window.height = 240 : @skill_window.height = 336
            @actor_window.index == 0 ? @hotkey_window.x = 0 : @hotkey_window.x = -480
          end       
          @skill_window.update_actor(actor)
        end       
        if @equip_window.active
          @equip_window.update_actor(actor)
          @equipitem_window.update_actor(actor)
          @equipstat_window.update_actor(actor)
        end       
        @playerstatus_window.update_actor(actor) if @playerstatus_window.active
        return
      end
      # If L button was pressed
      if Input.trigger?(Input::L)
        # Play cursor SE
        $game_system.se_play($data_system.cursor_se)
        # To previous actor
        if @actor_window.index == 0
          @actor_window.index = $game_party.actors.size - 1
        else
          @actor_window.index -= 1
        end
        actor = $game_party.actors[@actor_window.index]
        if @skill_window.active
          if LegACy::ABS
            @actor_window.index == 0 ? @skill_window.height = 240 : @skill_window.height = 336
            @actor_window.index == 0 ? @hotkey_window.x = 0 : @hotkey_window.x = -480
          end       
          @skill_window.update_actor(actor)
        end         
        if @equip_window.active
          @equip_window.update_actor(actor)
          @equipitem_window.update_actor(actor)
          @equipstat_window.update_actor(actor)
        end       
        @playerstatus_window.update_actor(actor) if @playerstatus_window.active
        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
        @command_window.active = false
        @exit = true
        return
      end
      # If B button was pressed
      if Input.trigger?(Input::SHIFT) && LegACy::PARTY_SWAP
        # Play cancel SE
        $game_system.se_play($data_system.decision_se)
        # Switch to map screen
        @command_window.active = false
        @actor_window.party = true
        unless $game_party.reserve == []
          for i in 0...$game_party.reserve.size
            $game_party.actors.push($game_party.reserve[i])
          end
        end       
        @actor_window.refresh
        @actor_window.active = true       
        @actor_window.index = 0
        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
          @command_window.active = false
          @itemcommand_window.active = true
        when 1  # equipment
         # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Make status window active
          @command_window.active = false
          @actor_window.active = true
          @actor_window.index = 0
        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
          @command_window.active = false
          @file_window.active = true
        when 3..4  # skill & status
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Make status window active
          @command_window.active = false
          @actor_window.active = true
          @actor_window.index = 0
        when 5  # end game
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Switch to end game screen
          @command_window.active = false
          @end_window.active = true
        end
        return
      end
    end
    #--------------------------------------------------------------------------
    # * Frame Update (when item command window is active)
    #--------------------------------------------------------------------------
    def update_itemcommand
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to item command window
        @command_window.active = true
        @itemcommand_window.active = false
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Branch by command window cursor position
        type = LegACy::ITEMS[@itemcommand_window.index]
        @item_window.active = true
        @itemcommand_window.active = false
        @item_window.update_item(type)
        @item_window.index = 0
        @help_window.active = true
        return
      end
    end   
    #--------------------------------------------------------------------------
    # * Frame Update (when item window is active)
    #--------------------------------------------------------------------------
    def update_item
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to item command window
        @item_window.active = false
        @itemcommand_window.active = true
        @help_window.active = false
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        # Get currently selected data on the item window
        @item = @item_window.item
        # If not a use item
        unless @item.is_a?(RPG::Item)
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # If it can't be used
        unless $game_party.item_can_use?(@item.id)
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # If effect scope is an ally
        if @item.scope >= 3
          # Activate target window
          @item_window.active = false
          @targetactive = true
          @actor_window.active = true
          # Set cursor position to effect scope (single / all)
          if @item.scope == 4 || @item.scope == 6
            @actor_window.index = -1
          else
            @actor_window.index = 0
          end
        # If effect scope is other than an ally
        else
          # If command event ID is valid
          if @item.common_event_id > 0
            # Command event call reservation
            $game_temp.common_event_id = @item.common_event_id
            # Play item use SE
            $game_system.se_play(@item.menu_se)
            # If consumable
            if @item.consumable
              # Decrease used items by 1
              $game_party.lose_item(@item.id, 1)
              # Draw item window item
              @item_window.draw_item(@item_window.index)
            end
            # Switch to map screen
            $scene = Scene_Map.new
            return
          end
        end
        return
      end
    end   
    #--------------------------------------------------------------------------
    # * Frame Update (if skill window is active)
    #--------------------------------------------------------------------------
    def update_skill
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to main command menu
        @skill_window.active = false
        @help_window.active = false
        @actor_window.active = true
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        # Get currently selected data on the skill window
        @skill = @skill_window.skill
        # If unable to use
        if @skill == nil or not @actor.skill_can_use?(@skill.id)
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # If effect scope is ally
        if @skill.scope >= 3
          # Activate target window
          @skill_window.active = false
          @targetactive = true
          @actor_window.active = true
          # Set cursor position to effect scope (single / all)
          if @skill.scope == 4 || @skill.scope == 6
            @actor_window.index = -1
          elsif @skill.scope == 7
            @actor_index = @actor_window.index
            @actor_window.index = @actor_index - 10
          else
            @actor_window.index = 0
          end
        # If effect scope is other than ally
        else
          # If common event ID is valid
          if @skill.common_event_id > 0
            # Common event call reservation
            $game_temp.common_event_id = @skill.common_event_id
            # Play use skill SE
            $game_system.se_play(@skill.menu_se)
            # Use up SP
            @actor.sp -= @skill.sp_cost
            # Remake each window content
            @actor_window.refresh
            @skill_window.refresh
            # Switch to map screen
            $scene = Scene_Map.new
            return
          end
        end
        return
      end
      if @skill_window.height == 240 && LegACy::ABS
        if Kboard.keyboard($R_Key_H)
          $game_system.se_play($data_system.decision_se)
          $ABS.skill_key[1] = @skill_window.skill.id
          @hotkey_window.refresh
          return
        end
        if Kboard.keyboard($R_Key_J)
          $game_system.se_play($data_system.decision_se)
          $ABS.skill_key[2] = @skill_window.skill.id
          @hotkey_window.refresh
          return
        end
        if Kboard.keyboard($R_Key_K)
          $game_system.se_play($data_system.decision_se)
          $ABS.skill_key[3] = @skill_window.skill.id
          @hotkey_window.refresh
          return
        end
        if Kboard.keyboard($R_Key_L)
          $game_system.se_play($data_system.decision_se)
          $ABS.skill_key[4] = @skill_window.skill.id
          @hotkey_window.refresh
          return
        end
      end
      if LegACy::PREXUS
        if Input.trigger?(Input::X)
          skill = @skill_window.skill
          unless $ABS.player.abs.hot_key[0] or
                 $ABS.player.abs.hot_key.include?(skill.id)
            $ABS.player.abs.hot_key[0] = skill.id
          end
          @skill_window.refresh
          return
        end
        if Input.trigger?(Input::Y)
          skill = @skill_window.skill
          unless $ABS.player.abs.hot_key[1] or
                 $ABS.player.abs.hot_key.include?(skill.id)
            $ABS.player.abs.hot_key[1] = skill.id
          end
          @skill_window.refresh
          return
        end
        if Input.trigger?(Input::Z)
          skill = @skill_window.skill
          unless $ABS.player.abs.hot_key[2] or
                 $ABS.player.abs.hot_key.include?(skill.id)
            $ABS.player.abs.hot_key[2] = skill.id
          end
          @skill_window.refresh
          return
        end
        if Input.trigger?(Input::A)
          skill = @skill_window.skill
          for i in 0..$ABS.player.abs.hot_key.size
            skillX = $ABS.player.abs.hot_key[i]
            next unless skillX
            $ABS.player.abs.hot_key[i] = nil if skill.id == skillX
          end
          @skill_window.refresh
          return
        end
      end     
    end
    #--------------------------------------------------------------------------
    # * Frame Update (when target window is active)
    #--------------------------------------------------------------------------
    def update_target
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # If unable to use because items ran out
        @actor_window.index = 0
        if @command_window.index == 0
            # Remake item window contents
            @item_window.refresh
            @item_window.active = true
            @actor_window.active = false
        end
        if @command_window.index == 3
          # Remake skill window contents
          @skill_window.refresh
          @skill_window.active = true
          @actor_window.active = false
          @skill_window.update_actor($game_party.actors[0])
        end
        @targetactive = false
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        if @command_window.index == 0
          # If items are used up
          if $game_party.item_number(@item.id) == 0
            # Play buzzer SE
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          # If target is all
          if @actor_window.index == -1
            # Apply item effects to entire party
            used = false
            for i in $game_party.actors
              used |= i.item_effect(@item)
            end
          end
          # If single target
          if @actor_window.index >= 0
            # Apply item use effects to target actor
            target = $game_party.actors[@actor_window.index]
            used = target.item_effect(@item)
          end
          # If an item was used
          if used
            # Play item use SE
            $game_system.se_play(@item.menu_se)
            # If consumable
            if @item.consumable
              # Decrease used items by 1
              $game_party.lose_item(@item.id, 1)
              # Redraw item window item
              @item_window.draw_item(@item_window.index)
            end
            # Remake target window contents
            @actor_window.refresh
            @status_window.refresh
            # If all party members are dead
            if $game_party.all_dead?
              @targetactive = false
              # Switch to game over screen
              $scene = Scene_Gameover.new
              return
            end
            # If common event ID is valid
            if @item.common_event_id > 0
              # Common event call reservation
              $game_temp.common_event_id = @item.common_event_id
              @targetactive = false
              # Switch to map screen
              $scene = Scene_Map.new
              return
            end
          end
          # If item wasn't used
          unless used
            # Play buzzer SE
            $game_system.se_play($data_system.buzzer_se)
          end
          return
        end
        if @command_window.index == 3
          # If unable to use because SP ran out
          unless @act
« Last Edit: January 09, 2007, 02:34:50 AM by sanchezinc »

**
Rep: +0/-0Level 88
 Here's a method:
Code: [Select]
def fog_of_war(static, dynamic, range = FOW_RANGE_DEFAULT, reset = false)

And the "help" for it:
 
Code: [Select]
This method is an alternative to using the default map name method, and
 is designed to be called from a call script event command. This allows
 fog of war to be dynamically enabled or disabled during gameplay.
 
 Parameters:
 static - if true, static fow enabled
 dynamic - if true, dynamic fow enabled
 (if both of the above are false, fow is totally disabled)
 range (optional) - the visual range of the player
                    * default is FOW_RANGE_DEFAULT
 reset (optional) - if true, fow for this map resets entirely (i.e. previously
                    explored areas are covered again)
                    * default is false
                   
 Sample calls:
 fog_of_war(true,true,5) - enable both static and dynamic fow with range of 5
 fog_of_war(false,false,3,true) - disable and reset both types of fow

So, try using this method in your menu scene's main with fog_of_war(false,false). It should disable it entirelly, i think...
To get it back, use it with "true" where the scene_menu changes back to scene_map. In Scene_menu, method : update_command, wherethere is the comment: "# Switch to map screen"
"Oh, mirror, how do i pity you!
Because when the men look at you, they see only themselves, not the mirror, who you really are..."
- Zelbess, Chrono Cross

***
Rep:
Level 88
Random-Idiot
change

Code: [Select]
def initialize_fow

to

Code: [Select]
def initialize_fow
if $scene.is_a?(Scene_Menu)
$game_map.fow = false
return
end
ALL HAIL MEâ„¢

**
Rep: +0/-0Level 88
Thanx for your posts, but they didn't work. Both things u told me disposed the fog of war after opening the menu, but it didn't return after it was closed. The firt  post, showed me an error in the FOW script if I tried to open it again, the second didn't, but still de FOW didn't return.

@Lord, if I understood what u tried to make it's disableing the fow when opening the menu and enableing it when it closes, wouldn't that cause the fow of war appear, after the menu closes in a map without fow?(hipotetically) in reality I got an error when calling the menu in a map without fow.

I got an idea, is it possible that instead of enable/disable the fow, to draw the menu over it? Just like the DMS

**
Rep: +0/-0Level 88
Hello, I also want to add another script to the merge request, its a level up script, it makes it work as in Diablo. But I also get an error with the CMS that I posted before. Here's the script.
Code: [Select]
#=====================================================
# Drago del fato's Level Up Point Spend System
# ---------------------------------------------
# Written by Drago del Fato
# Version 2.4
# Just insert a new script above main and call it whatever you want.
#=====================================================

#--Res Text
PSPEND_LVUPTEXT = "New Level! Do you want to Level up?"
PSPEND_SPTEXT = "Special Points Left:"
PSPEND_ANSWERS = ["Yes!","No"]
PSPEND_HELP_TEXT = ["Change Strength...","Change Agility...",
"Change Dexterity...","Change Inteligence...","Change Maximum Health Points...",
"Change Maximum Skill Points...","Reset all Values to Normal...","Finnish Editing...."]
PSPEND_B1 = "Reset"
PSPEND_B2 = "Done!"
LVUP_TEXT = ""
DESC_TEXT = "LEFT - Decrease, RIGHT - Increase,C - Confirm,B - Exit"

#-- Other Res
SPADD = 5

AGILITY_ADD = 1
DEXTERITY_ADD = 1
INTELIGENCE_ADD = 1
STRENGTH_ADD = 1
HP_ADD = 4
SP_ADD = 4



#-- If you aren't experienced scripter then don't change lines below!!!

#--Global Variables
$PSPEND_POINTS = []
$PSPEND_ACTORS = []
$PSPEND_ADD = [1,1,1,1,1,1]
$PSPEND_ATTR = [1,1,1,1,1,1]
$PSPEND_RET = 0

#== Part One - Class for Setting and Getting Attributes from Actors

class PSPEND_GET_SET_ACTOR_ATRIBUTTES
def initialize(type)
if !$BTEST
case type
when 0
return
when 1
get_attributes
when 2
set_attributes
end
end
end

def get_attributes(actorid)
@actor = $game_actors[actorid]
$PSPEND_ATTR[1] = @actor.str
$PSPEND_ATTR[2] = @actor.agi
$PSPEND_ATTR[3] = @actor.dex
$PSPEND_ATTR[4] = @actor.int
$PSPEND_ATTR[5] = @actor.maxhp
$PSPEND_ATTR[6] = @actor.maxsp
end

def set_attributes(actorid)
@actor = $game_actors[actorid]
@actor.str = $PSPEND_ATTR[1]
@actor.agi = $PSPEND_ATTR[2]
@actor.dex = $PSPEND_ATTR[3]
@actor.int = $PSPEND_ATTR[4]
@actor.maxhp = $PSPEND_ATTR[5]
@actor.maxsp = $PSPEND_ATTR[6]
end

end

#-- End of Part One

#-- Part Two - Disabling actor attributes so that they have same attributes at the next level!

class Game_Actor

def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
$actor_attr.get_attributes(@actor_id)
@level += 1
$actor_attr.set_attributes(@actor_id)
$PSPEND_POINTS[@actor_id - 1] += SPADD
$PSPEND_ACTORS[@actor_id - 1] = true
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
end
while @exp < @exp_list[@level]
$actor_attr.get_attributes(@actor_id)
@level -= 1
$actor_attr.set_attributes(@actor_id)
$PSPEND_ACTORS[@actor_id - 1] = false
end
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end

def level=(level)
if level < self.level
$actor_attr.get_attributes(@actor_id)
level = [[level, $data_actors[@actor_id].final_level].min, 1].max
$actor_attr.set_attributes(@actor_id)
$PSPEND_ACTORS[@actor_id - 1] = false
self.exp = @exp_list[level]
return
end
$actor_attr.get_attributes(@actor_id)
level = [[level, $data_actors[@actor_id].final_level].min, 1].max
$actor_attr.set_attributes(@actor_id)
$PSPEND_POINTS[@actor_id - 1] += SPADD
$PSPEND_ACTORS[@actor_id - 1] = true
self.exp = @exp_list[level]
return
end
end

#-- End of Part Two

#-- Part Three - Telling Scene Title that it's time to go to shop (just kidding...).
# Changing the code so that some other variables will be added...

class Scene_Title

def command_new_game
$game_system.se_play($data_system.decision_se)

Audio.bgm_stop

Graphics.frame_count = 0
$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
#edit
$actor_attr = PSPEND_GET_SET_ACTOR_ATRIBUTTES.new(0)
for i in 0..$data_actors.size - 2
$PSPEND_ACTORS.push(false)
$PSPEND_POINTS.push(0)
end
#end edit
$game_party.setup_starting_members
$game_map.setup($data_system.start_map_id)
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh


$game_map.autoplay
$game_map.update
$scene = Scene_Map.new
end

def 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")

Graphics.frame_count = 0


$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
#edit
$actor_attr = PSPEND_GET_SET_ACTOR_ATRIBUTTES.new(0)
for i in 0..$data_actors.size - 2
$PSPEND_ACTORS.push(false)
$PSPEND_POINTS.push(0)
end
#end edit
$game_party.setup_battle_test_members
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name


$game_system.se_play($data_system.battle_start_se)
$game_system.bgm_play($game_system.battle_bgm)

$scene = Scene_Battle.new
end
end

#End of Part Three

#Mid Part - Adding Draw Actor Battler

class Window_Base < Window

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

def draw_actor_name(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name)
cx = self.contents.text_size(actor.name).width
if $PSPEND_ACTORS[actor.id - 1]
self.contents.font.color = crisis_color
self.contents.draw_text(x + cx, y, 90, 32, " " + LVUP_TEXT)
end
self.contents.font.color = normal_color
end

end

#End of Mid Part

#Part Four - The Hard one! Making Custom Windows

class PSPEND_CUSTOM_WINDOW < Window_Selectable

def initialize(winactorid)
super(0, 64, 640, 480 - 64)
commands = [1,2,3,4,5,6,7,8]
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32,height - 32)
self.contents.font.name = $defaultfonttype # "All Commands" window font
self.contents.font.size = $defaultfontsize
@actor = $game_actors[winactorid + 1]
@y = 10
$PSPEND_RET = $PSPEND_POINTS[@actor.id - 1]
refresh(true)
self.index = 0
end

def refresh(ret = false)
self.contents.clear
@y = 10
if ret
$PSPEND_ADD[1] = @actor.str
$PSPEND_ADD[2] = @actor.agi
$PSPEND_ADD[3] = @actor.dex
$PSPEND_ADD[4] = @actor.int
$PSPEND_ADD[5] = @actor.maxhp
$PSPEND_ADD[6] = @actor.maxsp
$PSPEND_POINTS[@actor.id - 1] = $PSPEND_RET
ret = false
end
draw_actor_battler(@actor,20 + 100,@y + 200)
draw_actor_name(@actor,20 + 32,@y + 220)
cx = self.contents.text_size(PSPEND_SPTEXT + $PSPEND_POINTS[@actor.id - 1].to_s).width
self.contents.draw_text(52,@y + 252,cx,32,PSPEND_SPTEXT + $PSPEND_POINTS[@actor.id - 1].to_s)
cx = self.contents.text_size(DESC_TEXT).width
self.contents.draw_text(52,self.height - 32 - 40,cx,32,DESC_TEXT)
@y += 150
@x = 260

for i in 0...@item_max
draw_item(i, normal_color)
end
end

def draw_item(index, color)
if $PSPEND_POINTS[@actor.id - 1] <= 0
self.contents.font.color = disabled_color
else
self.contents.font.color = color
end
rect = Rect.new(@x, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
case index
when 0
self.contents.draw_text(rect, $data_system.words.str)
cx = self.contents.text_size(@actor.str.to_s + " > " + $PSPEND_ADD[1].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.str.to_s + " > " + $PSPEND_ADD[1].to_s)
when 1
self.contents.draw_text(rect, $data_system.words.agi )
cx = self.contents.text_size(@actor.agi.to_s + " > " + $PSPEND_ADD[2].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.agi.to_s + " > " + $PSPEND_ADD[2].to_s)
when 2
self.contents.draw_text(rect, $data_system.words.dex )
cx = self.contents.text_size( @actor.dex.to_s + " > " + $PSPEND_ADD[3].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 , @actor.dex.to_s + " > " + $PSPEND_ADD[3].to_s)

when 3
self.contents.draw_text(rect, $data_system.words.int )
cx = self.contents.text_size(@actor.int.to_s + " > " + $PSPEND_ADD[4].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.int.to_s + " > " + $PSPEND_ADD[4].to_s)

when 4
self.contents.draw_text(rect, $data_system.words.hp )
cx = self.contents.text_size( @actor.maxhp.to_s + " > " + $PSPEND_ADD[5].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 , @actor.maxhp.to_s + " > " + $PSPEND_ADD[5].to_s)

when 5
self.contents.draw_text(rect, $data_system.words.sp )
cx = self.contents.text_size(@actor.maxsp.to_s + " > " + $PSPEND_ADD[6].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.maxsp.to_s + " > " + $PSPEND_ADD[6].to_s)

when 6
self.contents.font.color = color
self.contents.draw_text(rect,PSPEND_B1)
when 7
self.contents.font.color = color
self.contents.draw_text(rect,PSPEND_B2)
end
end

def disable_item(index)
draw_item(index, disabled_color)
end

def update_cursor_rect

if @index < 0
self.cursor_rect.empty
return
end

row = @index / @column_max

if row < self.top_row
self.top_row = row
end

if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end

cursor_width = self.width / @column_max - 32

x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 32 - self.oy

self.cursor_rect.set(@x - 10, y, self.width - @x - 17, 32)
end
end

#End of Part Four

#Part Five - Making Scene_Status to show level up window when character
#get's a new level

class Scene_Status
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end

def main
@actor = $game_party.actors[@actor_index]
$ACTORD = @actor
@status_window = Window_Status.new(@actor)
Graphics.transition
if $PSPEND_ACTORS[@actor.id - 1]
@h = Window_Help.new
@h.set_text(PSPEND_LVUPTEXT)
@h.y = 100
@h.z = 9997
@c = Window_Command.new(140,PSPEND_ANSWERS)
@c.y = 170
@c.x = 200
@c.z = 9998
loop do
Graphics.update
Input.update
update_pspend_lvup_win

if $scene != self
break
end
end
Graphics.freeze
@h.z = 0
@c.z = 1
@status_window.z = 2
@status_window.dispose
@h.dispose
@c.dispose
return
end
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
@status_window.dispose
end

def update_pspend_lvup_win
@c.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$PSPEND_ACTORS[@actor.id - 1] = false
$scene = Scene_Menu.new
return
end
if Input.trigger?(Input::C)
case @c.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_PSPEND_Main_Screen.new(@actor.id - 1)
return
when 1
$game_system.se_play($data_system.cancel_se)
$PSPEND_ACTORS[@actor.id - 1] = false
$scene = Scene_Menu.new
return
end
end
end
end

#End of Part Five

#Part Six - Hell is coming...AAAAAAAAH!

class Scene_PSPEND_Main_Screen
def initialize(actor_id_index)
@actor_ind = actor_id_index
main
end

def main
@help = Window_Help.new
@spend = PSPEND_CUSTOM_WINDOW.new(@actor_ind)
@spend.y = 64
@spend.z = 99998
@help.z = 99998
Graphics.transition
loop do
Graphics.update
Input.update
update_spend_help_win
if $scene != self
break
end
end
Graphics.freeze
@spend.dispose
@help.dispose
end

def update_spend_help_win
@spend.update
@help.update
@help.set_text(PSPEND_HELP_TEXT[@spend.index])
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new
$PSPEND_POINTS[@actor_ind] = $PSPEND_RET
$PSPEND_ACTORS[@actor_ind] = false
return
end
if Input.repeat?(Input::RIGHT)
unless $PSPEND_POINTS[@actor_ind] > 0
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.cursor_se)
$PSPEND_POINTS[@actor_ind] -= 1
case @spend.index
when 0
$PSPEND_ADD[1] += STRENGTH_ADD
when 1
$PSPEND_ADD[2] += AGILITY_ADD
when 2
$PSPEND_ADD[3] += DEXTERITY_ADD
when 3
$PSPEND_ADD[4] += INTELIGENCE_ADD
when 4
$PSPEND_ADD[5] += HP_ADD
when 5
$PSPEND_ADD[6] += SP_ADD
when 6
$PSPEND_POINTS[@actor_ind] += 1
when 7
$PSPEND_POINTS[@actor_ind] += 1
end
@spend.refresh
return
end


if Input.repeat?(Input::LEFT)
unless $PSPEND_POINTS[@actor_ind] < $PSPEND_RET
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.cursor_se)
case @spend.index
when 0
if $PSPEND_ADD[1] <= $ACTORD.str
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[1] -= STRENGTH_ADD
when 1
if $PSPEND_ADD[2] <= $ACTORD.agi
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[2] -= AGILITY_ADD
when 2
if $PSPEND_ADD[3] <= $ACTORD.dex
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[3] -= DEXTERITY_ADD
when 3
if $PSPEND_ADD[4] <= $ACTORD.int
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[4] -= INTELIGENCE_ADD
when 4
if $PSPEND_ADD[5] <= $ACTORD.maxhp
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[5] -= HP_ADD
when 5
if $PSPEND_ADD[6] <= $ACTORD.maxsp
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[6] -= SP_ADD
when 6
$PSPEND_POINTS[@actor_ind] -= 1
when 7
$PSPEND_POINTS[@actor_ind] -= 1
end
$PSPEND_POINTS[@actor_ind] += 1
@spend.refresh

return
end


if Input.trigger?(Input::C)
case @spend.index
when 6
@spend.refresh(true)
when 7
$ACTORD.str = $PSPEND_ADD[1]
$ACTORD.agi = $PSPEND_ADD[2]
$ACTORD.dex = $PSPEND_ADD[3]
$ACTORD.int = $PSPEND_ADD[4]
$ACTORD.maxhp = $PSPEND_ADD[5]
$ACTORD.maxsp = $PSPEND_ADD[6]
$game_system.se_play($data_system.decision_se)
$scene = Scene_Menu.new
$PSPEND_ACTORS[@actor_ind] = false
return
end
end
end
end

#End of Part Six - Yipee!!! I made it!

#Part Seven - Save Load part!

class Scene_Save < Scene_File

def write_save_data(file)

characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end

Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)

$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number

Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
Marshal.dump($PSPEND_POINTS,file)
Marshal.dump($PSPEND_ACTORS,file)
Marshal.dump($actor_attr,file)
end
end

# -- And now for the load screen

class Scene_Load < Scene_File

def read_save_data(file)

characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)

$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$PSPEND_POINTS = Marshal.load(file)
$PSPEND_ACTORS = Marshal.load(file)
$actor_attr = Marshal.load(file)

if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end

$game_party.refresh
end
end

#-- END OF SAVE AND LOAD SCREEN

#-- END OF THE SCRIPT

#=======================
# Written by Drago del fato
#=======================


***
Rep:
Level 88
Hell... What did I mess up now... I'm Back!
the answer for the point spend system... that is.... if you have this error... >.> You prolly do... of course the 'lvls' part is diff...
or it could look like something else
it mixes in half of what "italianstal1ion" had posted to make it so you can access it without leveling...

just click the spoiler... for the replacement script... >.>
Spoiler for script here:
Code: [Select]
#=====================================================
# Drago del fato's Level Up Point Spend System
# ---------------------------------------------
# Written by Drago del Fato
# Version 2.4
# Just insert a new script above main and call it whatever you want.
#=====================================================

#--Res Text
PSPEND_LVUPTEXT = "New Level! Do you want to Level up?"
PSPEND_SPTEXT = "Special Points Left:"
PSPEND_ANSWERS = ["Yes!","No"]
PSPEND_HELP_TEXT = ["Change Strength...","Change Agility...",
"Change Dexterity...","Change Inteligence...","Change Maximum Health Points...",
"Change Maximum Skill Points...","Reset all Values to Normal...","Finnish Editing...."]
PSPEND_B1 = "Reset"
PSPEND_B2 = "Done!"
LVUP_TEXT = ""
DESC_TEXT = "LEFT - Decrease, RIGHT - Increase,C - Confirm,B - Exit"

#-- Other Res
SPADD = 5

AGILITY_ADD = 1
DEXTERITY_ADD = 1
INTELIGENCE_ADD = 1
STRENGTH_ADD = 1
HP_ADD = 4
SP_ADD = 4



#-- If you aren't experienced scripter then don't change lines below!!!

#--Global Variables
$PSPEND_POINTS = []
$PSPEND_ACTORS = []
$PSPEND_ADD = [1,1,1,1,1,1]
$PSPEND_ATTR = [1,1,1,1,1,1]
$PSPEND_RET = 0

#== Part One - Class for Setting and Getting Attributes from Actors

class PSPEND_GET_SET_ACTOR_ATRIBUTTES
def initialize(type)
if !$BTEST
case type
when 0
return
when 1
get_attributes
when 2
set_attributes
end
end
end

def get_attributes(actorid)
@actor = $game_actors[actorid]
$PSPEND_ATTR[1] = @actor.str
$PSPEND_ATTR[2] = @actor.agi
$PSPEND_ATTR[3] = @actor.dex
$PSPEND_ATTR[4] = @actor.int
$PSPEND_ATTR[5] = @actor.maxhp
$PSPEND_ATTR[6] = @actor.maxsp
end

def set_attributes(actorid)
@actor = $game_actors[actorid]
@actor.str = $PSPEND_ATTR[1]
@actor.agi = $PSPEND_ATTR[2]
@actor.dex = $PSPEND_ATTR[3]
@actor.int = $PSPEND_ATTR[4]
@actor.maxhp = $PSPEND_ATTR[5]
@actor.maxsp = $PSPEND_ATTR[6]
end

end

#-- End of Part One

#-- Part Two - Disabling actor attributes so that they have same attributes at the next level!

class Game_Actor

def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
$actor_attr.get_attributes(@actor_id)
@level += 1
$actor_attr.set_attributes(@actor_id)
$PSPEND_POINTS[@actor_id - 1] += SPADD
$PSPEND_ACTORS[@actor_id - 1] = true
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
end
while @exp < @exp_list[@level]
$actor_attr.get_attributes(@actor_id)
@level -= 1
$actor_attr.set_attributes(@actor_id)
$PSPEND_ACTORS[@actor_id - 1] = false
end
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end

def level=(level)
if level < self.level
$actor_attr.get_attributes(@actor_id)
level = [[level, $data_actors[@actor_id].final_level].min, 1].max
$actor_attr.set_attributes(@actor_id)
$PSPEND_ACTORS[@actor_id - 1] = false
self.exp = @exp_list[level]
return
end
$actor_attr.get_attributes(@actor_id)
level = [[level, $data_actors[@actor_id].final_level].min, 1].max
$actor_attr.set_attributes(@actor_id)
$PSPEND_POINTS[@actor_id - 1] += SPADD
$PSPEND_ACTORS[@actor_id - 1] = true
self.exp = @exp_list[level]
return
end
end

#-- End of Part Two

#-- Part Three - Telling Scene Title that it's time to go to shop (just kidding...).
# Changing the code so that some other variables will be added...

class Scene_Title

def command_new_game
$game_system.se_play($data_system.decision_se)

Audio.bgm_stop

Graphics.frame_count = 0
$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
#edit
$actor_attr = PSPEND_GET_SET_ACTOR_ATRIBUTTES.new(0)
for i in 0..$data_actors.size - 2
$PSPEND_ACTORS.push(false)
$PSPEND_POINTS.push(0)
end
#end edit
$game_party.setup_starting_members
$game_map.setup($data_system.start_map_id)
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh


$game_map.autoplay
$game_map.update
$scene = Scene_Map.new
end

def 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")

Graphics.frame_count = 0


$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
#edit
$actor_attr = PSPEND_GET_SET_ACTOR_ATRIBUTTES.new(0)
for i in 0..$data_actors.size - 2
$PSPEND_ACTORS.push(false)
$PSPEND_POINTS.push(0)
end
#end edit
$game_party.setup_battle_test_members
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name


$game_system.se_play($data_system.battle_start_se)
$game_system.bgm_play($game_system.battle_bgm)

$scene = Scene_Battle.new
end
end

#End of Part Three

#Mid Part - Adding Draw Actor Battler

class Window_Base < Window

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

def draw_actor_name(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name)
cx = self.contents.text_size(actor.name).width
if $PSPEND_ACTORS[actor.id - 1]
self.contents.font.color = crisis_color
self.contents.draw_text(x + cx, y, 90, 32, " " + LVUP_TEXT)
end
self.contents.font.color = normal_color
end

end

#End of Mid Part

#Part Four - The Hard one! Making Custom Windows

class PSPEND_CUSTOM_WINDOW < Window_Selectable

def initialize(winactorid)
super(0, 64, 640, 480 - 64)
commands = [1,2,3,4,5,6,7,8]
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32,height - 32)
self.contents.font.name = $defaultfonttype # "All Commands" window font
self.contents.font.size = $defaultfontsize
@actor = $game_actors[winactorid + 1]
@y = 10
$PSPEND_RET = $PSPEND_POINTS[@actor.id - 1]
refresh(true)
self.index = 0
end

def refresh(ret = false)
self.contents.clear
@y = 10
if ret
$PSPEND_ADD[1] = @actor.str
$PSPEND_ADD[2] = @actor.agi
$PSPEND_ADD[3] = @actor.dex
$PSPEND_ADD[4] = @actor.int
$PSPEND_ADD[5] = @actor.maxhp
$PSPEND_ADD[6] = @actor.maxsp
$PSPEND_POINTS[@actor.id - 1] = $PSPEND_RET
ret = false
end
draw_actor_battler(@actor,20 + 100,@y + 200)
draw_actor_name(@actor,20 + 32,@y + 220)
cx = self.contents.text_size(PSPEND_SPTEXT + $PSPEND_POINTS[@actor.id - 1].to_s).width
self.contents.draw_text(52,@y + 252,cx,32,PSPEND_SPTEXT + $PSPEND_POINTS[@actor.id - 1].to_s)
cx = self.contents.text_size(DESC_TEXT).width
self.contents.draw_text(52,self.height - 32 - 40,cx,32,DESC_TEXT)
@y += 150
@x = 260

for i in 0...@item_max
draw_item(i, normal_color)
end
end

def draw_item(index, color)
if $PSPEND_POINTS[@actor.id - 1] <= 0
self.contents.font.color = disabled_color
else
self.contents.font.color = color
end
rect = Rect.new(@x, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
case index
when 0
self.contents.draw_text(rect, $data_system.words.str)
cx = self.contents.text_size(@actor.str.to_s + " > " + $PSPEND_ADD[1].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.str.to_s + " > " + $PSPEND_ADD[1].to_s)
when 1
self.contents.draw_text(rect, $data_system.words.agi )
cx = self.contents.text_size(@actor.agi.to_s + " > " + $PSPEND_ADD[2].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.agi.to_s + " > " + $PSPEND_ADD[2].to_s)
when 2
self.contents.draw_text(rect, $data_system.words.dex )
cx = self.contents.text_size( @actor.dex.to_s + " > " + $PSPEND_ADD[3].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 , @actor.dex.to_s + " > " + $PSPEND_ADD[3].to_s)

when 3
self.contents.draw_text(rect, $data_system.words.int )
cx = self.contents.text_size(@actor.int.to_s + " > " + $PSPEND_ADD[4].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.int.to_s + " > " + $PSPEND_ADD[4].to_s)

when 4
self.contents.draw_text(rect, $data_system.words.hp )
cx = self.contents.text_size( @actor.maxhp.to_s + " > " + $PSPEND_ADD[5].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 , @actor.maxhp.to_s + " > " + $PSPEND_ADD[5].to_s)

when 5
self.contents.draw_text(rect, $data_system.words.sp )
cx = self.contents.text_size(@actor.maxsp.to_s + " > " + $PSPEND_ADD[6].to_s).width
self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.maxsp.to_s + " > " + $PSPEND_ADD[6].to_s)

when 6
self.contents.font.color = color
self.contents.draw_text(rect,PSPEND_B1)
when 7
self.contents.font.color = color
self.contents.draw_text(rect,PSPEND_B2)
end
end

def disable_item(index)
draw_item(index, disabled_color)
end

def update_cursor_rect

if @index < 0
self.cursor_rect.empty
return
end

row = @index / @column_max

if row < self.top_row
self.top_row = row
end

if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end

cursor_width = self.width / @column_max - 32

x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 32 - self.oy

self.cursor_rect.set(@x - 10, y, self.width - @x - 17, 32)
end
end

#End of Part Four

#Part Five - Making Scene_Status to show level up window when character
#get's a new level

class Scene_Status
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end

def main
@actor = $game_party.actors[@actor_index]
$ACTORD = @actor
@status_window = Window_Status.new(@actor)
Graphics.transition
if $PSPEND_ACTORS[@actor.id - 1]
@h = Window_Help.new
@h.set_text(PSPEND_LVUPTEXT)
@h.y = 100
@h.z = 9997
@c = Window_Command.new(140,PSPEND_ANSWERS)
@c.y = 170
@c.x = 200
@c.z = 9998
loop do
Graphics.update
Input.update
update_pspend_lvup_win

if $scene != self
break
end
end
Graphics.freeze
@h.z = 0
@c.z = 1
@status_window.z = 2
@status_window.dispose
@h.dispose
@c.dispose
return
end
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
@status_window.dispose
end

def update_pspend_lvup_win
@c.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$PSPEND_ACTORS[@actor.id - 1] = false
$scene = Scene_Menu.new
return
end
if Input.trigger?(Input::C)
case @c.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_PSPEND_Main_Screen.new(@actor.id - 1)
return
when 1
$game_system.se_play($data_system.cancel_se)
$PSPEND_ACTORS[@actor.id - 1] = false
$scene = Scene_Menu.new
return
end
end
end
end

#End of Part Five

#Part Six - Hell is coming...AAAAAAAAH!

class Scene_PSPEND_Main_Screen
def initialize(actor_id_index)
@actor_ind = actor_id_index
main
end

def main
@help = Window_Help.new
@spend = PSPEND_CUSTOM_WINDOW.new(@actor_ind)
@spend.y = 64
@spend.z = 99998
@help.z = 99998
Graphics.transition
loop do
Graphics.update
Input.update
update_spend_help_win
if $scene != self
break
end
end
Graphics.freeze
@spend.dispose
@help.dispose
end

def update_spend_help_win
@spend.update
@help.update
@help.set_text(PSPEND_HELP_TEXT[@spend.index])
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new
$PSPEND_POINTS[@actor_ind] = $PSPEND_RET
$PSPEND_ACTORS[@actor.id - 1] = false
return
end
if Input.repeat?(Input::RIGHT)
unless $PSPEND_POINTS[@actor_ind] > 0
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.cursor_se)
$PSPEND_POINTS[@actor_ind] -= 1
case @spend.index
when 0
$PSPEND_ADD[1] += STRENGTH_ADD
when 1
$PSPEND_ADD[2] += AGILITY_ADD
when 2
$PSPEND_ADD[3] += DEXTERITY_ADD
when 3
$PSPEND_ADD[4] += INTELIGENCE_ADD
when 4
$PSPEND_ADD[5] += HP_ADD
when 5
$PSPEND_ADD[6] += SP_ADD
when 6
$PSPEND_POINTS[@actor_ind] += 1
when 7
$PSPEND_POINTS[@actor_ind] += 1
end
@spend.refresh
return
end


if Input.repeat?(Input::LEFT)
unless $PSPEND_POINTS[@actor_ind] < $PSPEND_RET
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.cursor_se)
case @spend.index
when 0
if $PSPEND_ADD[1] <= $ACTORD.str
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[1] -= STRENGTH_ADD
when 1
if $PSPEND_ADD[2] <= $ACTORD.agi
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[2] -= AGILITY_ADD
when 2
if $PSPEND_ADD[3] <= $ACTORD.dex
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[3] -= DEXTERITY_ADD
when 3
if $PSPEND_ADD[4] <= $ACTORD.int
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[4] -= INTELIGENCE_ADD
when 4
if $PSPEND_ADD[5] <= $ACTORD.maxhp
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[5] -= HP_ADD
when 5
if $PSPEND_ADD[6] <= $ACTORD.maxsp
$game_system.se_play($data_system.buzzer_se)
return
end
$PSPEND_ADD[6] -= SP_ADD
when 6
$PSPEND_POINTS[@actor_ind] -= 1
when 7
$PSPEND_POINTS[@actor_ind] -= 1
end
$PSPEND_POINTS[@actor_ind] += 1
@spend.refresh

return
end


if Input.trigger?(Input::C)
case @spend.index
when 6
@spend.refresh(true)
when 7
$ACTORD.str = $PSPEND_ADD[1]
$ACTORD.agi = $PSPEND_ADD[2]
$ACTORD.dex = $PSPEND_ADD[3]
$ACTORD.int = $PSPEND_ADD[4]
$ACTORD.maxhp = $PSPEND_ADD[5]
$ACTORD.maxsp = $PSPEND_ADD[6]
$game_system.se_play($data_system.decision_se)
$scene = Scene_Menu.new
if $PSPEND_POINTS[@actor_ind] == 0
  $PSPEND_ACTORS[@actor_ind] = false
end
$PSPEND_ACTORS[@actor.id - 1] = false
return
end
end
end
end

#End of Part Six - Yipee!!! I made it!

#Part Seven - Save Load part!

class Scene_Save < Scene_File

def write_save_data(file)

characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end

Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)

$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number

Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
Marshal.dump($PSPEND_POINTS,file)
Marshal.dump($PSPEND_ACTORS,file)
Marshal.dump($actor_attr,file)
end
end

# -- And now for the load screen

class Scene_Load < Scene_File

def read_save_data(file)

characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)

$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$PSPEND_POINTS = Marshal.load(file)
$PSPEND_ACTORS = Marshal.load(file)
$actor_attr = Marshal.load(file)

if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end

$game_party.refresh
end
end

#-- END OF SAVE AND LOAD SCREEN

#-- END OF THE SCRIPT

#=======================
# Written by Drago del fato
#=======================

and add this to main if u haven't... >.> (thats what gave the error on my image...)
$fontface = $fonttype = $defaultfontface = $defaultfonttype = "Tahoma"
$fontsize = $defaultfontsize = 22

can't help w/ the CMS cuz it seems a bit is missing... >.>
----Current Games working on----
--Rage O' Delusion - Overall Percentage Finished : 4% -- Expected release... Unknown
--The Other Dimension - Overall Percentage done : 1 - Expected Release : No time soon...
v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^
Feildmaster Productions
Made By One Man Run by the Same...
Making Games for Everyone...
Oh yeah, and everything else web based
For a charge... Of course...

**
Rep: +0/-0Level 88
Thanx for the reply, but that's not the error I get. I attached the image of the error, I did make the changes u told me to, same thing. I don't have the part of the code to access even if not leveled up. Again, thank u for ur time!

***
Rep:
Level 88
Smarter than the average bear
Yeah that happened to me using that level up points, but Im no scripter so I cant tell you what exactly is causing it but I'm pretty sure it's not fog of war or any CMS. I know it wont work with goldenshadow's radio script.

Try putting it below/above other scripts.

**
Rep: +0/-0Level 88
I just noticed that if the Lv up is under the CMS script, I only get an error when loading a saved game. It's in line 654 $PSPEND_POINTS = Marshal.load(file) "EOFError End of file reached" but when Lv up is over the CMS I get the error a posted before when the hero levels up.

***
Rep:
Level 88
Hell... What did I mess up now... I'm Back!
oh yes another thing... the point script needs to be at the top of every script that you add... >.>

(in other words right below Scene_Debug)

also... i'll try to see whats wrong... better yet... think i could get your game files so i can actually see whats going on with it?
----Current Games working on----
--Rage O' Delusion - Overall Percentage Finished : 4% -- Expected release... Unknown
--The Other Dimension - Overall Percentage done : 1 - Expected Release : No time soon...
v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^
Feildmaster Productions
Made By One Man Run by the Same...
Making Games for Everyone...
Oh yeah, and everything else web based
For a charge... Of course...

**
Rep: +0/-0Level 88
"@Lord, if I understood what u tried to make it's disableing the fow when opening the menu and enableing it when it closes, wouldn't that cause the fow of war appear, after the menu closes in a map without fow?(hipotetically) in reality I got an error when calling the menu in a map without fow."

Well... the answer to the hipothetic question is "yes".
For disabling, use Me-s sollution. It's better, because it makes the sript more versatile (for later modifying).

And, as going in he's footsteps, the sollution might go like adding in his code an another branch:
Code: [Select]
if $scene.is_a?(Scene_Map)
$game_map.fow = true
return
end

But i have a bad feeling about this... it's the same thing i told you before, so this might cause the same problems with the maps again...

"Oh, mirror, how do i pity you!
Because when the men look at you, they see only themselves, not the mirror, who you really are..."
- Zelbess, Chrono Cross

**
Rep: +0/-0Level 88
Ok,before I saw your replies, I managed to fix the problems with the point spend menu, I just added the variables used by the point spend in the save of my CMS, "Marshal.dump (@variable, file)" I just added this to the CMS script and it works fine, Im able to save, load, level up, etc. Now the only thing I need I to be able to call the point spend scene, since it doesnt open in my CMS (it doesn't use "status_scene") Do you think I might be able to call it when pressing a button? or if posible when opening the status menu.
PS whowould have thought that I'd start learing a bit about coding with these errors! :lol:
« Last Edit: January 11, 2007, 06:58:49 PM by sanchezinc »

***
Rep:
Level 88
Hell... What did I mess up now... I'm Back!
heh... good job... sure i think i made one before... lets see

*opens up his projects*

Oops. I messed my scripts up now... XD Gona have to re-write them... maybe someone else knows how... (or maybe... make it so you can press a button and it opens the unused status screen...?)
----Current Games working on----
--Rage O' Delusion - Overall Percentage Finished : 4% -- Expected release... Unknown
--The Other Dimension - Overall Percentage done : 1 - Expected Release : No time soon...
v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^
Feildmaster Productions
Made By One Man Run by the Same...
Making Games for Everyone...
Oh yeah, and everything else web based
For a charge... Of course...

**
Rep: +0/-0Level 88
Yeah I think thats my best shot, to call it with a key (I still don't know how to script that) hehe.

Anyone interested in doing this, or finding another solution?

By the way I solved another of my problems, now the menu (CMS) draws itself over the fow, so it's not covered!!! ;D
It was quite easy actualy, I hadn't noticed a parameter called "z", I just raised that value from 201 to 999 and that did the magic!! (I'm getting good at this) j/K "I know nothing except the fact of my ignorance" I'm stll a baby with this

**
Rep: +0/-0Level 88
Bump!, can anyone tell me how to call the default menu using another key (not C)? And if possible to always show the point spend menu.

***
Rep:
Level 88
Hell... What did I mess up now... I'm Back!
hmm... going on the old call screen should be good enough...

on Scene_Map insert this...

if Input.trigger?(Input::A)
    $scene = Scene_Status.new(@status_window.index)
end

that makes it when you press X it opens the default screen... might want to edit that if you don't want all the that is on it...s
----Current Games working on----
--Rage O' Delusion - Overall Percentage Finished : 4% -- Expected release... Unknown
--The Other Dimension - Overall Percentage done : 1 - Expected Release : No time soon...
v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^
Feildmaster Productions
Made By One Man Run by the Same...
Making Games for Everyone...
Oh yeah, and everything else web based
For a charge... Of course...

**
Rep: +0/-0Level 88
Hey, tanx, I tried it, but nothing happend, I placed that in the scene_map just above the (Input::B). But nothing, should it be somewhere else?

***
Rep:
Level 88
Hell... What did I mess up now... I'm Back!
hmm... i think i would only be able to help you if i had the game. Cuz I am no good less I see what all is there. Sorry, maybe you can find someone else to help you... >.>
----Current Games working on----
--Rage O' Delusion - Overall Percentage Finished : 4% -- Expected release... Unknown
--The Other Dimension - Overall Percentage done : 1 - Expected Release : No time soon...
v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^
Feildmaster Productions
Made By One Man Run by the Same...
Making Games for Everyone...
Oh yeah, and everything else web based
For a charge... Of course...

**
Rep: +0/-0Level 88
Hey everyone! I  got all crazy and decided to edit the CMS manually with my limited amount of scriptinf knowledge hehe (don't worry I gave a script backup). I have been testing it and have solved (or at least I think I have) all errors that I havge gotten. Now here is the problem, I don't get an error message anymore, but the game crashes when opening the menu. Maybe someone here can find the problem I'm posting the script here. Remember I use that CMS and the Point pend system to level up.
CMS Part 1
Spoiler for:
Code: [Select]
#=============================================================
# 1-Scene Custom Menu System
#=============================================================
# LegACy 
# Version 1.17b
# 7.29.06
#=============================================================
# This script is a further development of Hydrolic's CMS
# request. I enhance it toward every aspect of a menu system
# so now it all operates in one scene full of animation.
# There's an animated sprite and element wheel features.
# There's also different category for items implemented.
# Now there's enhanced equipment features as well as faceset
# features. Don't forget the icon command feature, too!
# The newest version now has an integrated party swapper!
#
# To put items into different catagory, simply apply
# attributes to them, you can apply more than 1 attributes
# to each item. In default, the attributes are :
# :: 17 > Recovery items
# :: 18 > Weaponry
# :: 19 > Armor
# :: 20 > Accessories
# :: 21 > Key Items
# :: 22 > Miscellanous Items
#
# Faceset pictures should be 'Potrait_', or 'Class_' if you based it
# on actor's class, followed with the ID of the actor. So for Arshes
# it will either 'Potrait_1' or 'Class_1'
#
# For customization, look in LegACy class, further explanation's
# located there.
#
# Special thanks to Hydrolic for the idea, Diego for the
# element wheel, SephirotSpawn for sprite animation, KGC
# for the his AlterEquip script and Squall for his ASM.
#=============================================================

  #==============================================================================
  # ** LegACy's Script Customization (CMS)
  #==============================================================================
  class LegACy
    #--------------------------------------------------------------------------
    # * Custom Scripts Support
    #--------------------------------------------------------------------------
    AMS             = false                       # True if you're using AMS script.
    ATS             = false                       # True if you're using ATS script.
    ABS             = false                       # True if you're using Near's ABS script.
    PREXUS          = false                       # True if you're using Prexus' ABS script.
    #--------------------------------------------------------------------------
    # * Features Customization Constants
    #--------------------------------------------------------------------------
    ANIMATED        = false                # True if you want to have animated chara feature.
    EXTRA_EQUIP     = false                       # True if you want to use Enhanced Equipment feature.
    PARTY_SWAP      = true                        # True if you want to use Party Swapper feature.
    BATTLE_BAR      = false                   # True if you want to have bar for battle system.
    ICON            = true                        # True if you want to have icon on command_window.
    MAX_PARTY       = 4                           # Number of max member in the party.
    SAVE_NUMBER     = 10                          # Number of save slot available
    #--------------------------------------------------------------------------
    # * Item Grouping Customization Constants
    #--------------------------------------------------------------------------
    ITEMS           = [17, 19, 21, 18, 20, 22]    # Attributes ID for Item Catagory in order.
    #--------------------------------------------------------------------------
    # * Display Customization Constants
    #--------------------------------------------------------------------------
    WIN_OPACITY     = 200                         # Opacity of CMS' windows
    WIN_Z           = 999                         # Z value of CMS' windows
    ICON_NAME       = ['menu', 'item']            # Image name for icon, first is for main menu while the second is for item command.
    POTRAIT         = [false, false]              # True if you want to use faceset instead of charset display, first is for front menu while the second is for status window.
    CLASS_POTRAIT   = [false, false]              # True if you want to base the faceset on class instead of actor, first is for front menu while the second is for status window.
    POTRAIT_DIR     = 'Potrait_'                  # Image name for actor-based faceset.
    CLASS_DIR       = 'Class_'                    # Image name for class-based faceset.
    STAT_BAR        = [false, false, true]        # Windows where the stat bar appears.
    BAR_COLOR       = [Color.new(255, 0, 0, 200), # Color for bars.
                      Color.new(255, 255, 0, 200),
                      Color.new(0, 255, 255, 200),
                      Color.new(200, 64, 64, 255),
                      Color.new(64, 128, 64, 255),           
                      Color.new(160, 100, 160, 255),
                      Color.new(128, 128, 200, 255)]
    #--------------------------------------------------------------------------
    # * Element Wheel Customization Constants
    #--------------------------------------------------------------------------
    ELEMENT_NUMBER  = 8                          # Number of elements applied in the element wheel.
    ELEMENTS        = [1, 2, 3, 4, 5 , 6, 7, 8]   # Elements that appear on the element wheel, in order.
  end
 
  #==============================================================================
  # ** Bitmap
  #==============================================================================
  class Bitmap
    def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
      distance = (start_x - end_x).abs + (start_y - end_y).abs
      if end_color == start_color
        for i in 1..distance
          x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
          y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
          if width == 1
            self.set_pixel(x, y, start_color)
           else
            self.fill_rect(x, y, width, width, start_color)
          end
        end
      else
        for i in 1..distance
          x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
          y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
          r = start_color.red   * (distance-i)/distance + end_color.red   * i/distance
          g = start_color.green * (distance-i)/distance + end_color.green * i/distance
          b = start_color.blue  * (distance-i)/distance + end_color.blue  * i/distance
          a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
          if width == 1
            self.set_pixel(x, y, Color.new(r, g, b, a))
          else
            self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
          end
        end
      end
    end
  end

  #==============================================================================
  # ** Game_Actor
  #------------------------------------------------------------------------------
  #  This class handles the actor. It's used within the Game_Actors class
  #  ($game_actors) and refers to the Game_Party class ($game_party).
  #==============================================================================
  class Game_Actor < Game_Battler
    #--------------------------------------------------------------------------
    # * Get Current Experience Points
    #--------------------------------------------------------------------------
    def now_exp
      return @exp - @exp_list[@level]
    end
    #--------------------------------------------------------------------------
    # * Get Needed Experience Points
    #--------------------------------------------------------------------------
    def next_exp
      return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
    end
  end 
 
  #==============================================================================
  # ** Game_Party
  #------------------------------------------------------------------------------
  #  This class handles the party. It includes information on amount of gold
  #  and items. Refer to "$game_party" for the instance of this class.
  #==============================================================================
  class Game_Party
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    attr_accessor   :reserve                   # reserve actors
     #--------------------------------------------------------------------------
    # * Alias Initialization
    #--------------------------------------------------------------------------
    alias legacy_CMS_gameparty_init initialize
     #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      # Create reserve actor array
      @reserve = []
      legacy_CMS_gameparty_init
    end
    #--------------------------------------------------------------------------
    # * Add an Actor
    #     actor_id : actor ID
    #--------------------------------------------------------------------------
    def add_actor(actor_id)
      # Get actor
      actor = $game_actors[actor_id]
      # If the party has less than 4 members and this actor is not in the party
      if @actors.size < LegACy::MAX_PARTY and not @actors.include?(actor)
        # Add actor
        @actors.push(actor)
      else
        @reserve.push(actor)
      end
      # Refresh player
      $game_player.refresh
    end
    #--------------------------------------------------------------------------
    # * Remove Actor
    #     actor_id : actor ID
    #--------------------------------------------------------------------------
    def remove_actor(actor_id)
      # Get actor
      actor = $game_actors[actor_id]
      # Delete actor
      @actors.delete(actor) if @actors.include?(actor)
      @reserve.delete(actor) if @reserve.include?(actor)
      # Refresh player
      $game_player.refresh
    end   
   
  end
 
  #==============================================================================
  # ** Game_Map
  #------------------------------------------------------------------------------
  #  This class handles the map. It includes scrolling and passable determining
  #  functions. Refer to "$game_map" for the instance of this class.
  #==============================================================================
  class Game_Map
    #--------------------------------------------------------------------------
    # * Get Map Name
    #--------------------------------------------------------------------------
    def name
       load_data("Data/MapInfos.rxdata")[@map_id].name
    end 
  end 
 
  #==============================================================================
  # ** Window_Base
  #------------------------------------------------------------------------------
  #  This class is for all in-game windows.
  #==============================================================================
  class Window_Base < Window
    FONT_SIZE          = 16
    GRAPH_SCALINE_COLOR        = Color.new(255, 255, 255, 128)
    GRAPH_SCALINE_COLOR_SHADOW = Color.new(  0,   0,   0, 192)
    GRAPH_LINE_COLOR           = Color.new(255, 255,  64, 255)
    GRAPH_LINE_COLOR_MINUS     = Color.new( 64, 255, 255, 255)
    GRAPH_LINE_COLOR_PLUS      = Color.new(255,  64,  64, 255)   
   
    def draw_actor_element_radar_graph(actor, x, y, radius = 43)     
      cx = x + radius + FONT_SIZE + 48
      cy = y + radius + FONT_SIZE + 32
      for loop_i in 0..LegACy::ELEMENT_NUMBER
        if loop_i != 0
        @pre_x  = @now_x
        @pre_y  = @now_y
        @pre_ex = @now_ex
        @pre_ey = @now_ey
        @color1 = @color2
      end
      if loop_i == LegACy::ELEMENT_NUMBER
        eo = LegACy::ELEMENTS[0]
      else
        eo = LegACy::ELEMENTS[loop_i]
      end
      er = actor.element_rate(eo)
      estr = $data_system.elements[eo]
      @color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
      er = er.abs
      th = Math::PI * (0.5 - 2.0 * loop_i / LegACy::ELEMENT_NUMBER)
      @now_x  = cx + (radius * Math.cos(th)).floor
      @now_y  = cy - (radius * Math.sin(th)).floor
      @now_wx = cx - 6 + ((radius + FONT_SIZE * 3 / 2) * Math.cos(th)).floor - FONT_SIZE
      @now_wy = cy - ((radius + FONT_SIZE * 1 / 2) * Math.sin(th)).floor - FONT_SIZE/2
      @now_vx = cx + ((radius + FONT_SIZE * 8 / 2) * Math.cos(th)).floor - FONT_SIZE
       @now_vy = cy - ((radius + FONT_SIZE * 3 / 2) * Math.sin(th)).floor - FONT_SIZE/2
       @now_ex = cx + (er*radius/100 * Math.cos(th)).floor
       @now_ey = cy - (er*radius/100 * Math.sin(th)).floor
       if loop_i == 0
         @pre_x  = @now_x
         @pre_y  = @now_y
         @pre_ex = @now_ex
         @pre_ey = @now_ey
         @color1 = @color2
       else       
       end
       next if loop_i == 0
       self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
       self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
       self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
       self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
       self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
       self.contents.font.color = system_color
       self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*3.1, FONT_SIZE, estr, 1)
       self.contents.font.color = Color.new(255,255,255,128)
       self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, er.to_s + "%", 2)
       self.contents.font.color = normal_color
     end
   end
    #--------------------------------------------------------------------------
    # Draw Stat Bar
    #     actor  : actor
    #     x      : bar x-coordinate
    #     y      : bar y-coordinate
    #     stat   : stat to be displayed
    #--------------------------------------------------------------------------
    def draw_LegACy_bar(actor, x, y, stat, width = 156, height = 7)
      bar_color = Color.new(0, 0, 0, 255)
      end_color = Color.new(255, 255, 255, 255)
      max = 999
      case stat
      when "hp"
        bar_color = Color.new(150, 0, 0, 255)
        end_color = Color.new(255, 255, 60, 255)
        min = actor.hp
        max = actor.maxhp
      when "sp"
        bar_color = Color.new(0, 0, 155, 255)
        end_color = Color.new(255, 255, 255, 255)
        min = actor.sp
        max = actor.maxsp
      when "exp"
        bar_color = Color.new(0, 155, 0, 255)
        end_color = Color.new(255, 255, 255, 255)
        unless actor.level == $data_actors[actor.id].final_level
          min = actor.now_exp
          max = actor.next_exp
        else
          min = 1
          max = 1
        end 
      when 'atk'
        bar_color = LegACy::BAR_COLOR[0]
        min = actor.atk
      when 'pdef'
        bar_color = LegACy::BAR_COLOR[1]
        min = actor.pdef
      when 'mdef'
        bar_color = LegACy::BAR_COLOR[2]
        min = actor.mdef
      when 'str'
        bar_color = LegACy::BAR_COLOR[3]
        min = actor.str
      when 'dex'
        bar_color = LegACy::BAR_COLOR[4]
        min = actor.dex
      when 'agi'
        bar_color = LegACy::BAR_COLOR[5]
        min = actor.agi
      when 'int'
        bar_color = LegACy::BAR_COLOR[6]
        min = actor.int
      end
      max = 1 if max == 0
      # Draw Border
      for i in 0..height
        self.contents.fill_rect(x + i, y + height - i, width + 1, 1,
        Color.new(50, 50, 50, 255))
      end
      # Draw Background
      for i in 1..(height - 1)
        r = 100 * (height - i) / height + 0 * i / height
        g = 100 * (height - i) / height + 0 * i / height
        b = 100 * (height - i) / height + 0 * i / height
        a = 255 * (height - i) / height + 255 * i / height
        self.contents.fill_rect(x + i, y + height - i, width, 1,
        Color.new(r, b, g, a))
      end
      # Draws Bar
      for i in 1..( (min.to_f / max.to_f) * width - 1)
        for j in 1..(height - 1)
          r = bar_color.red * (width - i) / width + end_color.red * i / width
          g = bar_color.green * (width - i) / width + end_color.green * i / width
          b = bar_color.blue * (width - i) / width + end_color.blue * i / width
          a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
          self.contents.fill_rect(x + i + j, y + height - j, 1, 1,
          Color.new(r, g, b, a))
        end
      end
      case stat
      when "hp"
        draw_actor_hp(actor, x - 1, y - 18)
      when "sp"
        draw_actor_sp(actor, x - 1, y - 18)
      when "exp"
        draw_actor_exp(actor, x - 1, y - 18)
      end
    end
    #--------------------------------------------------------------------------
    # * Draw Sprite
    #--------------------------------------------------------------------------
    def draw_LegACy_sprite(x, y, name, hue, frame)
      bitmap = RPG::Cache.character(name, hue)
      cw = bitmap.width / 4
      ch = bitmap.height / 4
      # Current Animation Slide
      case frame
        when 0 ;b = 0
        when 1 ;b = cw
        when 2 ;b = cw * 2
        when 3 ;b = cw * 3
      end
      # Bitmap Rectange
      src_rect = Rect.new(b, 0, cw, ch)
      # Draws Bitmap     
      self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
    end
    #--------------------------------------------------------------------------
    # * Get Upgrade Text Color
    #--------------------------------------------------------------------------
    def up_color
      return Color.new(74, 210, 74)
    end
    #--------------------------------------------------------------------------
    # * Get Downgrade Text Color
    #--------------------------------------------------------------------------
    def down_color
      return Color.new(170, 170, 170)
    end
    #--------------------------------------------------------------------------
    # * Draw Potrait
    #     actor : actor
    #     x     : draw spot x-coordinate
    #     y     : draw spot y-coordinate
    #--------------------------------------------------------------------------
    def draw_actor_potrait(actor, x, y, classpotrait = false, width = 96, height = 96)
      classpotrait ? bitmap = RPG::Cache.picture(LegACy::CLASS_DIR + actor.class_id.to_s) :
        bitmap = RPG::Cache.picture(LegACy::CLASS_DIR + actor.id.to_s)
      src_rect = Rect.new(0, 0, width, height)
      self.contents.blt(x, y, bitmap, src_rect)
    end
    #--------------------------------------------------------------------------
    # * Draw parameter
    #     actor : actor
    #     x     : draw spot x-coordinate
    #     y     : draw spot y-coordinate
    #     type  : parameter type
    #------------------------------------------------------------------------
    def draw_actor_parameter(actor, x, y, type, width = 120, bar = false)
      case type
      when 0
        parameter_name = $data_system.words.atk
        parameter_value = actor.atk
        stat = 'atk'
      when 1
        parameter_name = $data_system.words.pdef
        parameter_value = actor.pdef
        stat = 'pdef'
      when 2
        parameter_name = $data_system.words.mdef
        parameter_value = actor.mdef
        stat = 'mdef'
      when 3
        parameter_name = $data_system.words.str
        parameter_value = actor.str
        stat = 'str'
      when 4
        parameter_name = $data_system.words.dex
        parameter_value = actor.dex
        stat = 'dex'
      when 5
        parameter_name = $data_system.words.agi
        parameter_value = actor.agi
        stat = 'agi'
      when 6
        parameter_name = $data_system.words.int
        parameter_value = actor.int
        stat = 'int'
      when 7
        parameter_name = "Evasion"
        parameter_value = actor.eva
        stat = 'eva'
      end
      if bar == true && stat != 'eva'
        draw_LegACy_bar(actor, x + 16, y + 21, stat, width - 16, 5)
      end
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 120, 32, parameter_name)
      self.contents.font.color = normal_color
      self.contents.draw_text(x + width, y, 36, 32, parameter_value.to_s, 2)
    end
  end

  #==============================================================================
  # ** Window_NewCommand
  #------------------------------------------------------------------------------
  #  This window deals with general command choices.
  #==============================================================================

  class Window_NewCommand < Window_Selectable
    #--------------------------------------------------------------------------
    # * Object Initialization
    #     width    : window width
    #     commands : command text string array
    #--------------------------------------------------------------------------
    def initialize(width, commands, icon = nil)
      # Compute window height from command quantity
      super(0, 0, width, commands.size / 3 * 32 + 32)
      @item_max = commands.size
      @commands = commands
      @icon = icon
      @column_max = 3
      self.contents = Bitmap.new(width - 32, @item_max/3 * 32)
      refresh
      self.index = 0
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      for i in 0...@item_max
        draw_item(i, normal_color)
      end
    end
    #--------------------------------------------------------------------------
    # * Draw Item
    #     index : item number
    #     color : text color
    #--------------------------------------------------------------------------
    def draw_item(index, color)
      self.contents.font.color = color
      self.contents.font.size = 20
      self.contents.font.bold = true
      rect = Rect.new((109 * (index / 2)), 32 * (index % 2), self.width / @column_max - 12, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      unless @icon == nil
        bitmap = RPG::Cache.icon(@icon + index.to_s)
        self.contents.blt((106 * (index / 2)), 32 * (index % 2) + 4, bitmap, Rect.new(0, 0, 24, 24))
      end     
      self.contents.draw_text(rect, @commands[index])
    end
    #--------------------------------------------------------------------------
    # * Disable Item
    #     index : item number
    #--------------------------------------------------------------------------
    def disable_item(index)
      draw_item(index, disabled_color)
    end
  end

  #==============================================================================
  # ** Window_NewMenuStatus
  #------------------------------------------------------------------------------
  #  This window displays party member status on the menu screen.
  #==============================================================================

  class Window_NewMenuStatus < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      $game_party.actors.size < 4 ? i = 14 : i = 0
      $game_party.actors.size == 1 ? i = 24 : i = i
      super(0, 0, 480, ($game_party.actors.size * 84) + i)
      self.contents = Bitmap.new(width - 32, height - 32)
      refresh
      self.active = false
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      for i in 0...$game_party.actors.size
        x = 4
        y = (i * 76) - 6
        actor = $game_party.actors[i]
        self.contents.font.size = 19
        self.contents.font.bold = true
        draw_actor_class(actor, x, y - 1)
        draw_actor_state(actor, x + 160, y - 1)
        self.contents.font.size = 15
        draw_actor_parameter(actor, x, y + 14, 0, 120, LegACy::STAT_BAR[0])
        draw_actor_parameter(actor, x, y + 29, 1, 120, LegACy::STAT_BAR[0])
        draw_actor_parameter(actor, x, y + 44, 2, 120, LegACy::STAT_BAR[0])
        draw_actor_parameter(actor, x, y + 59, 3, 120, LegACy::STAT_BAR[0])
        draw_actor_parameter(actor, x + 240, y + 14, 4, 120, LegACy::STAT_BAR[0])
        draw_actor_parameter(actor, x + 240, y + 29, 5, 120, LegACy::STAT_BAR[0])
        draw_actor_parameter(actor, x + 240, y + 44, 6, 120, LegACy::STAT_BAR[0])
        draw_LegACy_bar(actor, x + 240, y + 75, 'exp')
      end
    end   
  end

  #==============================================================================
  # ** Window_Actor
  #------------------------------------------------------------------------------
  #  This window displays party member status on the menu screen.
  #==============================================================================

  class Window_Actor < Window_Selectable
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    attr_accessor :party                    # party switcher
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      $game_party.actors.size < 4 ? i = 14 : i = 0     
      $game_party.actors.size == 1 ? i = 24 : i = i
      super(0, 0, 160, ($game_party.actors.size * 84) + i)
      self.contents = Bitmap.new(width - 32, height - 32)
      @frame = 0
      @party = false
      refresh
      self.active = false
      self.index = -1
    end   
    #--------------------------------------------------------------------------
    # * Returning Party Swapping State
    #--------------------------------------------------------------------------
    def party
      return @party
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      #@party ? @item_max = $game_party.actors.size : @item_max = 4
      @item_max = $game_party.actors.size # if $game_party.actors.size <= 4
      $game_party.actors.size < 4 ? i = 14 : i = 0     
      $game_party.actors.size == 1 ? i = 24 : i = i
      self.contents = Bitmap.new(width - 32, (@item_max * 84) + i - 32)
      for i in 0...@item_max
        x = 4
        y = (i * 77) - 12
        actor = $game_party.actors[i]
        self.contents.font.size = 17
        self.contents.font.bold = true
        LegACy::POTRAIT[0] ? draw_actor_potrait(actor, x, y - 1, LegACy::CLASS_POTRAIT[0]) : draw_LegACy_sprite(x + 20,
        y + 57, actor.character_name, actor.character_hue, @frame)
        draw_actor_name(actor, x + 52, y + 6)
        draw_actor_level(actor, x + 52, y + 24)
        draw_LegACy_bar(actor, x - 3, y + 60, 'hp', 120)
        draw_LegACy_bar(actor, x - 3, y + 75, 'sp', 120)
      end
    end
    #--------------------------------------------------------------------------
    # * Cursor Rectangle Update
    #--------------------------------------------------------------------------
    def update_cursor_rect       
      @index > 3 ? self.oy = (@index - 3) * 77 : self.oy = 0
      if @index < 0
        self.cursor_rect.empty
      else
        self.cursor_rect.set(-4, (@index * 77) - 2 - self.oy, self.width - 24, 77)
      end
    end
    #--------------------------------------------------------------------------
    # Frame Update
    #--------------------------------------------------------------------------
    def frame_update     
      @frame == 3 ? @frame = 0 : @frame += 1
      refresh
    end
  end
 
  #=====================
  #** Window_Level
  #----------------------------
  #Window for level up
  #======================================
 
  class Window_Level < Window_Selectable
   
    def initialize(actor)
      super(0, 96, 480, 336)
      commands = [1,2,3,4,5,6,7,8]
      @item_max = commands.size
      @commands = commands
      @spend = Window_Level.new(@actor_ind)
      self.contents = Bitmap.new(width - 28,height - 28)
      self.contents.font.name = $defaultfonttype # "All Commands" window font
      self.contents.font.size = ($defaultfontsize - 4)
      @actor = actor
      @y = 10
      $PSPEND_RET = $PSPEND_POINTS[@actor1.id - 1]
      refresh(true)
      self.index = 0
    end
    def refresh(ret = false)
      self.contents.clear
      @y = 10
      if ret
        $PSPEND_ADD[1] = @actor.str
        $PSPEND_ADD[2] = @actor.agi
        $PSPEND_ADD[3] = @actor.dex
        $PSPEND_ADD[4] = @actor.int
        $PSPEND_ADD[5] = @actor.maxhp
        $PSPEND_ADD[6] = @actor.maxsp
        $PSPEND_POINTS[@actor.id - 1] = $PSPEND_RET
        ret = false
      end
      draw_actor_battler(@actor,20 + 55,@y + 220)
      draw_actor_name(@actor,20 + 43,@y + 220)
      cx = self.contents.text_size(PSPEND_SPTEXT + $PSPEND_POINTS[@actor.id - 1].to_s).width
      self.contents.draw_text(32,@y + 248,cx,28,PSPEND_SPTEXT + $PSPEND_POINTS[@actor.id - 1].to_s)
      cx = self.contents.text_size(DESC_TEXT).width
      self.contents.draw_text(32,self.height - 18 - 40,cx,28,DESC_TEXT)
      @y += 150
      @x = 200
      for i in 0...@item_max
        draw_item(i, normal_color)
      end
    end
    def draw_item(index, color)
      if $PSPEND_POINTS[@actor.id - 1] <= 0
        self.contents.font.color = disabled_color
      else
        self.contents.font.color = color
      end
      rect = Rect.new(@x, 28 * index, self.contents.width - 8, 28)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      case index
      when 0
        self.contents.draw_text(rect, $data_system.words.str)
        cx = self.contents.text_size(@actor.str.to_s + " > " + $PSPEND_ADD[1].to_s).width
        self.contents.draw_text(self.width - 32 - cx,28 * index,cx ,28 ,@actor.str.to_s + " > " + $PSPEND_ADD[1].to_s)
      when 1
        self.contents.draw_text(rect, $data_system.words.agi )
        cx = self.contents.text_size(@actor.agi.to_s + " > " + $PSPEND_ADD[2].to_s).width
        self.contents.draw_text(self.width - 32 - cx,28 * index,cx ,28 ,@actor.agi.to_s + " > " + $PSPEND_ADD[2].to_s)
      when 2
        self.contents.draw_text(rect, $data_system.words.dex )
        cx = self.contents.text_size( @actor.dex.to_s + " > " + $PSPEND_ADD[3].to_s).width
        self.contents.draw_text(self.width - 32 - cx,28 * index,cx ,28 , @actor.dex.to_s + " > " + $PSPEND_ADD[3].to_s)
      when 3
        self.contents.draw_text(rect, $data_system.words.int )
        cx = self.contents.text_size(@actor.int.to_s + " > " + $PSPEND_ADD[4].to_s).width
        self.contents.draw_text(self.width - 32 - cx,28 * index,cx ,28 ,@actor.int.to_s + " > " + $PSPEND_ADD[4].to_s)
      when 4
        self.contents.draw_text(rect, $data_system.words.hp )
        cx = self.contents.text_size( @actor.maxhp.to_s + " > " + $PSPEND_ADD[5].to_s).width
        self.contents.draw_text(self.width - 32 - cx,28 * index,cx ,28 , @actor.maxhp.to_s + " > " + $PSPEND_ADD[5].to_s)
      when 5
        self.contents.draw_text(rect, $data_system.words.sp )
        cx = self.contents.text_size(@actor.maxsp.to_s + " > " + $PSPEND_ADD[6].to_s).width
        self.contents.draw_text(self.width - 32 - cx,28 * index,cx ,28 ,@actor.maxsp.to_s + " > " + $PSPEND_ADD[6].to_s)
      when 6
        self.contents.font.color = color
        self.contents.draw_text(rect,PSPEND_B1)
      when 7
        self.contents.font.color = color
        self.contents.draw_text(rect,PSPEND_B2)
      end
    end
    def disable_item(index)
      draw_item(index, disabled_color)
    end
    def update_cursor_rect
      if @index < 0
        self.cursor_rect.empty
        return
      end
      row = @index / @column_max
      if row < self.top_row
        self.top_row = row
      end
      if row > self.top_row + (self.page_row_max - 1)
        self.top_row = row - (self.page_row_max - 1)
      end
      cursor_width = self.width / @column_max - 28
      x = @index % @column_max * (cursor_width + 28)
      y = @index / @column_max * 28 - self.oy
      self.cursor_rect.set(@x - 10, y, self.width - @x - 17, 28)
    end
    def update_help
      @help_window.set_text(PSPEND_HELP_TEXT[@spend.index])
    end
  end
  #############################################
   
 
  #==============================================================================
  # ** Window_Stat
  #------------------------------------------------------------------------------
  #  This window displays play time on the menu screen.
  #==============================================================================

  class Window_Stat < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      super(0, 0, 320, 96)
      self.contents = Bitmap.new(width - 32, height - 32)
      refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      self.contents.font.color = system_color
      self.contents.font.size = 18
      self.contents.font.bold = true
      @total_sec = Graphics.frame_count / Graphics.frame_rate
      hour = @total_sec / 60 / 60
      min = @total_sec / 60 % 60
      sec = @total_sec % 60
      text = sprintf("%02d:%02d:%02d", hour, min, sec)
      self.contents.draw_text(4, -4, 120, 32, "Play Time")
      cx = contents.text_size($data_system.words.gold).width
      self.contents.draw_text(4, 18, 120, 32, "Step Count")
      self.contents.draw_text(4, 38, cx, 32, $data_system.words.gold, 2)
      self.contents.font.color = normal_color     
      if LegACy::ATS
        self.contents.draw_text(144, -4, 120, 32, $ats.clock, 2)
      else
        self.contents.draw_text(144, -4, 120, 32, text, 2)
      end
      self.contents.draw_text(144, 18, 120, 32, $game_party.steps.to_s, 2)
      self.contents.draw_text(144, 40, 120, 32, $game_party.gold.to_s, 2)
    end
    #--------------------------------------------------------------------------
    # * Frame Update
    #--------------------------------------------------------------------------
    def update
      super
      if Graphics.frame_count / Graphics.frame_rate != @total_sec
        refresh
      end
    end
  end
  #==============================================================================
  # ** Window_Location
  #------------------------------------------------------------------------------
  #  This window displays current map name.
  #==============================================================================
  
  class Window_Location < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      super(0, 0, 640, 48)
      self.contents = Bitmap.new(width - 32, height - 32)
      refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      self.contents.font.color = system_color  
      self.contents.font.bold = true
      self.contents.font.size = 20
      self.contents.draw_text(4, -4, 120, 24, "Location")
      self.contents.font.color = normal_color
      self.contents.draw_text(170, -4, 400, 24, $game_map.name.to_s, 2)
    end    
  end
  
  #==============================================================================
  # ** Window_NewHelp
  #------------------------------------------------------------------------------
  #  This window shows skill and item explanations along with actor status.
  #==============================================================================

  class Window_NewHelp < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      super(0, 0, 640, 48)
      self.contents = Bitmap.new(width - 32, height - 32)
    end
    #--------------------------------------------------------------------------
    # * Set Text
    #  text  : text string displayed in window
    #  align : alignment (0..flush left, 1..center, 2..flush right)
    #--------------------------------------------------------------------------
    def set_text(text, align = 0)
      self.contents.font.bold = true
      self.contents.font.size = 20
      # If at least one part of text and alignment differ from last time
      if text != @text or align != @align
        # Redraw text
        self.contents.clear
        self.contents.font.color = normal_color
        self.contents.draw_text(4, -4, self.width - 40, 24, text, align)
        @text = text
        @align = align
        @actor = nil
      end
      self.visible = true
    end
  end

  #==============================================================================
  # ** Window_NewItem
  #------------------------------------------------------------------------------
  #  This window displays items in possession on the item and battle screens.
  #==============================================================================

  class Window_NewItem < Window_Selectable
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      super(0, 96, 480, 336)
      @column_max = 2
      @attribute = LegACy::ITEMS[0]
      refresh
      self.index = 0
      self.active = false
    end
    #--------------------------------------------------------------------------
    # * Get Item
    #--------------------------------------------------------------------------
    def item
      return @data[self.index]
    end
    #--------------------------------------------------------------------------
    # * Updates Window With New Item Type
    #     attribute : new item type
    #--------------------------------------------------------------------------
    def update_item(attribute)
      @attribute = attribute
      refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      if self.contents != nil
        self.contents.dispose
        self.contents = nil
      end
      @data = []
      # Add item
      for i in 1...$data_items.size
        if $game_party.item_number(i) > 0 and
          $data_items[i].element_set.include?(@attribute)
          @data.push($data_items[i])
        end
      end
      # Also add weapons and armors
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0 and
          $data_weapons[i].element_set.include?(@attribute)
          @data.push($data_weapons[i])
        end
      end
     for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0 and
          $data_armors[i].guard_element_set.include?(@attribute)
          @data.push($data_armors[i])
        end
      end
      # If item count is not 0, make a bit map and draw all items
      @item_max = @data.size
      if @item_max > 0
        self.contents = Bitmap.new(width - 32, row_max * 32)
        for i in 0...@item_max
          draw_item(i)
        end
      end
    end
    #--------------------------------------------------------------------------
    # * Draw Item
    #     index : item number
    #--------------------------------------------------------------------------
    def draw_item(index)
      item = @data[index]
      case item
      when RPG::Item
        number = $game_party.item_number(item.id)
      when RPG::Weapon
        number = $game_party.weapon_number(item.id)
      when RPG::Armor
        number = $game_party.armor_number(item.id)
      end
      if item.is_a?(RPG::Item) and
         $game_party.item_can_use?(item.id)
        self.contents.font.color = normal_color
      else
        self.contents.font.color = disabled_color
      end
      x = 4 + index % 2 * (208 + 32)
      y = index / 2 * 32
      rect = Rect.new(x, y, self.width / @column_max - 32, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      bitmap = RPG::Cache.icon(item.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.draw_text(x + 28, y, 132, 32, item.name, 0)
      self.contents.draw_text(x + 160, y, 16, 32, ":", 1)
      self.contents.draw_text(x + 176, y, 24, 32, number.to_s, 2)
    end
    #--------------------------------------------------------------------------
    # * Help Text Update
    #--------------------------------------------------------------------------
    def update_help
      @help_window.set_text(self.item == nil ? "" : self.item.description)
    end
  end
  
« Last Edit: January 17, 2007, 09:17:33 PM by sanchezinc »

**
Rep: +0/-0Level 88
CMS Part 2
Spoiler for:
Code: [Select]
  #==============================================================================
  # ** Window_NewSkill
  #------------------------------------------------------------------------------
  #  This window displays usable skills on the skill screen.
  #==============================================================================

  class Window_NewSkill < Window_Selectable
    #--------------------------------------------------------------------------
    # * Object Initialization
    #     actor : actor
    #--------------------------------------------------------------------------
    def initialize(actor)
      super(0, 96, 480, 336)
      @actor = actor
      @column_max = 2
      refresh
      self.index = 0
      self.active = false     
    end
    #--------------------------------------------------------------------------
    # * Acquiring Skill
    #--------------------------------------------------------------------------
    def skill
      return @data[self.index]
    end
    #--------------------------------------------------------------------------
    # * Updates Window With New Actor
    #     actor : new actor
    #--------------------------------------------------------------------------
    def update_actor(actor)
      @actor = actor
      refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      if self.contents != nil
        self.contents.dispose
        self.contents = nil
      end
      @data = []
      for i in 0...@actor.skills.size
        skill = $data_skills[@actor.skills[i]]
        if skill != nil
          @data.push(skill)
        end
      end
      # If item count is not 0, make a bit map and draw all items
      @item_max = @data.size
      if @item_max > 0
        self.contents = Bitmap.new(width - 32, row_max * 32)
        for i in 0...@item_max
          LegACy::PREXUS ? draw_prexus_item(i) : draw_item(i)
        end
      end
    end
    #--------------------------------------------------------------------------
    # * Draw Item
    #     index : item number
    #--------------------------------------------------------------------------
    def draw_item(index)
      skill = @data[index]
      if @actor.skill_can_use?(skill.id)
        self.contents.font.color = normal_color
      else
        self.contents.font.color = disabled_color
      end
      x = 4 + index % 2 * (208 + 32)
      y = index / 2 * 32
      rect = Rect.new(x, y, self.width / @column_max - 32, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      bitmap = RPG::Cache.icon(skill.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.draw_text(x + 28, y, 124, 32, skill.name, 0)
      self.contents.draw_text(x + 152 , y, 48, 32, skill.sp_cost.to_s, 2)
    end
    #--------------------------------------------------------------------------
    # * Draw Item (For Prexus ABS)
    #     index : item number
    #--------------------------------------------------------------------------
    def draw_prexus_item(index)
      skill = @data[index]
      if @actor.skill_can_use?(skill.id)
        if $ABS.player.abs.hot_key.include?(skill.id)
          self.contents.font.color = Color.new(0, 225, 0, 255)
        else
          self.contents.font.color = normal_color
        end
      else
        if $ABS.player.abs.hot_key.include?(skill.id)
          self.contents.font.color = Color.new(0, 225, 0, 160)
        else
          self.contents.font.color = disabled_color
        end
      end
      x = 4 + index % 2 * (208 + 32)
      y = index / 2 * 32
      rect = Rect.new(x, y, self.width / @column_max - 32, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      bitmap = RPG::Cache.icon(skill.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.draw_text(x + 28, y, 124, 32, skill.name, 0)
      self.contents.draw_text(x + 152 , y, 48, 32, skill.sp_cost.to_s, 2)
    end
    #--------------------------------------------------------------------------
    # * Help Text Update
    #--------------------------------------------------------------------------
    def update_help
      @help_window.set_text(self.skill == nil ? "" : self.skill.description)
    end
  end
 
  #==============================================================================
  # ** Window_Hotkey
  #------------------------------------------------------------------------------
  #  This window displays the skill shortcut
  #==============================================================================
 
  class Window_Hotkey < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize
      super(0, 336, 480, 96)
      self.contents = Bitmap.new(width - 32, height - 32)
      refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      self.contents.font.size = 18
      self.contents.font.bold = true
      self.contents.font.color = system_color
      self.contents.draw_text(4, 0, 32, 32, 'H')
      self.contents.draw_text(4, 32, 32, 32, 'J')
      self.contents.draw_text(228, 0, 32, 32, 'K')
      self.contents.draw_text(228, 32, 32, 32, 'L')
      self.contents.font.color = normal_color
      for i in 0...4
        if ABS.skill_key[i] == nil
          self.contents.draw_text((i / 2 * 224) + 54, 32 * (i % 2), 124, 32, 'Not assigned')
          next
        end       
        skill = $data_skills[ABS.skill_key[i + 1]]       
        bitmap = RPG::Cache.icon(skill.icon_name)
        self.contents.blt((i / 2 * 224) + 26, (32 * (i % 2)) + 4, bitmap, Rect.new(0, 0, 24, 24))
        self.contents.draw_text((i / 2 * 224) + 54, 32 * (i % 2), 124, 32, skill.name)
        self.contents.draw_text((i / 2 * 224) + 178, 32 * (i % 2), 32, 32, skill.sp_cost.to_s, 2)
      end
    end
  end

  #==============================================================================
  # ** Window_EquipStat
  #------------------------------------------------------------------------------
  #  This window displays actor parameter changes on the equipment screen.
  #==============================================================================
  class Window_EquipStat < Window_Base
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    attr_accessor :changes
    attr_accessor :mode
    #--------------------------------------------------------------------------
    # * Object Initialization
    #     actor : actor
    #--------------------------------------------------------------------------
    def initialize(actor)
      super(0, 96, 240, 336)
      self.contents = Bitmap.new(width - 32, height - 32)
      @actor = actor   
      @changes = [0, 0, 0, 0, 0, 0, 0, 0]
      @mode = 0
      @elem_text = ""
      @stat_text = ""
      refresh
    end
    #--------------------------------------------------------------------------
    # * Updates Window With New Actor
    #     actor : new actor
    #--------------------------------------------------------------------------
    def update_actor(actor)
      @actor = actor
      refresh
    end 
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      self.contents.font.size = 18
      self.contents.font.bold = true
      for i in 0..7
        draw_actor_parameter(@actor, 16, (i * 20) - 8, i, 96, LegACy::STAT_BAR[1])
      end     
      self.contents.font.color = system_color
      oldelem_text = ""
      oldstat_text = ""
      if @mode == 0
        item = $data_weapons[@actor.weapon_id]
        if item != nil
          more = false
          for i in item.element_set
            next if i == LegACy::ITEMS[0] || i == LegACy::ITEMS[1] ||
              i == LegACy::ITEMS[2] || i == LegACy::ITEMS[3] ||
              i == LegACy::ITEMS[4] || i == LegACy::ITEMS[5]
            oldelem_text += ", " if more
            oldelem_text += $data_system.elements[i].to_s
            more = true
          end       
          more = false
          for i in item.plus_state_set
            oldstat_text += ", " if more
            oldstat_text += $data_states[i].name
            more = true
          end
        else
          oldelem_text = ""
          oldstat_text = ""
        end
      else
        item = $data_armors[eval("@actor.armor#{mode}_id")]
        if item != nil
          more = false
          for i in item.guard_element_set
           next if i == LegACy::ITEMS[0] || i == LegACy::ITEMS[1] ||
              i == LegACy::ITEMS[2] || i == LegACy::ITEMS[3] ||
              i == LegACy::ITEMS[4] || i == LegACy::ITEMS[5]
            oldelem_text += ", " if more
            oldelem_text += $data_system.elements[i].to_s
            more = true
          end
          more = false
          for i in item.guard_state_set
            oldstat_text += ", " if more
            oldstat_text += $data_states[i].name
            more = true
          end
        else
          oldelem_text = ""
          oldstat_text = ""
        end
      end
      if @mode == 0
        self.contents.draw_text(4, 176, 200, 32, "Elemental Attack:")
        self.contents.draw_text(4, 240, 200, 32, "Status Attack:")
      else     
        self.contents.draw_text(4, 176, 200, 32, "Elemental Defense:")
        self.contents.draw_text(4, 240, 200, 32, "Status Defense:")
      end       
      self.contents.font.color = normal_color
      self.contents.draw_text(24, 194, 220, 32, oldelem_text)
      self.contents.draw_text(24, 258, 220, 32, oldstat_text)
      if @elem_text != ""
        self.contents.draw_text(24, 218, 220, 32, @elem_text)
      end
      if @stat_text != ""
        self.contents.draw_text(24, 282, 220, 32, @stat_text)
      end
      if @new_atk != nil
        self.contents.font.color = system_color
        self.contents.draw_text(152, -8, 32, 32, "»»", 1)
        if @changes[0] == 0
          self.contents.font.color = normal_color
        elsif @changes[0] == -1
          self.contents.font.color = down_color
        else
          self.contents.font.color = up_color
        end
        self.contents.draw_text(176, -8, 32, 32, @new_atk.to_s, 2)
      end
      if @new_pdef != nil
        self.contents.font.color = system_color
        self.contents.draw_text(152, 12, 32, 32, "»»", 1)
        if @changes[1] == 0
          self.contents.font.color = normal_color
        elsif @changes[1] == -1
          self.contents.font.color = down_color
        else
          self.contents.font.color = up_color
        end
        self.contents.draw_text(176, 12, 32, 32, @new_pdef.to_s, 2)
      end
      if @new_mdef != nil
        self.contents.font.color = system_color
        self.contents.draw_text(152, 32, 32, 32, "»»", 1)
        if @changes[2] == 0
          self.contents.font.color = normal_color
        elsif @changes[2] == -1
          self.contents.font.color = down_color
        else
          self.contents.font.color = up_color
        end
        self.contents.draw_text(176, 32, 32, 32, @new_mdef.to_s, 2)
      end
      if @new_str != nil
        self.contents.font.color = system_color
        self.contents.draw_text(152, 52, 32, 32, "»»", 1)
        if @changes[3] == 0
          self.contents.font.color = normal_color
        elsif @changes[3] == -1
          self.contents.font.color = down_color
        else
          self.contents.font.color = up_color
        end
        self.contents.draw_text(176, 52, 32, 32, @new_str.to_s, 2)
      end
       if @new_dex != nil
        self.contents.font.color = system_color
        self.contents.draw_text(152, 72, 32, 32, "»»", 1)
        if @changes[4] == 0
          self.contents.font.color = normal_color
        elsif @changes[4] == -1
          self.contents.font.color = down_color
        else
          self.contents.font.color = up_color
        end
        self.contents.draw_text(176, 72, 32, 32, @new_dex.to_s, 2)
      end
        if @new_agi != nil
        self.contents.font.color = system_color
        self.contents.draw_text(152, 92, 32, 32, "»»", 1)
        if @changes[5] == 0
          self.contents.font.color = normal_color
        elsif @changes[5] == -1
          self.contents.font.color = down_color
        else
          self.contents.font.color = up_color
        end
        self.contents.draw_text(176, 92, 32, 32, @new_agi.to_s, 2)
      end
      if @new_int != nil
        self.contents.font.color = system_color
        self.contents.draw_text(152, 112, 32, 32, "»»", 1)
        if @changes[6] == 0
          self.contents.font.color = normal_color
        elsif @changes[6] == -1
          self.contents.font.color = down_color
        else
          self.contents.font.color = up_color
        end
        self.contents.draw_text(176, 112, 32, 32, @new_int.to_s, 2)
      end     
      if @new_eva != nil
        self.contents.font.color = system_color
        self.contents.draw_text(152, 132, 32, 32, "»»", 1)
        if @changes[7] == 0
          self.contents.font.color = normal_color
        elsif @changes[7] == -1
          self.contents.font.color = down_color
        else
          self.contents.font.color = up_color
        end
        self.contents.draw_text(176, 132, 32, 32, @new_eva.to_s, 2)
      end
    end
    #--------------------------------------------------------------------------
    # * Set parameters after changing equipment
    #     new_atk  : attack power after changing equipment
    #     new_pdef : physical defense after changing equipment
    #     new_mdef : magic defense after changing equipment
    #     new_str  : strength after changing equipment
    #     new_dex  : dexterity after changing equipment
    #     new_agi  : agility after changing equipment
    #     new_int  : inteligence after changing equipment
    #     new_eva  : evasion after changing equipment
    #--------------------------------------------------------------------------
    def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex,
      new_agi, new_int, new_eva, elem_text, stat_text)
      flag = false
      if new_atk != @new_atk || new_pdef != @new_pdef || new_str != @new_str ||
        new_mdef != @new_mdef || new_dex != @new_dex || new_agi != @new_agi ||
        new_eva != @new_eva || elem_text != @elem_text || stat_text != @stat_text
        flag = true
      end
      @new_atk = new_atk
      @new_pdef = new_pdef
      @new_mdef = new_mdef
      @new_str = new_str
      @new_dex = new_dex
      @new_agi = new_agi
      @new_int = new_int
      @new_eva = new_eva
      @elem_text = elem_text
      @stat_text = stat_text
      if flag
        refresh
      end
    end     
  end
 
  #==============================================================================
  # ** Window_Equipment
  #------------------------------------------------------------------------------
  #  This window displays items the actor is currently equipped with on the
  #  equipment screen.
  #==============================================================================

  class Window_Equipment < Window_Selectable
    #--------------------------------------------------------------------------
    # * Object Initialization
    #     actor : actor
    #--------------------------------------------------------------------------
    def initialize(actor)
      super(0, 96, 240, 176)
      self.contents = Bitmap.new(width - 32, height - 32)
      @actor = actor
      refresh
      self.index = 0
      self.active = false
    end
    #--------------------------------------------------------------------------
    # * Updates Window With New Actor
    #     actor : new actor
    #--------------------------------------------------------------------------
    def update_actor(actor)
      @actor = actor
      refresh
    end   
    #--------------------------------------------------------------------------
    # * Item Acquisition
    #--------------------------------------------------------------------------
    def item
      return @data[self.index]
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      @data = []
      @data.push($data_weapons[@actor.weapon_id])
      @data.push($data_armors[@actor.armor1_id])
      @data.push($data_armors[@actor.armor2_id])
      @data.push($data_armors[@actor.armor3_id])
      @data.push($data_armors[@actor.armor4_id])
      @item_max = @data.size
      self.contents.font.color = system_color
      self.contents.font.size = 19
      self.contents.font.bold = true
      self.contents.draw_text(0, 28 * 0, 76, 32, $data_system.words.weapon)
      self.contents.draw_text(0, 28 * 1, 76, 32, $data_system.words.armor1)
      self.contents.draw_text(0, 28 * 2, 76, 32, $data_system.words.armor2)
      self.contents.draw_text(0, 28 * 3, 76, 32, $data_system.words.armor3)
      self.contents.draw_text(0, 28 * 4, 76, 32, $data_system.words.armor4)
      self.contents.font.bold = false
      for i in 0..4
        draw_item_name(@data[i], 76, 28 * i)
      end
    end
    #--------------------------------------------------------------------------
    # * Update Cursor Rectangle
    #--------------------------------------------------------------------------
    def update_cursor_rect 
      # Calculate cursor width
      cursor_width = self.width / @column_max - 24
      # Calculate cursor coordinates
      x = @index % @column_max * (cursor_width + 24)
      y = @index  * 28
      # Update cursor rectangle
      self.cursor_rect.set(x - 4, y, cursor_width, 32)
    end
    def update
      #super
      # If cursor is movable
      if self.active and @item_max > 0 and @index >= 0
        # If pressing down on the directional buttons
        if Input.repeat?(Input::DOWN)
          # If column count is 1 and directional button was pressed down with no
          # repeat, or if cursor position is more to the front than
          # (item count - column count)
          if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
             @index < @item_max - @column_max
            # Move cursor down
            $game_system.se_play($data_system.cursor_se)
            @index = (@index + @column_max) % @item_max
          end
        end
        # If the up directional button was pressed
        if Input.repeat?(Input::UP)
          # If column count is 1 and directional button was pressed up with no
          # repeat, or if cursor position is more to the back than column count
          if (@column_max == 1 and Input.trigger?(Input::UP)) or
             @index >= @column_max
            # Move cursor up
            $game_system.se_play($data_system.cursor_se)
            @index = (@index - @column_max + @item_max) % @item_max
          end
        end
        # If the right directional button was pressed
        if Input.repeat?(Input::RIGHT)
          # If column count is 2 or more, and cursor position is closer to front
          # than (item count -1)
          if @column_max >= 2 and @index < @item_max - 1
            # Move cursor right
            $game_system.se_play($data_system.cursor_se)
            @index += 1
          end
        end
        # If the left directional button was pressed
        if Input.repeat?(Input::LEFT)
          # If column count is 2 or more, and cursor position is more back than 0
          if @column_max >= 2 and @index > 0
            # Move cursor left
            $game_system.se_play($data_system.cursor_se)
            @index -= 1
          end
        end
      end
      # Update help text (update_help is defined by the subclasses)
      if self.active and @help_window != nil
        update_help
      end
      # Update cursor rectangle
      update_cursor_rect
    end
    #--------------------------------------------------------------------------
    # * Help Text Update
    #--------------------------------------------------------------------------
    def update_help
      @help_window.set_text(self.item == nil ? "" : self.item.description)
    end
  end
  #==============================================================================
  # ** Window_EquipmentItem
  #------------------------------------------------------------------------------
  #  This window displays choices when opting to change equipment on the
  #  equipment screen.
  #==============================================================================

  class Window_EquipmentItem < Window_Selectable
    #--------------------------------------------------------------------------
    # * Object Initialization
    #     actor      : actor
    #     equip_type : equip region (0-3)
    #--------------------------------------------------------------------------
    def initialize(actor, equip_type)
      super(0, 272, 240, 160)
      @actor = actor
      @equip_type = equip_type
      refresh
      self.active = false
      self.index = -1
    end
    #--------------------------------------------------------------------------
    # * Updates Window With New Actor
    #     actor : new actor
    #--------------------------------------------------------------------------
    def update_actor(actor)
      @actor = actor
      refresh
    end   
    #--------------------------------------------------------------------------
    # * Updates Window With New Equipment Type
    #     equip_type : new teyp of equipment
    #--------------------------------------------------------------------------
    def update_equipment(equip_type)
      @equip_type = equip_type
      refresh
    end   
    #--------------------------------------------------------------------------
    # * Item Acquisition
    #--------------------------------------------------------------------------
    def item
      if self.index == 0
        return @data[@item_max - 1]
      else
        return @data[self.index - 1]
      end
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      if self.contents != nil
        self.contents.dispose
        self.contents = nil
      end
      @data = []
      # Add equippable weapons
      if @equip_type == 0
        weapon_set = $data_classes[@actor.class_id].weapon_set
        for i in 1...$data_weapons.size
          if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
            @data.push($data_weapons[i])
          end
        end
      end
      # Add equippable armor
      if @equip_type != 0
        armor_set = $data_classes[@actor.class_id].armor_set
        for i in 1...$data_armors.size
          if $game_party.armor_number(i) > 0 and armor_set.include?(i)
            if $data_armors[i].kind == @equip_type-1
              @data.push($data_armors[i])
            end
          end
        end
      end
      # Add blank page
      @data.push(nil)
      # Make a bit map and draw all items
      @item_max = @data.size
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max - 1
        draw_item(i)
      end
      self.contents.draw_text(4, 0, 204, 32, 'Unequip', 0)
    end
    #--------------------------------------------------------------------------
    # * Draw Item
    #     index : item number
    #--------------------------------------------------------------------------
    def draw_item(index)
      item = @data[index]
      x = 4
      y = (index + 1) * 32
      case item
      when RPG::Weapon
        number = $game_party.weapon_number(item.id)
      when RPG::Armor
        number = $game_party.armor_number(item.id)
      end
      bitmap = RPG::Cache.icon(item.icon_name)
      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
      self.contents.font.color = normal_color
      self.contents.font.size = 20
      self.contents.font.bold = true
      self.contents.draw_text(x + 28, y, 132, 32, item.name, 0)
      self.contents.draw_text(x + 160, y, 12, 32, ":", 1)
      self.contents.draw_text(x + 176, y, 24, 32, number.to_s, 2)
    end
    #--------------------------------------------------------------------------
    # * Help Text Update
    #--------------------------------------------------------------------------
    def update_help
      @help_window.set_text(self.item == nil ? 'Unequip the current equipment.' :
        self.item.description)
    end
  end
 
  #==============================================================================
  # ** Window_Status
  #------------------------------------------------------------------------------
  #  This window displays full status specs on the status screen.
  #==============================================================================

  class Window_NewStatus < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #     actor      : actor
    #--------------------------------------------------------------------------
    def initialize(actor)
      super(0, 96, 640, 336)
      self.contents = Bitmap.new(width - 32, height - 32)
      @actor = actor
      refresh
      self.active = false
    end
    #--------------------------------------------------------------------------
    # * Updates Window With New Actor
    #     actor : new actor
    #--------------------------------------------------------------------------   
    def update_actor(actor)
      @actor = actor
      refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      self.contents.font.size = 22
      self.contents.font.bold = false
      draw_actor_name(@actor, 12, 0)
      if LegACy::POTRAIT[1]
        draw_actor_potrait(@actor, 12, 40, LegACy::POTRAIT[1])
        draw_LegACy_bar(@actor, 120, 60, 'hp', 200)
        draw_LegACy_bar(@actor, 120, 92, 'sp', 200)
        draw_LegACy_bar(@actor, 120, 124, 'exp', 200)
      else
        draw_actor_graphic(@actor,         40, 120)
        draw_LegACy_bar(@actor, 96, 60, 'hp', 200)
        draw_LegACy_bar(@actor, 96, 92, 'sp', 200)
        draw_LegACy_bar(@actor, 96, 124, 'exp', 200)
      end     
      draw_actor_class(@actor, 262, 0)
      draw_actor_level(@actor, 184, 0)
      draw_actor_state(@actor, 96, 0)     
      self.contents.font.size = 17
      self.contents.font.bold = true
      for i in 0..7
        draw_actor_parameter(@actor, 386, (i * 20) - 6, i, 120, LegACy::STAT_BAR[2])
      end
      self.contents.font.color = system_color
      self.contents.font.size = 16
      draw_actor_element_radar_graph(@actor, 48, 136)
      self.contents.font.size = 18
      self.contents.font.color = system_color
      self.contents.draw_text(380, 156, 96, 32, "Equipment")
      self.contents.draw_text(300, 180, 96, 32, "Weapon")
      self.contents.draw_text(300, 204, 96, 32, "Shield")
      self.contents.draw_text(300, 228, 96, 32, "Helmet")
      self.contents.draw_text(300, 252, 96, 32, "Armor")
      self.contents.draw_text(300, 276, 96, 32, "Accessory")
      equip = $data_weapons[@actor.weapon_id]
      if  @actor.equippable?(equip)
        draw_item_name($data_weapons[@actor.weapon_id], 406, 180)
      else
        self.contents.font.color = knockout_color
        self.contents.draw_text(406, 180, 192, 32, "Nothing equipped")
      end
      equip1 = $data_armors[@actor.armor1_id]
        if  @actor.equippable?(equip1)
        draw_item_name($data_armors[@actor.armor1_id], 406, 204)
      else
        self.contents.font.color = crisis_color
        self.contents.draw_text(406, 204, 192, 32, "Nothing equipped")
      end
      equip2 = $data_armors[@actor.armor2_id]
        if  @actor.equippable?(equip2)
        draw_item_name($data_armors[@actor.armor2_id], 406, 228)
      else
        self.contents.font.color = crisis_color
        self.contents.draw_text(406, 228, 192, 32, "Nothing equipped")
      end
      equip3 = $data_armors[@actor.armor3_id]
        if  @actor.equippable?(equip3)
        draw_item_name($data_armors[@actor.armor3_id], 406, 252)
      else
        self.contents.font.color = crisis_color
        self.contents.draw_text(406, 252, 192, 32, "Nothing equipped")
      end
      equip4 = $data_armors[@actor.armor4_id]
        if  @actor.equippable?(equip4)
        draw_item_name($data_armors[@actor.armor4_id], 406, 276)
      else
        self.contents.font.color = crisis_color
        self.contents.draw_text(406, 276, 192, 32, "Nothing equipped")
      end   
    end   
    def dummy
      self.contents.font.color = system_color
      self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
      self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
      self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
      self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
      self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
      draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
      draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
      draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
      draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
      draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
    end   
  end
 
  #==============================================================================
  # ** Window_Files
  #------------------------------------------------------------------------------
  # This window shows a list of recorded save files.
  #==============================================================================

  class Window_File < Window_Selectable
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    def initialize()
      super(0, 96, 320, 336)
      self.contents = Bitmap.new(width - 32, LegACy::SAVE_NUMBER * 32)
      index = $game_temp.last_file_index == nil ? 0 : $game_temp.last_file_index
      self.index = index
      self.active = false
      @item_max = LegACy::SAVE_NUMBER
      refresh
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      self.contents.font.color = normal_color
      time_stamp = Time.at(0)
      for i in 0...LegACy::SAVE_NUMBER
        filename = "Save#{i + 1}.rxdata"
        self.contents.draw_text(1, i * 32, 32, 32, (i + 1).to_s, 1)
        if FileTest.exist?(filename)
          size = File.size(filename)
          if size.between?(1000, 999999)
            size /= 1000
            size_str = "#{size} KB"
          elsif size > 999999
            size /= 1000000
            size_str = "#{size} MB"
          else
            size_str = size.to_s
          end
          time_stamp = File.open(filename, "r").mtime
          date = time_stamp.strftime("%m/%d/%Y")
          time = time_stamp.strftime("%H:%M")
          self.contents.font.size = 20
          self.contents.font.bold = true
          self.contents.draw_text(38, i * 32, 120, 32, date)
          self.contents.draw_text(160, i * 32, 100, 32, time)
          self.contents.draw_text(0, i * 32, 284, 32, size_str, 2)
        end
      end
    end
  end

  #==============================================================================
  # ** Window_FileStat
  #------------------------------------------------------------------------------
  # This window shows the status of the currently selected save file
  #==============================================================================

  class Window_FileStatus < Window_Base
   #--------------------------------------------------------------------------
    # * Object Initialization
    #     save_window      : current save file
    #--------------------------------------------------------------------------
    def initialize(save_window)
      super(0, 96, 320, 336)
      self.contents = Bitmap.new(width - 32, height - 32)
      @save_window = save_window
      @index = @save_window.index
      refresh
    end
    #--------------------------------------------------------------------------
    # # Refresh
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      filename = "Save#{@index + 1}.rxdata"
      return unless FileTest.exist?(filename)
      file = File.open(filename, "r")
      Marshal.load(file)
      frame_count = Marshal.load(file)
      for i in 0...6
        Marshal.load(file)
      end
      party = Marshal.load(file)
      Marshal.load(file)
      map = Marshal.load(file)
      self.contents.font.size = 20
      self.contents.font.bold = true
      for i in 0...party.actors.size
        actor = party.actors[i]
        x = 4
        y = i * 56
        draw_LegACy_bar(actor, x + 112, y + 14, 'hp', 160)
        draw_LegACy_bar(actor, x + 112, y + 36, 'sp', 160)
        draw_actor_name(actor, x + 40, y - 2)
        draw_actor_level(actor, x + 40, y + 22)
        draw_actor_graphic(actor, x + 10, y + 48)       
      end
      total_sec = frame_count / Graphics.frame_rate
      hour = total_sec / 60 / 60
      min = total_sec / 60 % 60
      sec = total_sec % 60
      text = sprintf("%02d:%02d:%02d", hour, min, sec)
      map_name = load_data("Data/MapInfos.rxdata")[map.map_id].name
      self.contents.font.color = system_color
      self.contents.draw_text(4, 224, 96, 32, "Play Time ")
      self.contents.draw_text(4, 252, 96, 32, $data_system.words.gold)
      self.contents.draw_text(4, 280, 96, 32, "Location ")
      self.contents.draw_text(104, 224, 16, 32, ":")
      self.contents.draw_text(104, 252, 16, 32, ":")
      self.contents.draw_text(104, 280, 16, 32, ":")
      self.contents.font.color = normal_color
      self.contents.draw_text(120, 224, 144, 32, text)
      self.contents.draw_text(120, 252, 144, 32, party.gold.to_s)
      self.contents.draw_text(120, 280, 144, 32, map_name)
    end
    #--------------------------------------------------------------------------
    # * Update
    #--------------------------------------------------------------------------
    def update
      if @index != @save_window.index
        @index = @save_window.index
        refresh
      end
      super
    end
  end
 
« Last Edit: January 17, 2007, 09:23:29 PM by sanchezinc »

**
Rep: +0/-0Level 88
Part 3
Spoiler for:
[code]#==============================================================================
  # ** 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
      @update_frame = 0
      @targetactive = false
      @exit = false
      @actor = $game_party.actors[0]
      @old_actor = nil
    end
    #--------------------------------------------------------------------------
    # * Main Processing
    #--------------------------------------------------------------------------
    def main
      # Make command window
      if LegACy::ICON
        s1 = '     ' + $data_system.words.item
        s2 = '     ' + $data_system.words.skill
        s3 = '    ' + $data_system.words.equip
        s4 = '    ' + 'Status'
        s5 = '    ' + 'Save'
        s6 = '    ' + 'Exit'
        t1 = '     ' + 'Recov.'
        t2 = '      ' + 'Weapon'
        t3 = '     ' + 'Armor'
        t4 = '      ' + 'Accessory'
        t5 = '    ' + 'Quest'
        t6 = '    ' + 'Misc.'
      else
        s1 = ' ' + $data_system.words.item
        s2 = ' ' + $data_system.words.skill
        s3 = ' ' + $data_system.words.equip
        s4 = ' ' + 'Status'
        s5 = 'Save'
        s6 = 'Exit'
        t1 = ' ' + 'Recov.'
        t2 = ' ' + 'Weapon'
        t3 = ' ' + 'Armor'
        t4 = ' ' + 'Accessory'
        t5 = 'Quest'
        t6 = 'Misc.'
      end     
      u1 = 'To Title'
      u2 = 'Quit'
      v1 = 'Optimize'
      v2 = 'Unequip All'
      @command_window = Window_NewCommand.new(320, [s1, s2, s3, s4, s5, s6])
      @command_window = Window_NewCommand.new(320, [s1, s2, s3, s4, s5, s6], LegACy::ICON_NAME[0]) if LegACy::ICON
      @command_window.y = -96
      @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 save is forbidden
      if $game_system.save_disabled
        # Disable save
        @command_window.disable_item(4)
      end
      # Make stat window
      @stat_window = Window_Stat.new
      @stat_window.x = 320
      @stat_window.y = -96
      # Make status window
      @status_window = Window_NewMenuStatus.new
      @status_window.x = 640
      @status_window.y = 96
      @location_window = Window_Location.new
      @location_window.y = 480
      @actor_window = Window_Actor.new
      @actor_window.x = -160
      @actor_window.y = 96
      @itemcommand_window = Window_NewCommand.new(320, [t1, t2, t3, t4, t5, t6])
      @itemcommand_window = Window_NewCommand.new(320, [t1, t2, t3, t4, t5, t6], LegACy::ICON_NAME[1]) if LegACy::ICON
      @itemcommand_window.x = -320
      @itemcommand_window.active = false
      @help_window = Window_NewHelp.new
      @help_window.x = -640
      @help_window.y = 432
      @item_window = Window_NewItem.new
      @item_window.x = -480     
      @item_window.help_window = @help_window
      @skill_window = Window_NewSkill.new(@actor)
      @skill_window.x = -480     
      @skill_window.help_window = @help_window
      if LegACy::ABS
        @hotkey_window = Window_Hotkey.new
        @hotkey_window.x = -480
      end
      @equipstat_window = Window_EquipStat.new(@actor)
      @equipstat_window.x = -480
      @equip_window = Window_Equipment.new(@actor)
      @equip_window.x = -240
      @equip_window.help_window = @help_window
      @equipitem_window = Window_EquipmentItem.new(@actor, 0)
      @equipitem_window.x = -240
      @equipitem_window.help_window = @help_window
      @equipenhanced_window = Window_Command.new(160, [v1, v2])
      @equipenhanced_window.x = -160
      @equipenhanced_window.active = false
      @playerstatus_window = Window_NewStatus.new(@actor)
      @playerstatus_window.x = -640
      @level_window = Window_Level.new(@actor)
      @level_window.x = -480
      @level_window.help_window = @help_window
      @file_window = Window_File.new
      @file_window.x = -640
      @filestatus_window = Window_FileStatus.new(@file_window)
      @filestatus_window.x = -320
      @end_window = Window_Command.new(120, [u1, u2])
      @end_window.x = 640
      @end_window.active = false
      @spriteset = Spriteset_Map.new
      @windows = [@command_window, @stat_window, @status_window,
        @location_window, @actor_window, @itemcommand_window,@help_window,
        @item_window, @skill_window, @equipstat_window, @equip_window,
        @equipitem_window, @equipenhanced_window, @playerstatus_window,
        @file_window, @filestatus_window, @end_window, @level_window]
      @windows.push(@hotkey_window) if LegACy::ABS
      @windows.each {|i| i.opacity = LegACy::WIN_OPACITY}
      @windows.each {|i| i.z = LegACy::WIN_Z}
      # 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     
      @spriteset.dispose
      @windows.each {|i| i.dispose}
    end
    #--------------------------------------------------------------------------
    # * Frame Update
    #--------------------------------------------------------------------------
    def update
      # Update windows
      @windows.each {|i| i.update}
      animate     
      menu_update
      update_scroll if @skill_window.active || @equip_window.active || @playerstatus_window.active || @level_window.active
      if LegACy::ANIMATED       
        @update_frame += 1
        if @update_frame == 3
          @update_frame = 0
          @actor_window.frame_update
        end
      end     
    end
    #--------------------------------------------------------------------------
    # * Animating windows.
    #--------------------------------------------------------------------------
    def animate
      if @command_window.active && @skill_window.x == -480 && @file_window.x == -640 && @level_window.x
        @command_window.y += 6 if @command_window.y < 0
        @stat_window.y += 6 if @stat_window.y < 0
        @actor_window.x += 10 if @actor_window.x < 0
        @status_window.x -= 30 if @status_window.x > 160
        @location_window.y -= 3 if @location_window.y > 432
      elsif @exit == true
        @command_window.y -= 6 if @command_window.y > -96
        @stat_window.y -= 6 if @stat_window.y > -96
        @actor_window.x -= 10 if @actor_window.x > -160
        @status_window.x += 30 if @status_window.x < 640
        @location_window.y += 3 if @location_window.y < 480
        $scene = Scene_Map.new if @location_window.y == 480
      end
      if @itemcommand_window.active       
        if @itemcommand_window.x < 0
          @stat_window.x += 40
          @command_window.x += 40
          @itemcommand_window.x += 40
        end
      else
        if @itemcommand_window.x > -320 && @command_window.active
          @stat_window.x -= 40
          @command_window.x -= 40
          @itemcommand_window.x -= 40
        end
      end
      if @item_window.active       
        if @item_window.x < 0
          @location_window.x += 40
          @help_window.x += 40
          @status_window.x += 30
          @actor_window.x += 30
          @item_window.x += 30
        end
      elsif @targetactive != true
        if @item_window.x > -480 && @command_window.index == 0
          @help_window.x -= 40
          @location_window.x -= 40
          @item_window.x -= 30
          @actor_window.x -= 30
          @status_window.x -= 30
        end
      end
      if @level_window.active       
        if @level_window.x < 0
          @location_window.x += 40
          @help_window.x += 40
          @status_window.x += 30
          @actor_window.x += 30
          @hotkey_window.x += 30 if @actor_window.index == 0 && LegACy::ABS
          @level_window.x += 30
        end
      elsif @targetactive != true
        if @level_window.x > -480 && @command_window.index == 3
          @help_window.x -= 40
          @location_window.x -= 40
          @level_window.x -= 30
          if LegACy::ABS
            @hotkey_window.x -= 30 if @hotkey_window.x > -480
          end
          @actor_window.x -= 30         
          @status_window.x -= 30
        end
      end
      if @skill_window.active       
        if @skill_window.x < 0
          @location_window.x += 40
          @help_window.x += 40
          @status_window.x += 30
          @actor_window.x += 30
          @hotkey_window.x += 30 if @actor_window.index == 0 && LegACy::ABS
          @skill_window.x += 30
        end
      elsif @targetactive != true
        if @skill_window.x > -480 && @command_window.index == 3
          @help_window.x -= 40
          @location_window.x -= 40
          @skill_window.x -= 30
          if LegACy::ABS
            @hotkey_window.x -= 30 if @hotkey_window.x > -480
          end
          @actor_window.x -= 30         
          @status_window.x -= 30
        end
      end
      if @equip_window.active       
        if @equipstat_window.x < 0
          @status_window.x += 48
          @actor_window.x += 48
          @equip_window.x += 48
          @equipitem_window.x += 48
          @equipstat_window.x += 48         
          @location_window.x += 64
          @help_window.x += 64
        end
      elsif ! @equipitem_window.active && ! @equipenhanced_window.active
        if @equipstat_window.x > -480 && @command_window.index == 1
          @equipstat_window.x -= 48
          @equip_window.x -= 48
          @equipitem_window.x -= 48
          @actor_window.x -= 48
          @status_window.x -= 48
          @help_window.x -= 64
          @location_window.x -= 64
        end
      end
      if @equipenhanced_window.active       
        if @equipenhanced_window.x < 0
          @stat_window.x += 16
          @command_window.x += 16
          @equipenhanced_window.x += 16
        end
      else
        if @equipenhanced_window.x > -160 && @equip_window.active
          @equipenhanced_window.x -= 16
          @stat_window.x -= 16
          @command_window.x -= 16
        end
      end
      if @playerstatus_window.active       
        if @playerstatus_window.x < 0
          @status_window.x += 40
          @actor_window.x += 40
          @playerstatus_window.x += 40
        end
      else
        if @playerstatus_window.x > -640 && @command_window.index == 4
          @playerstatus_window.x -= 40
          @actor_window.x -= 40
          @status_window.x -= 40
        end
      end
      if @file_window.active       
        if @file_window.x < 0
          @status_window.x += 40
          @actor_window.x += 40
          @filestatus_window.x += 40
          @file_window.x += 40
        end
      else
        if @file_window.x > -640
          @file_window.x -= 40
          @filestatus_window.x -= 40     
          @actor_window.x -= 40
          @status_window.x -= 40     
        end
      end
      if @end_window.active       
        if @end_window.x > 520
          @stat_window.x -= 10
          @command_window.x -= 10
          @end_window.x -= 10
        end
      else
        if @end_window.x < 640 && @command_window.index == 5
          @end_window.x += 10
          @stat_window.x += 10
          @command_window.x += 10
        end
      end
    end
    #--------------------------------------------------------------------------
    # * Checking Update Method Needed
    #--------------------------------------------------------------------------
    def menu_update
      if @command_window.active && @command_window.y == 0 && @command_window.x == 0 then update_command
      elsif @item_window.x == -480 && @itemcommand_window.active && @itemcommand_window.x == 0 then update_itemcommand
      elsif @item_window.active && @item_window.x == 0 then update_item
      elsif @skill_window.active then update_skill
      elsif @level_window.active then update_level
      elsif @targetactive == true then update_target
      elsif @equip_window.active && @equip_window.x == 240 then update_equip
      elsif @equipitem_window.active then update_equipment
      elsif @equipenhanced_window.x == 0 then update_extraequip
      elsif @playerstatus_window.x == 0 then update_playerstatus
      elsif @file_window.x == 0 then update_save
      elsif @actor_window.active && @actor_window.x == 0 then update_status
      elsif @end_window.active then update_end     
      end
    end
    #--------------------------------------------------------------------------
    # * Windows Actor Scrolling Update
    #--------------------------------------------------------------------------
    def update_scroll
      if Input.trigger?(Input::R)
        # Play cursor SE
        $game_system.se_play($data_system.cursor_se)
        # To next actor
        if $game_party.actors.size - 1 == @actor_window.index
          @actor_window.index = 0
        else
          @actor_window.index += 1
        end       
        actor = $game_party.actors[@actor_window.index]
        if @skill_window.active
          if LegACy::ABS
            @actor_window.index == 0 ? @skill_window.height = 240 : @skill_window.height = 336
            @actor_window.index == 0 ? @hotkey_window.x = 0 : @hotkey_window.x = -480
          end       
          @skill_window.update_actor(actor)
        end
        if @level_window.active     
          @level_window.update_actor(actor)
        end
        if @equip_window.active
          @equip_window.update_actor(actor)
          @equipitem_window.update_actor(actor)
          @equipstat_window.update_actor(actor)
        end       
        @playerstatus_window.update_actor(actor) if @playerstatus_window.active
        return
      end
      # If L button was pressed
      if Input.trigger?(Input::L)
        # Play cursor SE
        $game_system.se_play($data_system.cursor_se)
        # To previous actor
        if @actor_window.index == 0
          @actor_window.index = $game_party.actors.size - 1
        else
          @actor_window.index -= 1
        end
        actor = $game_party.actors[@actor_window.index]
        if @skill_window.active
          if LegACy::ABS
            @actor_window.index == 0 ? @skill_window.height = 240 : @skill_window.height = 336
            @actor_window.index == 0 ? @hotkey_window.x = 0 : @hotkey_window.x = -480
          end       
          @skill_window.update_actor(actor)
        end
        if @level_window.active                 
          @level_window.update_actor(actor)
        end
        if @equip_window.active
          @equip_window.update_actor(actor)
          @equipitem_window.update_actor(actor)
          @equipstat_window.update_actor(actor)
        end       
        @playerstatus_window.update_actor(actor) if @playerstatus_window.active
        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
        @command_window.active = false
        @exit = true
        return
      end
      # If B button was pressed
      if Input.trigger?(Input::SHIFT) && LegACy::PARTY_SWAP
        # Play cancel SE
        $game_system.se_play($data_system.decision_se)
        # Switch to map screen
        @command_window.active = false
        @actor_window.party = true
        unless $game_party.reserve == []
          for i in 0...$game_party.reserve.size
            $game_party.actors.push($game_party.reserve)
          end
        end       
        @actor_window.refresh
        @actor_window.active = true       
        @actor_window.index = 0
        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
          @command_window.active = false
          @itemcommand_window.active = true
        when 1  # equipment
         # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Make status window active
          @command_window.active = false
          @actor_window.active = true
          @actor_window.index = 0
        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
          @command_window.active = false
          @file_window.active = true
        when 3..4  # skill & status
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Make status window active
          @command_window.active = false
          @actor_window.active = true
          @actor_window.index = 0
        when 5  # end game
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Switch to end game screen
          @command_window.active = false
          @end_window.active = true
        end
        return
      end
    end
    #--------------------------------------------------------------------------
    # * Frame Update (when item command window is active)
    #--------------------------------------------------------------------------
    def update_itemcommand
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to item command window
        @command_window.active = true
        @itemcommand_window.active = false
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Branch by command window cursor position
        type = LegACy::ITEMS[@itemcommand_window.index]
        @item_window.active = true
        @itemcommand_window.active = false
        @item_window.update_item(type)
        @item_window.index = 0
        @help_window.active = true
        return
      end
    end   
    #--------------------------------------------------------------------------
    # * Frame Update (when item window is active)
    #--------------------------------------------------------------------------
    def update_item
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to item command window
        @item_window.active = false
        @itemcommand_window.active = true
        @help_window.active = false
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        # Get currently selected data on the item window
        @item = @item_window.item
        # If not a use item
        unless @item.is_a?(RPG::Item)
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # If it can't be used
        unless $game_party.item_can_use?(@item.id)
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # If effect scope is an ally
        if @item.scope >= 3
          # Activate target window
          @item_window.active = false
          @targetactive = true
          @actor_window.active = true
          # Set cursor position to effect scope (single / all)
          if @item.scope == 4 || @item.scope == 6
            @actor_window.index = -1
          else
            @actor_window.index = 0
          end
        # If effect scope is other than an ally
        else
          # If command event ID is valid
          if @item.common_event_id > 0
            # Command event call reservation
            $game_temp.common_event_id = @item.common_event_id
            # Play item use SE
            $game_system.se_play(@item.menu_se)
            # If consumable
            if @item.consumable
              # Decrease used items by 1
              $game_party.lose_item(@item.id, 1)
              # Draw item window item
              @item_window.draw_item(@item_window.index)
            end
            # Switch to map screen
            $scene = Scene_Map.new
            return
          end
        end
        return
      end
    end   
    #--------------------------------------------------------------------------
    # * Frame Update (if skill window is active)
    #--------------------------------------------------------------------------
    def update_skill
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to main command menu
        @skill_window.active = false
        @help_window.active = false
        @actor_window.active = true
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        # Get currently selected data on the skill window
        @skill = @skill_window.skill
        # If unable to use
        if @skill == nil or not @actor.skill_can_use?(@skill.id)
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # If effect scope is ally
        if @skill.scope >= 3
          # Activate target window
          @skill_window.active = false
          @targetactive = true
          @actor_window.active = true
          # Set cursor position to effect scope (single / all)
          if @skill.scope == 4 || @skill.scope == 6
            @actor_window.index = -1
          elsif @skill.scope == 7
            @actor_index = @actor_window.index
            @actor_window.index = @actor_index - 10
          else
            @actor_window.index = 0
          end
        # If effect scope is other than ally
        else
          # If common event ID is valid
          if @skill.common_event_id > 0
            # Common event call reservation
            $game_temp.common_event_id = @skill.common_event_id
            # Play use skill SE
            $game_system.se_play(@skill.menu_se)
            # Use up SP
            @actor.sp -= @skill.sp_cost
            # Remake each window content
            @actor_window.refresh
            @skill_window.refresh
            # Switch to map screen
            $scene = Scene_Map.new
            return
          end
        end
        return
      end
      if @skill_window.height == 240 && LegACy::ABS
        if Kboard.keyboard($R_Key_H)
          $game_system.se_play($data_system.decision_se)
          $ABS.skill_key[1] = @skill_window.skill.id
          @hotkey_window.refresh
          return
        end
        if Kboard.keyboard($R_Key_J)
          $game_system.se_play($data_system.decision_se)
          $ABS.skill_key[2] = @skill_window.skill.id
          @hotkey_window.refresh
          return
        end
        if Kboard.keyboard($R_Key_K)
          $game_system.se_play($data_system.decision_se)
          $ABS.skill_key[3] = @skill_window.skill.id
          @hotkey_window.refresh
          return
        end
        if Kboard.keyboard($R_Key_L)
          $game_system.se_play($data_system.decision_se)
          $ABS.skill_key[4] = @skill_window.skill.id
          @hotkey_window.refresh
          return
        end
      end
      if LegACy::PREXUS
        if Input.trigger?(Input::X)
          skill = @skill_window.skill
          unless $ABS.player.abs.hot_key[0] or
                 $ABS.player.abs.hot_key.include?(skill.id)
            $ABS.player.abs.hot_key[0] = skill.id
          end
          @skill_window.refresh
          return
        end
        if Input.trigger?(Input::Y)
          skill = @skill_window.skill
          unless $ABS.player.abs.hot_key[1] or
                 $ABS.player.abs.hot_key.include?(skill.id)
            $ABS.player.abs.hot_key[1] = skill.id
          end
          @skill_window.refresh
          return
        end
        if Input.trigger?(Input::Z)
          skill = @skill_window.skill
          unless $ABS.player.abs.hot_key[2] or
                 $ABS.player.abs.hot_key.include?(skill.id)
            $ABS.player.abs.hot_key[2] = skill.id
          end
          @skill_window.refresh
          return
        end
        if Input.trigger?(Input::A)
          skill = @skill_window.skill
          for i in 0..$ABS.player.abs.hot_key.size
            skillX = $ABS.player.abs.hot_key
            next unless skillX
            $ABS.player.abs.hot_key = nil if skill.id == skillX
          end
          @skill_window.refresh
          return
        end
      end     
    end
    #--------------------------------------------------------------------------
    # * Frame Update (if level window is active)
    #--------------------------------------------------------------------------
    def update_level
      @spend = Window_Level.new(@actor_ind)
      @spend.update
     # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to main command menu
        @level_window.active = false
        @help_window.active = false
        @actor_window.active = true
        return
      end
      # If RIGHT button was pressed
if Input.repeat?(Input::RIGHT)
  unless $PSPEND_POINTS[@actor_ind] > 0
    $game_system.se_play($data_system.buzzer_se)
    return
  end
  $game_system.se_play($data_system.cursor_se)
  $PSPEND_POINTS[@actor_ind] -= 1
  case @spend.index
  when 0
    $PSPEND_ADD[1] += STRENGTH_ADD
  when 1
    $PSPEND_ADD[2] += AGILITY_ADD
  when 2
    $PSPEND_ADD[3] += DEXTERITY_ADD
  when 3
    $PSPEND_ADD[4] += INTELIGENCE_ADD
  when 4
    $PSPEND_ADD[5] += HP_ADD
  when 5
    $PSPEND_ADD[6] += SP_ADD
  when 6
    $PSPEND_POINTS[@actor_ind] += 1
  when 7
    $PSPEND_POINTS[@actor_ind] += 1
  end
  @spend.refresh
  return
end
end
# If LEFT is pressed
if Input.repeat?(Input::LEFT)
  unless $PSPEND_POINTS[@actor_ind] < $PSPEND_RET
    $game_system.se_play($data_system.buzzer_se)
    return
  end
  $game_system.se_play($data_system.cursor_se)
  case @spend.index
  when 0
    if $PSPEND_ADD[1] <= $ACTORD.str
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    $PSPEND_ADD[1] -= STRENGTH_ADD
  when 1
    if $PSPEND_ADD[2] <= $ACTORD.agi
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    $PSPEND_ADD[2] -= AGILITY_ADD
  when 2
    if $PSPEND_ADD[3] <= $ACTORD.dex
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    $PSPEND_ADD[3] -= DEXTERITY_ADD
  when 3
    if $PSPEND_ADD[4] <= $ACTORD.int
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    $PSPEND_ADD[4] -= INTELIGENCE_ADD
  when 4
    if $PSPEND_ADD[5] <= $ACTORD.maxhp
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    $PSPEND_ADD[5] -= HP_ADD
  when 5
    if $PSPEND_ADD[6] <= $ACTORD.maxsp
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    $PSPEND_ADD[6] -= SP_ADD
  when 6
    $PSPEND_POINTS[@actor_ind] -= 1
  when 7
    $PSPEND_POINTS[@actor_ind] -= 1
  end
  $PSPEND_POINTS[@actor_ind] += 1
  @spend.refresh
  return
end
#When C is pressed
if Input.trigger?(Input::C)
  case @spend.index
  when 6
    @spend.refresh(true)
  when 7
    $ACTORD.str = $PSPEND_ADD[1]
    $ACTORD.agi = $PSPEND_ADD[2]
    $ACTORD.dex = $PSPEND_ADD[3]
    $ACTORD.int = $PSPEND_ADD[4]
    $ACTORD.maxhp = $PSPEND_ADD[5]
    $ACTORD.maxsp = $PSPEND_ADD[6]
    $game_system.se_play($data_system.decision_se)
    @level_window.active = false
    @help_window.active = false
    @actor_window.active = true
    if $PSPEND_POINTS[@actor_ind] == 0
      $PSPEND_ACTORS[@actor_ind] = false
    end
    $PSPEND_ACTORS[@actor.id - 1] = false
    return
  end
end
    #--------------------------------------------------------------------------
    # * Frame Update (when target window is active)
    #--------------------------------------------------------------------------
    def update_target
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # If unable to use because items ran out
        @actor_window.index = 0
        if @command_window.index == 0
            # Remake item window contents
            @item_window.refresh
            @item_window.active = true
            @actor_window.active = false
        end
        if @command_window.index == 3
          # Remake skill window contents
          @skill_window.refresh
          @skill_window.active = true
          @actor_window.active = false
          @skill_window.update_actor($game_party.actors[0])
        end
        @targetactive = false
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        if @command_window.index == 0
          # If items are used up
          if $game_party.item_number(@item.id) == 0
            # Play buzzer SE
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          # If target is all
          if @actor_window.index == -1
            # Apply item effects to entire party
            used = false
            for i in $game_party.actors
              used |= i.item_effect(@item)
            end
          end
          # If single target
          if @actor_window.index >= 0
            # Apply item use effects to target actor
            target = $game_party.actors[@actor_window.index]
            used = target.item_effect(@item)
          end
          # If an item was used
          if used
            # Play item use SE
            $game_system.se_play(@item.menu_se)
            # If consumable
            if @item.consumable
              # Decrease used items by 1
              $game_party.lose_item(@item.id, 1)
              # Redraw item window item
              @item_window.draw_item(@item_window.index)
            end
            # Remake target window contents
            @actor_window.refresh
            @status_window.refresh
            # If all party members are dead
            if $game_party.all_dead?
              @targetactive = false
              # Switch to game over screen
              $scene = Scene_Gameover.new
              return
            end
            # If common event ID is valid
            if @item.common_event_id > 0
              # Common event call reservation
              $game_temp.common_event_id = @item.common_event_id
              @targetactive = false
              # Switch to map screen
              $scene = Scene_Map.new
              return
            end
          end
          # If item wasn't used
          unless used
            # Play buzzer SE
            $game_system.se_play($data_system.buzzer_se)
          end
          return
        end
        if @command_window.index == 3
          # If unable to use because SP ran out
          unless @actor.skill_can_use?(@skill.id)
            # Play buzzer SE
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          # If target is all
          if @actor_window.index == -1
            # Apply skill use effects to entire party
            used = false
            for i in $game_party.actors
              used |= i.skill_effect(@actor, @skill)
            end
          end
          # If target is user
          if @actor_window.index <= -2
            # Apply skill use effects to target actor
            target = $game_party.actors[@actor_window.index + 10]
            used = target.skill_effect(@actor, @skill)
          end
          # If single target
          if @actor_window.index >= 0
            # Apply skill use effects to target actor
            target = $game_party.actors[@actor_window.index]
            used = target.skill_effect(@actor, @skill)
          end
          # If skill was used
          if used
            # Play skill use SE
            $game_system.se_play(@skill.menu_se)
            # Use up SP
            @actor.sp -= @skill.sp_cost
            # Remake each window content
            @actor_window.refresh
            @skill_window.refresh
            # If entire party is dead
            if $game_party.all_dead?
              # Switch to game over screen
              @targetactive = false
              $scene = Scene_Gameover.new
              return
            end
            # If command event ID is valid
            if @skill.common_event_id > 0
              # Command event call reservation
              $game_temp.common_event_id = @skill.common_event_id
              @targetactive = false
              # Switch to map screen
              $scene = Scene_Map.new
              return
            end
          end
          # If skill wasn't used
          unless used
            # Play buzzer SE
            $game_system.se_play($data_system.buzzer_se)
          end
          return
        end
      end     
    end
    #--------------------------------------------------------------------------
    # * Frame Update (when equip window is active)
    #--------------------------------------------------------------------------
    def update_equip
      @equipitem_window.update_equipment(@equip_window.index)
      @equipstat_window.mode = @equip_window.index
      @equipstat_window.refresh
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        @status_window.refresh
        # Switch to menu screen
        @equip_window.active = false
        @help_window.active = false
        @actor_window.active = true
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        # If equipment is fixed
        if @actor.equip_fix?(@equip_window.index)
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Activate item window
        @equip_window.active = false
        @equipitem_window.active = true
        @equipitem_window.index = 0
        return
      end
      # If Shift button was pressed
      if Input.trigger?(Input::SHIFT) && LegACy::EXTRA_EQUIP       
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Activate item window
        @equip_window.active = false
        @equipenhanced_window.active = true
        @equipenhanced_window.index = 0
        return
      end
    end
    #--------------------------------------------------------------------------
    # * Frame Update (when equipment item window is active)
    #--------------------------------------------------------------------------
    def update_equipment   
      # Get currently item     
      item1 = @equip_window.item
      item2 = @equipitem_window.item
      last_hp = @actor.hp
      last_sp = @actor.sp
      old_atk = @actor.atk
      old_pdef = @actor.pdef
      old_mdef = @actor.mdef
      old_str = @actor.str
      old_dex = @actor.dex
      old_agi = @actor.agi
      old_int = @actor.int
      old_eva = @actor.eva
      @actor.equip(@equip_window.index, item2 == nil ? 0 : item2.id)
      # Get parameters for after equipment change
      new_atk = @actor.atk
      new_pdef = @actor.pdef
      new_mdef = @actor.mdef
      new_str = @actor.str
      new_dex = @actor.dex
      new_agi = @actor.agi
      new_int = @actor.int
      new_eva = @actor.eva
      @equipstat_window.changes = [0, 0, 0, 0, 0, 0, 0, 0]
      @equipstat_window.changes[0] = new_atk > old_atk ? 1 : @equipstat_window.changes[0]
      @equipstat_window.changes[0] = new_atk < old_atk ? -1 : @equipstat
« Last Edit: January 17, 2007, 10:36:39 PM by sanchezinc »

**
Rep: +0/-0Level 88
Last Part, 4
Spoiler for:
Code: [Select]
  #--------------------------------------------------------------------------
    # * Frame Update (when enhnaced equip window is active)
    #--------------------------------------------------------------------------
    def update_extraequip
      # If B button was pressed
      if Input.trigger?(Input::B) || Input.trigger?(Input::SHIFT)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to menu screen
        @equipenhanced_window.active = false
        @equip_window.active = true
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        $game_system.se_play($data_system.equip_se)
        case @equipenhanced_window.index
        when 0
          for i in 0..4
            @actor.equip(i, 0) unless @actor.equip_fix?(i)
            next if @actor.equip_fix?(i)
            case i
            when 0
              weapons = []
              weapon_set = $data_classes[@actor.class_id].weapon_set
              for j in 1...$data_weapons.size
                if $game_party.weapon_number(j) > 0 && weapon_set.include?(j)
                  weapons.push($data_weapons[j])
                end
              end
              next if weapons == []
              weapons = weapons.reverse
              strongest_weapon = weapons[0]
              for weapon in weapons
                strongest_weapon = weapon if strongest_weapon.atk < weapon.atk
              end           
              @actor.equip(0, strongest_weapon.id)
            when 1..4 
              armors = []
              armor_set = $data_classes[@actor.class_id].armor_set
              for j in 1...$data_armors.size
                if $game_party.armor_number(j) > 0 && armor_set.include?(j)
                  if $data_armors[j].kind == i - 1
                    armors.push($data_armors[j])
                  end
                end
              end
              next if armors == []
              armors = armors.reverse
              strongest_armor = armors[0]
              for armor in armors
                strongest_armor = armor if strongest_armor.pdef < armor.pdef
              end
              @actor.equip(i, strongest_armor.id)
            end
          end     
        when 1
          for j in 0..4
            @actor.equip(j, 0) unless @actor.equip_fix?(j)
          end
        end
        @equip_window.refresh
        @equipitem_window.refresh
        @equipstat_window.refresh
        return
      end
    end
    #--------------------------------------------------------------------------
    # * Frame Update (when status window is active)
    #--------------------------------------------------------------------------
    def update_playerstatus
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to menu screen
        @playerstatus_window.active = false
        @actor_window.active = true
        return
      end
    end
    #--------------------------------------------------------------------------
    # * Frame Update (when save window is active)
    #--------------------------------------------------------------------------
    def update_save
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to menu screen
        @file_window.active = false
        @command_window.active = true
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        $game_system.se_play($data_system.save_se)
        file = File.open("Save#{@file_window.index + 1}.rxdata", "wb")
        characters = []
        for i in 0...$game_party.actors.size
          actor = $game_party.actors[i]
          characters.push([actor.character_name, actor.character_hue])
        end
        Marshal.dump(characters, file)
        Marshal.dump(Graphics.frame_count, file)
        $game_system.save_count += 1
        $game_system.magic_number = $data_system.magic_number
        Marshal.dump($game_system, file)
        Marshal.dump($game_switches, file)
        Marshal.dump($game_variables, file)
        Marshal.dump($game_self_switches, file)
        Marshal.dump($game_screen, file)
        Marshal.dump($game_actors, file)
        Marshal.dump($game_party, file)
        Marshal.dump($game_troop, file)
        Marshal.dump($game_map, file)
        Marshal.dump($game_player, file)
        Marshal.dump($ams, file) if LegACy::AMS
        Marshal.dump($ABS, file) if LegACy::PREXUS
        Marshal.dump($PSPEND_POINTS, file)
        Marshal.dump($PSPEND_ACTORS, file)
        Marshal.dump($game_allies, file) if LegACy::ABS
        Marshal.dump($actor_attr, file)
        file.close
        @file_window.refresh
        @filestatus_window.refresh
        return
      end
    end
    #--------------------------------------------------------------------------
    # * Frame Update (when status window is active)
    #--------------------------------------------------------------------------
    def update_status
      @actor = $game_party.actors[@actor_window.index]     
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        if @old_actor == nil
          @command_window.active = true
          @actor_window.active = false
          if @actor_window.party
            for i in 4...$game_party.actors.size
              unless $game_party.reserve == []
                $game_party.reserve[i - 4] = $game_party.actors[4]
                $game_party.actors.delete($game_party.actors[4])
              end
            end
            @actor_window.party = false
            @actor_window.refresh
          end
          @actor_window.index = -1
        else
          @old_actor = nil
        end 
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        if @actor_window.party == false
          # Branch by command window cursor position
          case @command_window.index
          when 1  # equipment
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            # Switch to skill screen
            @equip_window.active = true
            @equip_window.update_actor(@actor)
            @equipitem_window.update_actor(@actor)
            @equipstat_window.update_actor(@actor)
            @help_window.active = true
            @actor_window.active = false
          when 3  # skill
           
            # If this actor's action limit is 2 or more
            if $game_party.actors[@actor_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
            if LegACy::ABS
              @actor_window.index == 0 ? @skill_window.height = 240 : @skill_window.height = 336
            end
            @skill_window.active = true
            @skill_window.index = 0
            @skill_window.update_actor(@actor)
            @help_window.active = true
            @actor_window.active = false
          when 4  # status
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            # Switch to status screen
            if Input.trigger?(Input::A)
              $game_system.se_play($data_system.decision_se)
              @level_window.active = true
              @level_window.index = 0
              @level_window.update_actor(@actor)
              @help_window.active = true
              @actor_window.active = false
            end
            @playerstatus_window.active = true
            @playerstatus_window.update_actor(@actor)
            @actor_window.active = false
          end
          return
        else         
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          if @old_actor == nil
            @old_actor = @actor
          else
            $game_party.actors[$game_party.actors.index(@old_actor)] = $game_party.actors[@actor_window.index]
            $game_party.actors[@actor_window.index] = @old_actor
            @actor_window.refresh
            $game_player.refresh
            @old_actor = nil           
          end
          return
        end     
      end
    end
    #--------------------------------------------------------------------------
    # * Frame Update
    #--------------------------------------------------------------------------
    def update_end
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to menu screen
        @end_window.active = false
        @command_window.active = true
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Fade out BGM, BGS, and ME
        Audio.bgm_fade(800)
        Audio.bgs_fade(800)
        Audio.me_fade(800)     
        # Branch by command window cursor position
        case @end_window.index
        when 0  # to title
          # Switch to title screen
          $scene = Scene_Title.new
        when 1  # shutdown
          # Shutdown
          $scene = nil
        end
        return
      end
    end
    def setup_actor_character_sprites(characters)
      @spriteset.setup_actor_character_sprites(characters)
    end
  end
 
  #==============================================================================
  # ** Window_BattleStatus
  #------------------------------------------------------------------------------
  #  This window displays the status of all party members on the battle screen.
  #==============================================================================
  if LegACy::BATTLE_BAR
    class Window_BattleStatus < Window_Base   
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        @item_max = $game_party.actors.size
        for i in 0...$game_party.actors.size
          actor = $game_party.actors[i]
          actor_x = i * 160 + 4
          draw_actor_name(actor, actor_x, 0)
          draw_LegACy_bar(actor, actor_x - 4, 46, 'hp', 120)
          draw_LegACy_bar(actor, actor_x - 4, 76, 'sp', 120)
          if @level_up_flags[i]
            self.contents.font.color = normal_color
            self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
          else
            draw_actor_state(actor, actor_x, 96)
          end
        end
      end
    end
  end 
    #==============================================================================
    # ** Scene_Load
    #------------------------------------------------------------------------------
    #  This class performs load screen processing.
    #==============================================================================
    class Scene_Load
      #--------------------------------------------------------------------------
      # * Object Initialization
      #     help_text : text string shown in the help window
      #--------------------------------------------------------------------------
      def initialize
        $game_temp = Game_Temp.new
        $game_temp.last_file_index = 0
        latest_time = Time.at(0)
        for i in 0..LegACy::SAVE_NUMBER
          filename = "Save#{i + 1}.rxdata"
          if FileTest.exist?(filename)
            file = File.open(filename, "r")
            if file.mtime > latest_time
              latest_time = file.mtime
              $game_temp.last_file_index = i
            end
            file.close
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Main Processing
      #--------------------------------------------------------------------------
      def main
        @help_window = Window_Help.new
        @help_window.set_text("Select a file to load.")
        @file_window = Window_File.new
        @file_window.y = 64
        @file_window.height = 416
        @file_window.active = true
        @status_window = Window_FileStatus.new(@file_window)
        @status_window.x = 320
        @status_window.y = 64
        @status_window.height = 416
        Graphics.transition
        loop do
          Graphics.update
          Input.update
          update
          if $scene != self
            break
          end
        end
        Graphics.freeze
        @help_window.dispose
        @file_window.dispose
        @status_window.dispose
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        @help_window.update
        @file_window.update
        @status_window.update
        # If C button was pressed
        if Input.trigger?(Input::C)
          unless FileTest.exist?(filename)
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.load_se)
          file = File.open(filename, "rb")
          read_save_data(file)
          file.close
          $game_system.bgm_play($game_system.playing_bgm)
          $game_system.bgs_play($game_system.playing_bgs)
          $game_map.update
          $scene = Scene_Map.new
          $game_temp.last_file_index = @file_index
          return
        end
        # If B button was pressed
        if Input.trigger?(Input::B)
          $game_system.se_play($data_system.cancel_se)
          $scene = Scene_Title.new
          return
        end
      end
      #--------------------------------------------------------------------------
      # * Read Save Data
      #     file : file object for reading (opened)
      #--------------------------------------------------------------------------
      def read_save_data(file)
        # Read character data for drawing save file
        characters = Marshal.load(file)
        # Read frame count for measuring play time
        Graphics.frame_count = Marshal.load(file)
        # Read each type of game object
        $game_system        = Marshal.load(file)
        $game_switches      = Marshal.load(file)
        $game_variables     = Marshal.load(file)
        $game_self_switches = Marshal.load(file)
        $game_screen        = Marshal.load(file)
        $game_actors        = Marshal.load(file)
        $game_party         = Marshal.load(file)
        $game_troop         = Marshal.load(file)
        $game_map           = Marshal.load(file)
        $game_player        = Marshal.load(file)
        $PSPEND_POINTS = Marshal.load(file)
        $PSPEND_ACTORS = Marshal.load(file)
        $actor_attr = Marshal.load(file)
        # If magic number is different from when saving
        # (if editing was added with editor)
        if $game_system.magic_number != $data_system.magic_number
          # Load map
          $game_map.setup($game_map.map_id)
          $game_player.center($game_player.x, $game_player.y)
        end
        # Refresh party members
        $game_party.refresh
      end
    end
    #--------------------------------------------------------------------------
    # ? return the selected file's name
    #--------------------------------------------------------------------------
    def filename
      return "Save#{@file_window.index + 1}.rxdata"
    end   

And as a petition to the moderators, you should let more characters in the posts if they are in code or spoiler mode

***
Rep:
Level 88
Hell... What did I mess up now... I'm Back!
lol. Yes they should. I will take a look at you CMS in the morning... For now I have to retreat to bed... Hectic day...
----Current Games working on----
--Rage O' Delusion - Overall Percentage Finished : 4% -- Expected release... Unknown
--The Other Dimension - Overall Percentage done : 1 - Expected Release : No time soon...
v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^
Feildmaster Productions
Made By One Man Run by the Same...
Making Games for Everyone...
Oh yeah, and everything else web based
For a charge... Of course...