• Benvenuto in Making Videogames!
  • Dai sfogo alla tua fantasia!
  • Crea il tuo Videogioco!
Benvenuto ospite! Login Registrati




Valutazione discussione:
  • 1 voto(i) - 4 media
  • 1
  • 2
  • 3
  • 4
  • 5
Sferografia
#1
Sferografia (Sphere Grid System)

Descrizione
Questo script ricrea la Sferografia di Final Fantasy X



Autore

SephirotSpawn



Allegati
Demo - Scarica



Istruzioni per l'uso

Incollate questo script in una nuova pagina sopra al main


Codice:
#==============================================================================
# Sphere Grid System
#==============================================================================
# SephirothSpawn
# Version 1
# 1.20.06
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Sphere Grid System', 'SephirothSpawn', 1, '1.21.06')

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------

if SDK.state('Sphere Grid System') == true

#==============================================================================
# ** Sphere Grid Sytem
#==============================================================================

module Sphere_Grid_System
  #--------------------------------------------------------------------------
  # * Constants
  #     sphere_type :[character_name, character_hue, direction, pattern]
  #--------------------------------------------------------------------------
  # When Spheres Locks
    HP_SPHERE_GRAPHIC_ON = ['178-Switch01', 150, 4, 0]
    SP_SPHERE_GRAPHIC_ON = ['178-Switch01', 210, 4, 0]
    STR_SPHERE_GRAPHIC_ON = ['178-Switch01', 30, 4, 0]
    DEX_SPHERE_GRAPHIC_ON = ['178-Switch01', 0, 4, 1]
    AGI_SPHERE_GRAPHIC_ON = ['178-Switch01', 0, 4, 0]
    INT_SPHERE_GRAPHIC_ON = ['178-Switch01', 0, 4, 2]
    ABILITIY_SPHERE_GRAPHIC_ON = ['178-Switch01', 0, 4, 3]
    LOCKA_GRAPHIC_ON = ['183-Rock02', 0, 4, 0]
    LOCKB_GRAPHIC_ON = ['183-Rock02', 0, 4, 0]
    LOCKC_GRAPHIC_ON = ['183-Rock02', 0, 4, 0]
    LOCKD_GRAPHIC_ON = ['183-Rock02', 0, 4, 0]
  # When Spheres Unlocked
    HP_SPHERE_GRAPHIC_OFF = ['178-Switch01', 150, 8, 0]
    SP_SPHERE_GRAPHIC_OFF = ['178-Switch01', 210, 8, 0]
    STR_SPHERE_GRAPHIC_OFF = ['178-Switch01', 30, 8, 0]
    DEX_SPHERE_GRAPHIC_OFF = ['178-Switch01', 0, 8, 1]
    AGI_SPHERE_GRAPHIC_OFF = ['178-Switch01', 0, 8, 0]
    INT_SPHERE_GRAPHIC_OFF = ['178-Switch01', 0, 8, 2]
    ABILITIY_SPHERE_GRAPHIC_OFF = ['178-Switch01', 0, 8, 3]
    LOCKA_GRAPHIC_OFF = ['', 0, 8, 0]
    LOCKB_GRAPHIC_OFF = ['', 0, 8, 0]
    LOCKC_GRAPHIC_OFF = ['', 0, 8, 0]
    LOCKD_GRAPHIC_OFF = ['', 0, 8, 0]
end

#==============================================================================
# ** Game_Temp
#==============================================================================

class Game_Temp
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :spheregrid_return_map_id
  attr_accessor :spheregrid_return_map_coordinates
  attr_accessor :spheregrid_return_actor_graphic
  attr_accessor :spheregrid_map_id
end

#==============================================================================
# ** Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :sphere_grid_event_list
  attr_accessor :sphere_grid_skills
  attr_accessor :sphere_grid_position
  attr_accessor :character_name
  attr_accessor :character_hue
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_spheregridsystem_gameactor_init initialize
  alias seph_spheregridsystem_gameactor_skills skills
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor_id)
    # Orginal Initialization Method
    seph_spheregridsystem_gameactor_init(actor_id)
    # Sets Skill Grid Events List
    @sphere_grid_event_list = {}
    # Sets Skill Grid Skills
    @sphere_grid_skills = []
    # Sets Skill Grid Position
    @sphere_grid_position = [2, 1]
  end
  #--------------------------------------------------------------------------
  # * Gets Skills
  #--------------------------------------------------------------------------
  def skills
    # Adds Skill Grid Skills
    for id in @sphere_grid_skills
      learn_skill(id)
    end
    # Orginal Skills Method
    seph_spheregridsystem_gameactor_skills
  end
end


#==============================================================================
# ** Game_Party
#==============================================================================

class Game_Party
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :sphere_grid_hp_spheres
  attr_accessor :sphere_grid_sp_spheres
  attr_accessor :sphere_grid_str_spheres
  attr_accessor :sphere_grid_dex_spheres
  attr_accessor :sphere_grid_agi_spheres
  attr_accessor :sphere_grid_int_spheres
  attr_accessor :sphere_grid_ability_spheres
  attr_accessor :sphere_grid_level_a_locks
  attr_accessor :sphere_grid_level_b_locks
  attr_accessor :sphere_grid_level_c_locks
  attr_accessor :sphere_grid_level_d_locks
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_spheregridsystem_gameparty_init initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Orginal Initialization Method
    seph_spheregridsystem_gameparty_init
    # Sets Skill Grid Spheres
    @sphere_grid_hp_spheres = 0
    @sphere_grid_sp_spheres = 0
    @sphere_grid_str_spheres = 0
    @sphere_grid_dex_spheres = 0
    @sphere_grid_agi_spheres = 0
    @sphere_grid_int_spheres = 0
    @sphere_grid_ability_spheres = 0
    @sphere_grid_level_a_locks = 0
    @sphere_grid_level_b_locks = 0
    @sphere_grid_level_c_locks = 0
    @sphere_grid_level_d_locks = 0
  end
end

#==============================================================================
# ** Game_Map
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * Get RPG::Map
  #--------------------------------------------------------------------------
  def map
    return @map
  end
end

#==============================================================================
# ** Game_Event
#==============================================================================

class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :character_name
  attr_accessor :character_hue
  attr_accessor :direction
  attr_accessor :pattern
  attr_accessor :through
end

#==============================================================================
# ** Game_Player
#==============================================================================

class Game_Player
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor   :character_name
  attr_accessor   :character_hue
end

#==============================================================================
# ** Scene_Title
#==============================================================================

class Scene_Title
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_spheregridsystem_scenetitle_commandnewgame command_new_game
  #--------------------------------------------------------------------------
  # * Command: New Game
  #--------------------------------------------------------------------------
  def command_new_game
    # Orignal Command: New Game
    seph_spheregridsystem_scenetitle_commandnewgame
    # Collects Map Data
    mapinfo = load_data("Data/MapInfos.rxdata")
    mapinfo.each {|map_id, map|
      # Finds Sphere Grid Map
      if map.name == 'Sphere Grid'
        # Collects Sphere Grid Map Data
        @skill_map = load_data(sprintf("Data/Map%03d.rxdata", map_id))
        # Sets Sphere Grid Map Id
        $game_temp.spheregrid_map_id = map_id
      end }
    # Sphere Grid Events (For each actor access)
    grid_events = {}
    # Collects Events
    for event in @skill_map.events.values
      if event.name == 'Skill Grid Event'
        grid_events[event.id] = false
      end
    end
    # Sets All Actors Grid Event List
    for i in 1...$data_actors.size
      $game_actors[i].sphere_grid_event_list = grid_events.dup
    end
  end
end

#==============================================================================
# ** Window_SkillGridSpheres
#==============================================================================

class Window_SkillGridSpheres < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(400, 236, 236, 240)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 125
    refresh
    @stat_flag = false
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    # Draws Sphere Heading
    self.contents.font.size, self.contents.font.color = 22, system_color
    self.contents.draw_text(4, 0, contents.width - 8, 32, 'Collected Spheres', 1)
    # Draws Sphere Totals
    self.contents.font.size, self.contents.font.color = 16, normal_color
    sphere_names = ['Hp', 'Sp', 'Strength', 'Dexterity', 'Agility',
      'Intellect', 'Ability'].collect! {|x| x + ' Spheres'}
    sphere_names << ['a', 'b', 'c', 'd'].collect! {|x| "Grid Locks Level #{x.upcase}"}
    sphere_totals = ['hp', 'sp', 'str', 'dex', 'agi', 'int', 'ability'].collect! {|x|
      eval "$game_party.sphere_grid_#{x}_spheres"}
    sphere_totals << ['a', 'b', 'c', 'd'].collect! {|x| eval "$game_party.sphere_grid_level_#{x}_locks"}
    sphere_totals.flatten!
    for i in 0...sphere_names.flatten!.size
      self.contents.draw_text(8, 32 + i * 16, contents.width - 16, 16, sphere_names[i])
      self.contents.draw_text(8, 32 + i * 16, contents.width - 16, 16, sphere_totals[i].to_s, 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Set Required Sphere
  #--------------------------------------------------------------------------
  def set_required_sphere(sphere)
    # Sets Stat Flag
    @stat_flag = true
    # Collects Change Parameters
    case sphere
    when 'Hp'
      y, sphere, total = 32, 'Hp Sphere', $game_party.sphere_grid_hp_spheres
    when 'Sp'
      y, sphere, total = 48, 'Sp Sphere', $game_party.sphere_grid_sp_spheres
    when 'Str'
      y, sphere, total = 64, 'Strength Sphere', $game_party.sphere_grid_str_spheres
    when 'Dex'
      y, sphere, total = 80, 'Dexterity Sphere', $game_party.sphere_grid_dex_spheres
    when 'Agi'
      y, sphere, total = 96, 'Agility Sphere', $game_party.sphere_grid_agi_spheres
    when 'Int'
      y, sphere, total = 112, 'Intellect Sphere', $game_party.sphere_grid_int_spheres
    when 'Ability'
      y, sphere, total = 128, 'Ability Sphere', $game_party.sphere_grid_ability_spheres
    when 'LockA'
      y, sphere, total = 144, 'Grid Locks Level A', $game_party.sphere_grid_level_a_locks
    when 'LockB'
      y, sphere, total = 160, 'Grid Locks Level B', $game_party.sphere_grid_level_b_locks
    when 'LockC'
      y, sphere, total = 176, 'Grid Locks Level C', $game_party.sphere_grid_level_c_locks
    when 'LockD'
      y, sphere, total = 192, 'Grid Locks Level D', $game_party.sphere_grid_level_d_locks
    end
    # Clear Contents
    self.contents.fill_rect(0, y, contents.width, 16, Color.new(0, 0, 0, 0))
    # Redraws Spheres
    self.contents.font.color = total > 0 ? Color.new(0, 200, 0) : Color.new(200, 0, 0)
    self.contents.draw_text(8, y, contents.width - 16, 16, sphere)
    self.contents.draw_text(8, y, contents.width - 16, 16, (total - 1).to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Reset Contents
  #--------------------------------------------------------------------------
  def reset_contents
    if @stat_flag
      @stat_flag = false
      refresh
    end
  end
end

#==============================================================================
# ** Window_SkillGridStatus
#==============================================================================

class Window_SkillGridStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor_index)
    super(4, 68, 236, 112)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 125
    @actor = $game_party.actors[actor_index]
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    # Collects Skill Grid Totals
    skills, stats, locks = 0, 0, 0
    unlocked_skills, unlocked_stats, unlocked_locks = 0, 0, 0
    for event in $game_map.events.values
      if event.list[0].code == 108
        if event.list[0].parameters[0].include?('Skill')
          skills += 1
          if @actor.sphere_grid_event_list[event.id]
            unlocked_skills += 1
          end
        elsif event.list[0].parameters[0].dup.sub!(/\d/, '')
          stats += 1
          if @actor.sphere_grid_event_list[event.id]
            unlocked_stats += 1
          end
        elsif event.list[0].parameters[0].include?('Lock')
          locks += 1
          if @actor.sphere_grid_event_list[event.id]
            unlocked_locks += 1
          end
        end
      end
    end
    # Draws Sphere Totals Headings
    self.contents.font.size, self.contents.font.color = 22, system_color
    self.contents.draw_text(0, 0, contents.width, 32, "Grid Totals For #{@actor.name}", 1)
    # Draws Skill Totals
    self.contents.font.size, self.contents.font.color = 16, unlocked_skills ==
      skills ? Color.new(0, 255, 0) : normal_color
    self.contents.draw_text(8, 32, contents.width - 16, 16, 'Skill Spheres Unlocked')
    self.contents.draw_text(8, 32, contents.width - 16, 16, "#{unlocked_skills} / #{skills}", 2)
    # Draws Stat Totals
    self.contents.font.size, self.contents.font.color = 16, unlocked_stats ==
      stats ? Color.new(0, 255, 0) : normal_color
    self.contents.draw_text(8, 48, contents.width - 16, 16, 'Stat Spheres Unlocked')
    self.contents.draw_text(8, 48, contents.width - 16, 16, "#{unlocked_stats} / #{stats}", 2)
    # Draws Lock Totals
    self.contents.font.size, self.contents.font.color = 16, unlocked_locks ==
      locks ? Color.new(0, 255, 0) : normal_color
    self.contents.draw_text(8, 64, contents.width - 16, 16, 'Grid Locks Unlocked')
    self.contents.draw_text(8, 64, contents.width - 16, 16, "#{unlocked_locks} / #{locks}", 2)
  end
end

#==============================================================================
# ** Window_SkillGridActorStatus
#==============================================================================

class Window_SkillGridActorStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor_index)
    super(4, 332, 392, 144)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 125
    @actor = $game_party.actors[actor_index]
    @page = 1
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @page == 1 ? draw_status : draw_skills
  end
  #--------------------------------------------------------------------------
  # * Draw Status
  #--------------------------------------------------------------------------
  def draw_status
    # Draws Actor Heading
    self.contents.font.size, self.contents.font.color = 22, system_color
    self.contents.draw_text(0, 0, contents.width, 32, @actor.name + ' Stastics')
    # Draws Stats
    stat_words = ['hp', 'sp', 'str', 'dex', 'agi', 'int', 'atk', 'pdef' , 'mdef'].collect! {|x|
      eval "$data_system.words.#{x}"} << 'Evasion'
    stat_amounts = ["#{@actor.hp} / #{@actor.maxhp}", "#{@actor.sp} / #{@actor.maxsp}"]
    stat_amounts << ['str', 'dex' , 'agi', 'int', 'atk' , 'pdef' , 'mdef', 'eva'].collect! {|x|
      eval "@actor.#{x}"}
    self.contents.font.size, self.contents.font.color = 16, normal_color
    for i in 0...stat_amounts.flatten!.size
      x, y = (i % 2) * contents.width / 2 + 8, 32 + 16 * (i / 2)
      self.contents.draw_text(x, y, contents.width / 2 - 16, 16, stat_words[i])
      self.contents.draw_text(x, y, contents.width / 2 - 16, 16, stat_amounts[i].to_s, 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Skills
  #--------------------------------------------------------------------------
  def draw_skills
    # Draws Actor Heading
    self.contents.font.size, self.contents.font.color = 22, system_color
    self.contents.draw_text(0, 0, contents.width, 32, @actor.name + ' Skills')
    # Draws Skill
    self.contents.font.size, self.contents.font.color = 16, normal_color
    for i in 0...@actor.sphere_grid_skills.size
      x, y = (i % 3) * contents.width / 3, 32 + 16 * (i / 3)
      skill_name = $data_skills[@actor.sphere_grid_skills[i]].name
      self.contents.draw_text(x + 4, y, contents.width / 3 - 8, 16, skill_name)
    end
  end
  #--------------------------------------------------------------------------
  # * Next Page
  #--------------------------------------------------------------------------
  def next_page
    @page = @page == 1 ? 2 : 1
    refresh
  end
end

#==============================================================================
# ** Scene_SphereGrid
#==============================================================================

class Scene_SphereGrid
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor_index, setup_return_id = false)
    # Actor Index from Game Party
    @actor_index = actor_index
    # Sets Actor
    @actor = $game_party.actors[@actor_index]
    # Sets Return Coordinates
    if setup_return_id
      $game_temp.spheregrid_return_map_id = $game_map.map_id
      $game_temp.spheregrid_return_map_coordinates = [$game_player.x, $game_player.y]
      actor = $game_party.actors[0]
      $game_temp.spheregrid_return_actor_graphic = [actor.character_name, actor.character_hue]
    end
    # Changes Character Graphic
    $game_player.character_name = @actor.character_name
    $game_player.character_hue = @actor.character_hue
    # Moves to Skill Map
    $game_map.setup($game_temp.spheregrid_map_id)
    coordinates = @actor.sphere_grid_position
    $game_player.moveto(coordinates[0], coordinates[1])
    # Update Events
    update_events
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make sprite set
    @spriteset = Spriteset_Map.new
    # Make message window
    @message_window = Window_Message.new
    # Make Help Window
    @help_window = Window_Help.new
      @help_window.back_opacity = 125
    # Make Spheres Window
    @sphere_totals = Window_SkillGridSpheres.new
    # Make Actor Status Window
    @actor_status = Window_SkillGridActorStatus.new(@actor_index)
    # Make Grid Stats Window
    @grid_status = Window_SkillGridStatus.new(@actor_index)
    # Conformation Window
    @confim_window = Window_Command.new(100, ['Yes', 'No'])
      @confim_window.x, @confim_window.y = 270, 192
      @confim_window.active = @confim_window.visible = false
      @confim_window.back_opacity = 125
    # Advancement Parameters
    @parameters = []
    # Transition run
    Graphics.transition(40, "Graphics/Transitions/#{$data_system.battle_transition}")
    # Main loop
    while $scene == self
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of sprite set
    @spriteset.dispose
    # Dispose of windows
    @message_window.dispose
    @help_window.dispose
    @sphere_totals.dispose
    @actor_status.dispose
    @grid_status.dispose
    @confim_window.dispose
    # Resets Map Information
    if $scene.is_a?(Scene_Menu)
      $game_map.setup($game_temp.spheregrid_return_map_id)
      $game_player.moveto($game_temp.spheregrid_return_map_coordinates[0],
        $game_temp.spheregrid_return_map_coordinates[1])
      $game_player.character_name = $game_temp.spheregrid_return_actor_graphic[0]
      $game_player.character_hue = $game_temp.spheregrid_return_actor_graphic[1]
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If A button was pressed
    if Input.trigger?(Input::A)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Moves to Menu Scene
      @actor_status.next_page
    end
    # If X button was pressed
    if Input.trigger?(Input::X)
      # Play cursor SE
      $game_system.se_play($data_system.cursor_se)
      # Toggle Sphere Totals Window
      @sphere_totals.visible = @sphere_totals.visible ? false : true
    end
    # If Y button was pressed
    if Input.trigger?(Input::Y)
      # Play cursor SE
      $game_system.se_play($data_system.cursor_se)
      # Toggle Sphere Totals Window
      @actor_status.visible = @actor_status.visible ? false : true
    end
    # If Z button was pressed
    if Input.trigger?(Input::Z)
      # Play cursor SE
      $game_system.se_play($data_system.cursor_se)
      # Toggle Sphere Totals Window
      @grid_status.visible = @grid_status.visible ? false : true
    end
    # Conformation Method
    if @confim_window.active
      update_confirm
      return
    end
    # Clears Help Window Text
    @help_window.set_text('', 1)
    # Loop
    loop do
      # Update map, interpreter, and player order
      # (this update order is important for when conditions are fulfilled
      # to run any event, and the player isn't provided the opportunity to
      # move in an instant)
      $game_map.update
      $game_system.map_interpreter.update
      $game_player.update
      # Update system (timer), screen
      $game_system.update
      $game_screen.update
      # Abort loop if player isn't place moving
      unless $game_temp.player_transferring
        break
      end
      # Run place move
      transfer_player
      # Abort loop if transition processing
      if $game_temp.transition_processing
        break
      end
    end
    # Update sprite set
    @spriteset.update
    # Update message window
    @message_window.update
    # If showing message window
    if $game_temp.message_window_showing
      return
    end
    # Clears Learning Variables
    event_id, unlocked, parameters = nil, false, nil
    # Checks Each Event
    for event in $game_map.events.values
      # If Player is In Range
      if check_range(event, $game_player)
        # Sets Event Id Flag
        event_id = event.id
        # If Event Unlocked
        if @actor.sphere_grid_event_list[event_id]
          # Sets Help Window Text to Unlocked
          @help_window.set_text('Grid Unlocked', 1)
          # Sets unlocked Flag
          unlocked = true
        else
          # Sets Help Window Text to Skill Grid Type
          if event.list[0].code == 108
            # Gets Stat
            stat = event.list[0].parameters[0]
            # Skill Learning
            if stat.include?('Skill')
              for i in 1...$data_skills.size
                if stat.include?($data_skills[i].name)
                  parameters = ["Learn Skill #{$data_skills[i].name}", i]
                end
              end
            # Stat Learning
            elsif stat.dup.sub!(/(\d+)/, '')
              # Gets Value
              c = $1
              # Gets Parameter Type
              stat.dup.sub!(/(\w+)/, '')
              b = $1
              parameters = ["Increase #{b} by #{c}", b, c]
            # Grid Lock
            elsif stat.include?('Lock')
              parameters = ["Grid #{stat}"]
            end
            # Draws Help Text
            @help_window.set_text((parameters.nil? ? event.list[0].parameters[0] : parameters[0]), 1)
          end
        end
      end
    end
    # Updates Sphere Totals Window
    if parameters.nil?
      @sphere_totals.reset_contents
    else
      @sphere_totals.set_required_sphere(parameters.size == 2 ? 'Ability' :
        parameters.size == 3 ? parameters[1] : parameters[0].delete!('Grid '))
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Changes Actors Skill Grid Coordinates
      @actor.sphere_grid_position = [$game_player.x, $game_player.y]
      # Moves to Menu Scene
      $scene = Scene_Menu.new
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      return if parameters.nil?
      # Learn Skills
      if parameters.size == 2
        # Checks to Make Sure Enough Ability Spheres
        if $game_party.sphere_grid_ability_spheres < 1
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Sets Parameters
        @parameters = ["Are you sure you want to #{parameters[0]}?",
          parameters[1], event_id]
        # Makes Conformation Window Active
        @confim_window.index = 0
        @confim_window.active = @confim_window.visible = true
        return
      # Increase Stats
      elsif parameters.size == 3
        # Checks for Spheres
        case parameters[1]
        when 'Hp'
          check = $game_party.sphere_grid_hp_spheres
        when 'Sp'
          check = $game_party.sphere_grid_sp_spheres
        when 'Str'
          check = $game_party.sphere_grid_str_spheres
        when 'Dex'
          check = $game_party.sphere_grid_dex_spheres
        when 'Agi'
          check = $game_party.sphere_grid_agi_spheres
        when 'Int'
          check = $game_party.sphere_grid_int_spheres
        end
        if check < 1
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Sets Parameters
        @parameters = ["Are you sure you want to #{parameters[0]}?",
          parameters[1], parameters[2].to_i, event_id]
        # Makes Conformation Window Active
        @confim_window.index = 0
        @confim_window.active = @confim_window.visible = true
        return
      # Grid Locks
      elsif parameters.size == 1
        # Help Text
        text = 'Are you sure you want to '
        # Checks Lock Amounts
        case parameters[0]
        when 'LockA'
          check = $game_party.sphere_grid_level_a_locks
          text += 'Unlock Grid Lock A'
        when 'LockB'
          check = $game_party.sphere_grid_level_b_locks
          text += 'Unlock Grid Lock B'
        when 'LockC'
          check = $game_party.sphere_grid_level_c_locks
          text += 'Unlock Grid Lock C'
        when 'LockD'
          check = $game_party.sphere_grid_level_d_locks
          text += 'Unlock Grid Lock D'
        end
        if check < 1
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Sets Parameters
        @parameters = [text, event_id]
        # Makes Conformation Window Active
        @confim_window.index = 0
        @confim_window.active = @confim_window.visible = true
        return
      end
    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
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      # Changes Actors Skill Grid Coordinates
      @actor.sphere_grid_position = [$game_player.x, $game_player.y]
      # Moves to New Actor
      $scene = Scene_SphereGrid.new(@actor_index)
    end
    # If R button was pressed
    if Input.trigger?(Input::R)
      # Play cursor SE
      $game_system.se_play($data_system.cursor_se)
      # To next actor
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      # Changes Actors Skill Grid Coordinates
      @actor.sphere_grid_position = [$game_player.x, $game_player.y]
      # Moves to New Actor
      $scene = Scene_SphereGrid.new(@actor_index)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update : Conformation
  #--------------------------------------------------------------------------
  def update_confirm
    # Updates Confirm Window
    @confim_window.update
    # Sets Help Window
    @help_window.set_text(@parameters[0])
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Turns off Confirm Window
      @confim_window.visible = @confim_window.active = false
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      if @confim_window.index == 1
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Turns off Confirm Window
        @confim_window.visible = @confim_window.active = false
      else
        # Skill Learning
        if @parameters.size == 3
          # Lowers Abilitiy Spheres
          $game_party.sphere_grid_ability_spheres -= 1
          # Turns Off Grid Event For Actor
          @actor.sphere_grid_event_list[@parameters[2]] = true
          # Learns Skill
          @actor.sphere_grid_skills << @parameters[1]
          # Refreshes Total Window
          @sphere_totals.refresh
          # Refreshs Skills Window
          @actor_status.refresh
          # Refreshes Grid Status Window
          @grid_status.refresh
          # Turns off Confirm Window
          @confim_window.visible = @confim_window.active = false
          # Gets Event ID
          event_id = @parameters[2]
        elsif @parameters.size == 4
          case @parameters[1]
          when 'Hp'
            # Lowers Spheres
            $game_party.sphere_grid_hp_spheres -= 1
            # Raises Stat
            @actor.maxhp += @parameters[2]
          when 'Sp'
            # Lowers Spheres
            $game_party.sphere_grid_sp_spheres -= 1
            # Raises Stat
            @actor.maxsp += @parameters[2]
          when 'Str'
            # Lowers Spheres
            $game_party.sphere_grid_str_spheres -= 1
            # Raises Stat
            @actor.str += @parameters[2]
          when 'Dex'
            # Lowers Spheres
            $game_party.sphere_grid_dex_spheres -= 1
            # Raises Stat
            @actor.dex += @parameters[2]
          when 'Agi'
            # Lowers Spheres
            $game_party.sphere_grid_agi_spheres -= 1
            # Raises Stat
            @actor.agi += @parameters[2]
          when 'Int'
            # Lowers Spheres
            $game_party.sphere_grid_int_spheres -= 1
            # Raises Stat
            @actor.int += @parameters[2]
          end
          # Turns Off Grid Event For Actor
          @actor.sphere_grid_event_list[@parameters[3]] = true
          # Refreshes Total Window
          @sphere_totals.refresh
          # Refreshs Skills Window
          @actor_status.refresh
          # Refreshes Grid Status Window
          @grid_status.refresh
          # Turns off Confirm Window
          @confim_window.visible = @confim_window.active = false
          # Gets Event ID
          event_id = @parameters[3]
        elsif @parameters.size == 2
          # Lowers Lock Spheres
          case @parameters[0].reverse[0, 1]
          when 'A'
            $game_map.events[@parameters[1]].character_name =
              Sphere_Grid_System::LOCKA_GRAPHIC_OFF[0]
            $game_party.sphere_grid_level_a_locks -= 1
          when 'B'
            $game_map.events[@parameters[1]].character_name =
              Sphere_Grid_System::LOCKB_GRAPHIC_OFF[0]
            $game_party.sphere_grid_level_b_locks -= 1
          when 'C'
            $game_map.events[@parameters[1]].character_name =
              Sphere_Grid_System::LOCKC_GRAPHIC_OFF[0]
            $game_party.sphere_grid_level_c_locks -= 1
          when 'D'
            $game_map.events[@parameters[1]].character_name =
              Sphere_Grid_System::LOCKD_GRAPHIC_OFF[0]
            $game_party.sphere_grid_level_d_locks -= 1
          end
          # Turns Off Grid Event For Actor
          @actor.sphere_grid_event_list[@parameters[1]] = true
          # Changes Events Graphic
          $game_map.events[@parameters[1]].character_name = ''
          # Refreshes Total Window
          @sphere_totals.refresh
          # Refreshs Skills Window
          @actor_status.refresh
          # Refreshes Grid Status Window
          @grid_status.refresh
          # Turns off Confirm Window
          @confim_window.visible = @confim_window.active = false
          # Gets Event ID
          event_id = @parameters[1]
        end
        # Updates Events
        $game_map.events[event_id].direction = 8
        $game_map.events[event_id].through = true
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Check Range
  #--------------------------------------------------------------------------
  def check_range(element, object, range = 1)
    x = (element.x - object.x) * (element.x - object.x)
    y = (element.y - object.y) * (element.y - object.y)
    r = x + y
    return r <= (range * range)
  end
  #--------------------------------------------------------------------------
  # * Update Events
  #--------------------------------------------------------------------------
  def update_events
    # Sets Event Graphics
    for event in $game_map.events.values
      if @actor.sphere_grid_event_list.has_key?(event.id)
        if event.list[0].code == 108
          stat = event.list[0].parameters[0]
          # Grid Locks
          if stat.include?('Lock')
            unless @actor.sphere_grid_event_list[event.id]
              case stat.reverse[0, 1]
              when 'A'
                graphic_parameters = Sphere_Grid_System::LOCKA_GRAPHIC_ON
              when 'B'
                graphic_parameters = Sphere_Grid_System::LOCKB_GRAPHIC_ON
              when 'C'
                graphic_parameters = Sphere_Grid_System::LOCKC_GRAPHIC_ON
              when 'D'
                graphic_parameters = Sphere_Grid_System::LOCKD_GRAPHIC_ON
              end
            else
              case stat.reverse[0, 1]
              when 'A'
                graphic_parameters = Sphere_Grid_System::LOCKA_GRAPHIC_OFF
              when 'B'
                graphic_parameters = Sphere_Grid_System::LOCKB_GRAPHIC_OFF
              when 'C'
                graphic_parameters = Sphere_Grid_System::LOCKC_GRAPHIC_OFF
              when 'D'
                graphic_parameters = Sphere_Grid_System::LOCKD_GRAPHIC_OFF
              end
            end
          # Skill Sphere
          elsif stat.include?('Skill')
            unless @actor.sphere_grid_event_list[event.id]
              graphic_parameters = Sphere_Grid_System::ABILITIY_SPHERE_GRAPHIC_ON
            else
              graphic_parameters = Sphere_Grid_System::ABILITIY_SPHERE_GRAPHIC_OFF
            end
          # Stat Spheres
          elsif stat.dup.sub!(/(\d+)/, '')
            stat.dup.sub(/(\w+)/, '')
            unless @actor.sphere_grid_event_list[event.id]
              case $1
              when 'Hp'
                graphic_parameters = Sphere_Grid_System::HP_SPHERE_GRAPHIC_ON
              when 'Sp'
                graphic_parameters = Sphere_Grid_System::SP_SPHERE_GRAPHIC_ON
              when 'Str'
                graphic_parameters = Sphere_Grid_System::STR_SPHERE_GRAPHIC_ON
              when 'Dex'
                graphic_parameters = Sphere_Grid_System::DEX_SPHERE_GRAPHIC_ON
              when 'Agi'
                graphic_parameters = Sphere_Grid_System::AGI_SPHERE_GRAPHIC_ON
              when 'Int'
                graphic_parameters = Sphere_Grid_System::INT_SPHERE_GRAPHIC_ON
              end
            else
              case $1
              when 'Hp'
                graphic_parameters = Sphere_Grid_System::HP_SPHERE_GRAPHIC_OFF
              when 'Sp'
                graphic_parameters = Sphere_Grid_System::SP_SPHERE_GRAPHIC_OFF
              when 'Str'
                graphic_parameters = Sphere_Grid_System::STR_SPHERE_GRAPHIC_OFF
              when 'Dex'
                graphic_parameters = Sphere_Grid_System::DEX_SPHERE_GRAPHIC_OFF
              when 'Agi'
                graphic_parameters = Sphere_Grid_System::AGI_SPHERE_GRAPHIC_OFF
              when 'Int'
                graphic_parameters = Sphere_Grid_System::INT_SPHERE_GRAPHIC_OFF
              end
            end
          end
          # Changes event graphics
          event.character_hue = graphic_parameters[1]
          event.direction = graphic_parameters[2]
          event.pattern = graphic_parameters[3]
          event.character_name = graphic_parameters[0]
          event.through = @actor.sphere_grid_event_list[event.id]
        end
      end
    end
  end
end

#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end

Poi, creiamo un mappa chiamata 'Sphere Grid'.
Questa sarà la nostra mappa, come negli screen , per il sistema delle sfere.
Per questa mappa servirebbe un tileset che posterò dopo, ma siccome nella demo ci sono anche suoni, vi suggerisco di scaricarla, sono solo 200k.

In questa mappa creiamo i nostri eventi così:
Il nome dell'evento sarà: Skill Grid Event
Dentro all'evento creeremo un commento a seconda dell'abilità che vogliamo incrementare:

Grid Locks (Per bloccare le sfere)
Aggiungi un commento 'Lock' con A - D, che influenzrà il livello di blocco delle sfere.
Skill Spheres (Per imparare abilità)
Aggiungi un commento 'Skill: ' più il nome dell'abilità come appare nel database
Stat Spheres (Per aumentare gli attributi)
Semplicemente aggiungi uno dei seguenti: Hp, Sp, Str, Dex, Agi o Int, Seguito dal numero di quanto aumenterà l'abilità.
Ad esempio Hp 500 aumenterà gli hp di 500.
Per sicurezza guardate pure i commenti della demo

Premessa: io non ho mai giocato a ff x e non so come realmente funziona questo sistema di sfere. Mi pare che non si potessero sbloccare subito così, ma bisognasse effettuare delle missioni.
Quindi, per sbloccarle e bloccarele, o usate delle switch. O almeno credo che non ci sia un modo richiamando stringhe, ma se qualcuno lo sa mi fa un piacere XD

Poi....
Da quello che ho capito queste variabili vengono settate all'inizio del gioco con un autostart che le setta su 4, penso che sia il numero di sfere di ogni tipo a disposizione.


Codice:
$game_party.sphere_grid_hp_spheres
$game_party.sphere_grid_sp_spheres
$game_party.sphere_grid_str_spheres
$game_party.sphere_grid_dex_spheres
$game_party.sphere_grid_agi_spheres
$game_party.sphere_grid_int_spheres
$game_party.sphere_grid_ability_spheres
$game_party.sphere_grid_level_a_locks
$game_party.sphere_grid_level_b_locks
$game_party.sphere_grid_level_c_locks
$game_party.sphere_grid_level_d_locks
Infine, per richiamere l'evento e teletrasportarsi nella mappa, usate la stringa


Codice:
$scene = Scene_SphereGrid.new(0, true)
 
Rispondi
  


Vai al forum:


Browsing: 1 Ospite(i)