Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Sign in to follow this  
Anthonyaiken

FFXII License question

Recommended Posts

I am using FFXII Battle system.Some of you find it buggy but mine does not bug me.My doubts are in the Licenses part.Is there any way to place weapons and armors in the license board?

Share this post


Link to post
Share on other sites

Here is the Demo.

http://www.4shared.com/file/cOZ1Byzg/FFXII_2.html

 

 

Here is the script.

 

 

#===============================================================================
# FFXII - Licence_Spot
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Licence_Spot

 attr_accessor :x
 attr_accessor :y
 attr_accessor :type
 attr_accessor :id
 attr_accessor :cost
 attr_accessor :get
 attr_accessor :near

 def initialize(x, y, type, id, cost=1)
   @x = x
   @y = y
   @type = type
   @id = id
   @cost = cost
   @get = false
   @near = false
 end

 def setup(spot)
   return unless spot.is_a?(Licence_Spot)
   @x = spot.x
   @y = spot.y
   @type = spot.type
   @id = spot.id
   @cost = spot.cost
   @get = spot.get
   @near = spot.near
 end

end

#===============================================================================
# FFXII - Licence_Table
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Licence_Table

 def initialize
   @data = []
 end

 def [](x, y)
   if @data[x].nil?
     @data[x] = []
   end
   return @data[x][y]
 end

 def []=(x, y, valor)
   if @data[x].nil?
     @data[x] = []
   end
   @data[x][y] = valor
 end

 def each
   for x in 0...@data.size
     next if @data[x].nil?
     for y in 0...@data[x].size
       next if @data[x][y].nil?
       yield @data[x][y]
     end
   end
 end

 def refresh_table
   data = [-1, 0, 1]
   self.each {|i|
     next if i.nil?
     i.near = false
   }
   for x in 0...@data.size
     next if @data[x].nil?
     for y in 0...@data[x].size
       if @data[x][y].get
         for i1 in 0..2
           for i2 in 0..2
             next if [[0, 0], [0, 2], [2, 0], [2, 2]].include?([i1, i2])
             real_i1 = [[x+i1-1, 0].max, @data.size-1].min
             real_i2 = [[y+i2-1, 0].max, @data[x].size-1].min
             self[real_i1, real_i2].near = true
           end
         end
       end
     end
   end
 end

end  

#===============================================================================
# FFXII - Sprite_Licences_Spot
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Sprite_Licences_Spot < Sprite

 include FFXII::LICENCES

 def initialize(viewport, house)
   super(viewport)
   @house = house
   @house_picture = RPG::Cache.licence(PICTURE_SQUARE[((@house.x + 1) + (@house.y + 1)) % PICTURE_SQUARE.size])
   @house_sprite = Sprite.new(@viewport)
   self.bitmap = Bitmap.new(@house_picture.width, @house_picture.height)
   refresh
 end

 def x=(valor)
   super
   @house_sprite.x = self.x
 end

 def y=(valor)
   super
   @house_sprite.y = self.y
 end

 def dispose
   if self.bitmap != nil
     self.bitmap.dispose
     self.bitmap = nil
   end
   @house_sprite.dispose
   super()
 end

 def refresh
   return if @house.type == ""
   @house_bonus = RPG::Cache.licence((LICENCE_PICTURES[@house.type].nil? ? "" : LICENCE_PICTURES[@house.type]))
   self.bitmap.clear
   self.bitmap.blt(0, 0, @house_picture, Rect.new(0, 0, @house_picture.width, @house_picture.height))
   if @house.near == false and @house.get == false
     @house_sprite.bitmap = nil
     return
   end
   x = (self.bitmap.width / 2) - (@house_bonus.width / 2)
   y = (self.bitmap.height / 2) - (@house_bonus.height / 2)
   @house_sprite.bitmap = @house_bonus
   @house_sprite.ox = -x
   @house_sprite.oy = -y
   @house_sprite.color.set(0, 0, 0, 0)
   if (@house.get == false)
     @house_sprite.color.set(128, 128, 128, 128)
     return
   end
 end

end

#===============================================================================
# FFXII - Spriteset_Licence_Spots
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Spriteset_Licence_Spots

 include FFXII::LICENCES

 attr_reader :ox
 attr_reader :oy

 def initialize(actor_data)
   @ox = 0
   @oy = 0
   @actor_data = actor_data
   @viewport = Viewport.new(0, 0, 640, 480)
   @back = Plane.new(@viewport)
   @back.bitmap = RPG::Cache.licence(LICENCE_BACK)
   @licence_spots = Licence_Table.new
   for x in 0...MAX_LICENCES_WIDTH
     for y in 0...MAX_LICENCES_HEIGHT
       sprite = Sprite_Licences_Spot.new(@viewport, @actor_data[x, y])
       sprite.x = x * 32
       sprite.y = y * 32
       @licence_spots[x, y] = sprite
     end
   end  
 end

 def refresh(x, y)
   @licence_spots[x, y].refresh
 end

 def refresh_all
   for x in 0...MAX_LICENCES_WIDTH
     for y in 0...MAX_LICENCES_HEIGHT
       @licence_spots[x, y].refresh
     end
   end
 end

 def update
   @back.ox += LICENCE_BACK_OX_SPEED
   @back.oy += LICENCE_BACK_OY_SPEED
 end

 def ox=(valor)
   return if @ox == valor
   @back.ox -= (@ox - valor)
   @ox = valor
   for x in 0...MAX_LICENCES_WIDTH
     for y in 0...MAX_LICENCES_HEIGHT
       @licence_spots[x, y].ox = @ox
     end
   end
 end

 def oy=(valor)
   return if @oy == valor
   @back.oy -= (@oy - valor)
   @oy = valor
   for x in 0...MAX_LICENCES_WIDTH
     for y in 0...MAX_LICENCES_HEIGHT
       @licence_spots[x, y].oy = @oy
     end
   end
 end

 def dispose
   for x in @licence_spots
     next if x.nil?
     x.dispose
   end
   @licence_spots = []
   @back.dispose
   @viewport.dispose
 end

end

#===============================================================================
# FFXII - Sprite_Licence_Cursor
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Sprite_Licence_Cursor < Sprite

 #--------------------------------------------------------------------------
 # - Inicialização dos Objetos
 #--------------------------------------------------------------------------

 def initialize(counter_max=0, viewport=nil)
   if viewport.nil?
     super()
   else
     super(viewport)
   end
   @up_down = true
   self.bitmap = RPG::Cache.licence("glove")
   @cursor_growing = false
   @cursor_counter_max = counter_max
   @cursor_counter = 0
   @updating = false
 end

 #--------------------------------------------------------------------------
 # - Muda o Up_Down
 #--------------------------------------------------------------------------

 def up_down=(valor)
   @up_down = valor
   self.ox = 0
   self.oy = 0
 end

 #--------------------------------------------------------------------------
 # - Muda o OX
 #--------------------------------------------------------------------------

 def ox=(valor)
   super
   if (@updating == false)
     @cursor_counter = 0 
     @cursor_growing = false
   end
 end

 #--------------------------------------------------------------------------
 # - Muda o OY
 #--------------------------------------------------------------------------

 def oy=(valor)
   unless @up_down
     valor -= self.bitmap.height - 7
   end
   super
   if (@updating == false)
     @cursor_counter = 0 
     @cursor_growing = false
   end
 end

 #--------------------------------------------------------------------------
 # - Atualização
 #--------------------------------------------------------------------------

 def update
   super()
   @updating = true
   if @cursor_counter_max > 0
     if @cursor_growing
       if @up_down
         self.oy = self.oy - 1
       else
         self.ox = self.ox - 1
       end
       @cursor_counter = @cursor_counter + 1
       if @cursor_counter >= @cursor_counter_max
         @cursor_growing = false
         @cursor_counter = 0
       end
     else
       if @up_down
         self.oy = self.oy + 1
       else
         self.ox = self.ox + 1
       end
       @cursor_counter = @cursor_counter + 1
       if @cursor_counter >= @cursor_counter_max
         @cursor_growing = true
         @cursor_counter = 0
       end
     end
   end
   @updating = false
 end

end  

#===============================================================================
# FFXII - Window_Licence_Select
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Window_Licence_Select < Window_Command

 def initialize
   @data = ["hp", "sp", "str", "dex", "agi", "int", "skill", "skill_licence", ""]
   commands = []
   for x in @data
     case x
     when ""
       commands.push("Nada")
     when "skill_licence"
       commands.push("Skill Licence")
     else
       eval("commands.push($data_system.words.#{x})")
     end
   end
   commands.push("Sair")
   super(240, commands)
   self.back_opacity = 160
   self.y = 64
   self.height = 480-64
 end

 def data
   return @data[self.index]
 end

 def last_index?
   return (self.index == (@item_max - 1))
 end

 def update_help
   text = @commands[self.index]
   @help_window.set_text(text)
 end

end

#===============================================================================
# FFXII - Window_Licence_Select
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Window_Licence_Spot_Status < Window_Base

 attr_reader :spot

 def initialize(spot, actor=nil)
   super(0, 480-96, 640, 96)
   @spot = spot
   @actor = actor
   self.contents = Bitmap.new(width - 32, height - 32)
   self.back_opacity = 160
   refresh
 end

 def spot=(valor)
   return if @spot == valor
   @spot = valor
   refresh
 end

 def refresh
   self.contents.clear
   if @actor != nil
     text = "#{FFXII::LICENCES::LICENCE_POINTS_S} "
     text2 = sprintf("%04d", @actor.lp)
     self.contents.font.color = system_color
     self.contents.draw_text((width - 40) - self.contents.text_size(text2).width - self.contents.text_size(text).width, 32, self.contents.text_size(text).width, 32, text)
     self.contents.font.color = normal_color
     self.contents.draw_text((width - 40) - self.contents.text_size(text2).width, 32, self.contents.text_size(text2).width, 32, text2)
   end
   return if @spot.type == ""
   x = 4
   if @spot.type == "skill" or @spot.type == "skill_licence"
     refresh_skill
   else
     text = eval("$data_system.words.#{@spot.type}")
     self.contents.font.color = system_color
     self.contents.draw_text(x, 0, width - 40, 32, text)
     x += self.contents.text_size(text).width
     text = " +" + ((@spot.near == false and !@spot.get and !$scene.instance_of?(Scene_Create_Licences)) ? "???" : "#{@spot.id}")
     self.contents.font.color = normal_color
     self.contents.draw_text(x, 0, width - 40, 32, text)
   end
   self.contents.font.color = system_color
   text = "#{FFXII::LICENCES::LICENCE_POINTS_COST_S} "
   text2 = ((@spot.near == false and !@spot.get and !$scene.instance_of?(Scene_Create_Licences)) ? "????" : sprintf("%04d", @spot.cost))
   self.contents.draw_text((width - 40) - self.contents.text_size(text2).width - self.contents.text_size(text).width, 0, self.contents.text_size(text).width, 32, text)
   self.contents.font.color = normal_color
   self.contents.draw_text((width - 40) - self.contents.text_size(text2).width, 0, self.contents.text_size(text2).width, 32, text2)
   self.contents.draw_text(4, 32, width - 40, 32, "Owned") if @spot.get
 end

 def refresh_skill
   x = 4
   self.contents.font.color = system_color
   self.contents.draw_text(x, 0, 200, 32, $data_system.words.skill + " - ")
   x += [self.contents.text_size($data_system.words.skill + " - ").width, 200].min
   self.contents.font.color = normal_color
   if (@spot.near == false and !@spot.get and !$scene.instance_of?(Scene_Create_Licences))
     self.contents.draw_text(x, 0, 200, 32, "???")
     return
   end
   opacity = 255
   if @spot.type == "skill_licence"
     opacity = 160 unless $game_party.skill_learn?(@spot.id)
   end
   if $data_skills[@spot.id].icon_name != ""
     self.contents.blt(x, 0, RPG::Cache.icon($data_skills[@spot.id].icon_name), Rect.new(0, 0, 24, 24), opacity)
     x += 28
   end
   self.contents.font.color = disabled_color if opacity == 160
   self.contents.draw_text(x, 0, 200, 32, $data_skills[@spot.id].name)
 end

end

#===============================================================================
# FFXII - Window_Licence_Skills
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Window_Licence_Skills < Window_Command

 attr_reader :spot

 def initialize()
   commands = []
   for i in 1...$data_skills.size
     commands.push($data_skills[i].name)
   end
   super(640, commands)
   self.back_opacity = 160
   self.y = 64
   self.height = 480 - 64
 end

 def skill
   return ($data_skills[self.index+1])
 end

end

#===============================================================================
# FFXII - Scene_Create_Licences
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Scene_Create_Licences

 include FFXII::LICENCES

 def initialize(actor_id)
   @actor_id = actor_id
 end

 def main
   # Carregar o Banco de Dados
   $data_actors        = load_data("Data/Actors.rxdata")
   $data_classes       = load_data("Data/Classes.rxdata")
   $data_skills        = load_data("Data/Skills.rxdata")
   $data_items         = load_data("Data/Items.rxdata")
   $data_weapons       = load_data("Data/Weapons.rxdata")
   $data_armors        = load_data("Data/Armors.rxdata")
   $data_enemies       = load_data("Data/Enemies.rxdata")
   $data_troops        = load_data("Data/Troops.rxdata")
   $data_states        = load_data("Data/States.rxdata")
   $data_animations    = load_data("Data/Animations.rxdata")
   $data_tilesets      = load_data("Data/Tilesets.rxdata")
   $data_common_events = load_data("Data/CommonEvents.rxdata")
   $data_system        = load_data("Data/System.rxdata")
   # Criar um Sistema
   $game_system = Game_System.new
   begin
     @data = load_data("Data/Licences.rxdata")
   rescue
     @data = []
   end
   @actor_data = @data[@actor_id]
   if @actor_data.nil?
     @actor_data = Licence_Table.new
   end
   for x in 0...MAX_LICENCES_WIDTH
     for y in 0...MAX_LICENCES_HEIGHT
       if @actor_data[x, y].nil?
         @actor_data[x, y] = Licence_Spot.new(x, y, "", 0)
       end
     end
   end 
   @spriteset = Spriteset_Licence_Spots.new(@actor_data)
   @help_window = Window_Help.new
   @help_window.back_opacity = 160
   @window_select = Window_Licence_Select.new
   @window_select.help_window = @help_window
   @window_select.active = false
   @window_select.visible = false
   @window_select.index = 0
   @input_number = Window_InputNumber.new(4)
   @input_number.back_opacity = 160
   @input_number.opacity = 255
   @input_number.active = false
   @input_number.visible = false
   @help_window.visible = false
   @x = 0
   @y = 0
   @spot_info = Window_Licence_Spot_Status.new(@actor_data[@x, @y])
   @cursor = Sprite_Licence_Cursor.new(10)
   @cursor.x = (@x * 32)
   @cursor.y = (@y * 32) - 16
   Graphics.transition()
   loop {
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   }
   if decision_exit
     @actor_data = nil
   end
   Graphics.freeze
   Graphics.freeze
   @spriteset.dispose
   @window_select.dispose
   @help_window.dispose
   @input_number.dispose
   @spot_info.dispose
   @cursor.dispose
   @data[@actor_id] = @actor_data
   file = File.open("Data/Licences.rxdata", "wb")
   Marshal.dump(@data, file)
   file.close
 end

 def update
   if @window_select.active
     update_window_select
     return
   end
   @cursor.update
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = nil
     return
   end
   if Input.trigger?(Input::C)
     $game_system.se_play($data_system.decision_se)
     @window_select.active = true
     @window_select.visible = true
     @help_window.visible = true
     @spot_info.visible = false
     return
   end
   if Input.repeat?(Input::DOWN)
     if Input.trigger?(Input::DOWN) or @y < (MAX_LICENCES_HEIGHT - 1)
       $game_system.se_play($data_system.cursor_se)
       self.y = (@y + 1) % MAX_LICENCES_HEIGHT
       return
     end
   end
   if Input.repeat?(Input::UP)
     if Input.trigger?(Input::UP) or @y > 0
       $game_system.se_play($data_system.cursor_se)
       self.y = (@y - 1) % MAX_LICENCES_HEIGHT
       return
     end
   end
   if Input.trigger?(Input::LEFT)
     $game_system.se_play($data_system.cursor_se)
     self.x = (@x - 1) % MAX_LICENCES_WIDTH
     return
   end
   if Input.trigger?(Input::RIGHT)
     $game_system.se_play($data_system.cursor_se)
     self.x = (@x + 1) % MAX_LICENCES_WIDTH
     return
   end
 end

 def update_window_select
   @window_select.update
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     @window_select.active = false
     @window_select.visible = false
     @help_window.visible = false
     @spot_info.visible = true
     return
   end
   if Input.trigger?(Input::C)
     $game_system.se_play($data_system.decision_se)
     if @window_select.last_index?
       @window_select.active = false
       @window_select.visible = false
       @help_window.visible = false
       @spot_info.visible = true
       return
     end
     @actor_data[@x, @y].type = @window_select.data
     @spriteset.refresh(@x, @y)
     @window_select.active = false
     @window_select.visible = false
     if @actor_data[@x, @y].type == ""
       @help_window.y = 0
       @help_window.visible = false
       @spot_info.visible = true
       @spot_info.refresh
       return
     end
     phase = 0
     loop do
       if phase == 0
         if @window_select.data == "skill" or @window_select.data == "skill_licence"
           unless window_skill
             @window_select.active = true
             @window_select.visible = true
             return
           end          
         else
           unless input_number
             @window_select.active = true
             @window_select.visible = true
             return
           end
           @actor_data[@x, @y].id = @input_number.number
         end
       end
       unless input_lp_number
         phase = 0
         next
       end
       phase = 1
       if decision
         break
       end
     end
     @spriteset.refresh(@x, @y)
     @help_window.y = 0
     @help_window.visible = false
     @spot_info.visible = true
     @spot_info.refresh
     return
   end
 end

 def window_skill
   window = Window_Licence_Skills.new
   @help_window.y = 0
   @help_window.set_text("Choose the skill.") 
   loop do
     Graphics.update
     Input.update
     window.update
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       window.dispose
       return false
     end
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       break
     end
   end  
   @actor_data[@x, @y].id = window.skill.id
   window.dispose
   @help_window.y = 0
   return true
 end

 def input_number
   @input_number.number = 0
   @input_number.x = 320 - (@input_number.width / 2)
   @input_number.y = 240 - (@input_number.height / 2)
   @help_window.y = @input_number.y - 64
   @help_window.set_text("Set the value.", 1) 
   @input_number.active = true
   @input_number.visible = true
   loop do
     Graphics.update
     Input.update
     @input_number.update
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       @input_number.active = false
       @input_number.visible = false
       @help_window.y = 0
       return false
     end
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       break
     end
   end  
   @input_number.active = false
   @input_number.visible = false
   @help_window.y = 0
   return true
 end

 def input_lp_number
   @input_number.number = 0
   @input_number.x = 320 - (@input_number.width / 2)
   @input_number.y = 240 - (@input_number.height / 2)
   @help_window.y = @input_number.y - 64
   @help_window.set_text("Set the LP Cost value.", 1) 
   @input_number.active = true
   @input_number.visible = true
   loop do
     Graphics.update
     Input.update
     @input_number.update
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       @input_number.active = false
       @input_number.visible = false
       @help_window.y = 0
       return false
     end
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       break
     end
   end  
   @actor_data[@x, @y].cost = @input_number.number
   @input_number.active = false
   @input_number.visible = false
   @help_window.y = 0
   return true
 end

 def decision
   command = Window_Command.new(100, ["Yes", "No"])
   command.x = 320 - (command.width / 2)
   command.y = 240 - (command.height / 2)
   command.back_opacity = 160
   @help_window.y = command.y - 64
   @help_window.set_text("Will the hero starts with this place owned?", 1) 
   loop do
     Graphics.update
     Input.update
     command.update
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       command.dispose
       @help_window.y = 0
       return false
     end
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       break
     end
   end  
   @actor_data[@x, @y].get = (command.index == 0)
   command.dispose
   @help_window.y = 0
   return true
 end

 def decision_exit
   command = Window_Command.new(100, ["No", "Yes"])
   command.x = 320 - (command.width / 2)
   command.y = 240 - (command.height / 2)
   command.back_opacity = 160
   @help_window.y = command.y - 64
   @help_window.set_text("Would you like to DELETE this table?", 1) 
   valor = false
   loop do
     Graphics.update
     Input.update
     command.update
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       command.dispose
       @help_window.y = 0
       valor = false
       break
     end
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       valor = (command.index == 1)
       break
     end
   end  
   command.dispose
   @help_window.visible = false
   return valor
 end

 def x=(valor)
   return if @x == valor
   @x = valor
   if ((@x + 1) * 32) > @spriteset.ox + 640
     @spriteset.ox = ((@x + 1) * 32) - 640
   elsif (@x * 32) < @spriteset.ox
     @spriteset.ox = (@x * 32)
   end
   @cursor.x = (@x * 32) - @spriteset.ox
   @spot_info.spot = @actor_data[@x, @y]
 end

 def y=(valor)
   return if @y == valor
   @y = valor
   if ((@y + 1) * 32) > @spriteset.oy + 480
     @spriteset.oy = ((@y + 1) * 32) - 480
   elsif (@y * 32) < @spriteset.oy
     @spriteset.oy = (@y * 32)
   end
   @cursor.y = (@y * 32) - 16 - @spriteset.oy
   @spot_info.spot = @actor_data[@x, @y]
 end

end

#===============================================================================
# FFXII - Scene_Create_Licences
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Scene_Licences

 include FFXII::LICENCES

 def initialize(party_id, main_menu_index=0)
   @actor_id = $game_party.actors[party_id].id
   @main_menu_index = main_menu_index
 end

 def main
   @actor = $game_actors[@actor_id]
   @spriteset = Spriteset_Licence_Spots.new(@actor.licence_table)
   @help_window = Window_Help.new
   @help_window.back_opacity = 160
   @help_window.visible = false
   @x = 0
   @y = 0
   @spot_info = Window_Licence_Spot_Status.new(@actor.licence_table[@x, @y], @actor)
   @cursor = Sprite_Licence_Cursor.new(10)
   @cursor.x = (@x * 32)
   @cursor.y = (@y * 32) - 16
   Graphics.transition()
   loop {
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   }
   Graphics.freeze
   @spriteset.dispose
   @help_window.dispose
   @spot_info.dispose
   @cursor.dispose
 end

 def update
   @spriteset.update
   update_cursor
   if ((@y + 1) * 32) > @spriteset.oy + (480 - @spot_info.height + 32)
     @spot_info.y = 0
   elsif (@y * 32) < @spriteset.oy + (@spot_info.height + 32)
     @spot_info.y = 480 - @spot_info.height
   end
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Menu.new(@main_menu_index)
     return
   end
   if Input.trigger?(Input::C)
     if @actor.licence_table[@x, @y].type == ""
       return
     end
     if ((@actor.lp < @actor.licence_table[@x, @y].cost) or (@actor.licence_table[@x, @y].get) or (!@actor.licence_table[@x, @y].near))
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     $game_system.se_play($data_system.decision_se)
     if decision
       @actor.lp -= @actor.licence_table[@x, @y].cost
       @actor.licence_table[@x, @y].get = true
       @actor.licence_table.refresh_table
       case @actor.licence_table[@x, @y].type
       when "hp"
         @actor.maxhp += @actor.licence_table[@x, @y].id
       when "sp"
         @actor.maxsp += @actor.licence_table[@x, @y].id
       when "str"
         @actor.str += @actor.licence_table[@x, @y].id
       when "dex"
         @actor.dex += @actor.licence_table[@x, @y].id
       when "agi"
         @actor.agi += @actor.licence_table[@x, @y].id
       when "int"
         @actor.int += @actor.licence_table[@x, @y].id
       when "skill"
         @actor.learn_skill(@actor.licence_table[@x, @y].id)
       when "skill_licence"
         @actor.learn_skill_licence(@actor.licence_table[@x, @y].id)
       end
       for i1 in 0..2
         for i2 in 0..2
           next if [[0, 0], [0, 2], [2, 0], [2, 2]].include?([i1, i2])
           real_i1 = [[@x+i1-1, 0].max, MAX_LICENCES_WIDTH-1].min
           real_i2 = [[@y+i2-1, 0].max, MAX_LICENCES_HEIGHT-1].min
           @spriteset.refresh(real_i1, real_i2)
         end
       end
       @spot_info.refresh
     end
     return
   end
 end

 def update_cursor
   @cursor.update
   if Input.repeat?(Input::DOWN)
     if Input.trigger?(Input::DOWN) or @y < (MAX_LICENCES_HEIGHT - 1)
       $game_system.se_play($data_system.cursor_se)
       self.y = (@y + 1) % MAX_LICENCES_HEIGHT
       return
     end
   end
   if Input.repeat?(Input::UP)
     if Input.trigger?(Input::UP) or @y > 0
       $game_system.se_play($data_system.cursor_se)
       self.y = (@y - 1) % MAX_LICENCES_HEIGHT
       return
     end
   end
   if Input.trigger?(Input::LEFT)
     $game_system.se_play($data_system.cursor_se)
     self.x = (@x - 1) % MAX_LICENCES_WIDTH
     return
   end
   if Input.trigger?(Input::RIGHT)
     $game_system.se_play($data_system.cursor_se)
     self.x = (@x + 1) % MAX_LICENCES_WIDTH
     return
   end
 end

 def decision
   command = Window_Command.new(100, ["Yes", "No"])
   command.x = 320 - (command.width / 2)
   command.y = 240 - (command.height / 2)
   command.back_opacity = 160
   @help_window.y = command.y - 64
   @help_window.set_text("You wish to obtain this licence?", 1) 
   for i in 0..20
     @help_window.back_opacity = (160 / 20.0) * i
     command.back_opacity = (160 / 20.0) * i
     Graphics.update
   end
   value = false
   loop do
     Graphics.update
     Input.update
     command.update
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       value = false
       break
     end
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       value = (command.index == 0)
       break
     end
   end  
   for i in 0..20
     @help_window.back_opacity = 160 - (160 / 20.0) * i
     command.back_opacity = 160 - (160 / 20.0) * i
     Graphics.update
   end
   command.dispose
   @help_window.visible = false
   return value
 end

 def x=(valor)
   return if @x == valor
   @x = valor
   if ((@x + 1) * 32) > @spriteset.ox + 640
     @spriteset.ox = ((@x + 1) * 32) - 640
   elsif (@x * 32) < @spriteset.ox
     @spriteset.ox = (@x * 32)
   end
   @cursor.x = (@x * 32) - @spriteset.ox
   @spot_info.spot = @actor.licence_table[@x, @y]
 end

 def y=(valor)
   return if @y == valor
   @y = valor
   if ((@y + 1) * 32) > @spriteset.oy + 480
     @spriteset.oy = ((@y + 1) * 32) - 480
   elsif (@y * 32) < @spriteset.oy
     @spriteset.oy = (@y * 32)
   end
   @cursor.y = (@y * 32) - 16 - @spriteset.oy
   @spot_info.spot = @actor.licence_table[@x, @y]
 end

end


 

 

Share this post


Link to post
Share on other sites

I made this with little scripting knowledge. :D

here's the script modified by me. Credits to RTH for the original one.

 

 

 

#===============================================================================
# FFXII - Licence_Spot
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Licence_Spot

 attr_accessor :x
 attr_accessor :y
 attr_accessor :type
 attr_accessor :id
 attr_accessor :cost
 attr_accessor :get
 attr_accessor :near

 def initialize(x, y, type, id, cost=1)
   @x = x
   @y = y
   @type = type
   @id = id
   @cost = cost
   @get = false
   @near = false
 end

 def setup(spot)
   return unless spot.is_a?(Licence_Spot)
   @x = spot.x
   @y = spot.y
   @type = spot.type
   @id = spot.id
   @cost = spot.cost
   @get = spot.get
   @near = spot.near
 end

end

#===============================================================================
# FFXII - Licence_Table
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Licence_Table

 def initialize
   @data = []
 end

 def [](x, y)
   if @data[x].nil?
     @data[x] = []
   end
   return @data[x][y]
 end

 def []=(x, y, valor)
   if @data[x].nil?
     @data[x] = []
   end
   @data[x][y] = valor
 end

 def each
   for x in 0...@data.size
     next if @data[x].nil?
     for y in 0...@data[x].size
       next if @data[x][y].nil?
       yield @data[x][y]
     end
   end
 end

 def refresh_table
   data = [-1, 0, 1]
   self.each {|i|
     next if i.nil?
     i.near = false
   }
   for x in 0...@data.size
     next if @data[x].nil?
     for y in 0...@data[x].size
       if @data[x][y].get
         for i1 in 0..2
           for i2 in 0..2
             next if [[0, 0], [0, 2], [2, 0], [2, 2]].include?([i1, i2])
             real_i1 = [[x+i1-1, 0].max, @data.size-1].min
             real_i2 = [[y+i2-1, 0].max, @data[x].size-1].min
             self[real_i1, real_i2].near = true
           end
         end
       end
     end
   end
 end

end  

#===============================================================================
# FFXII - Sprite_Licences_Spot
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Sprite_Licences_Spot < Sprite

 include FFXII::LICENCES

 def initialize(viewport, house)
   super(viewport)
   @house = house
   @house_picture = RPG::Cache.licence(PICTURE_SQUARE[((@house.x + 1) + (@house.y + 1)) % PICTURE_SQUARE.size])
   @house_sprite = Sprite.new(@viewport)
   self.bitmap = Bitmap.new(@house_picture.width, @house_picture.height)
   refresh
 end

 def x=(valor)
   super
   @house_sprite.x = self.x
 end

 def y=(valor)
   super
   @house_sprite.y = self.y
 end

 def dispose
   if self.bitmap != nil
     self.bitmap.dispose
     self.bitmap = nil
   end
   @house_sprite.dispose
   super()
 end

 def refresh
   return if @house.type == ""
   @house_bonus = RPG::Cache.licence((LICENCE_PICTURES[@house.type].nil? ? "" : LICENCE_PICTURES[@house.type]))
   self.bitmap.clear
   self.bitmap.blt(0, 0, @house_picture, Rect.new(0, 0, @house_picture.width, @house_picture.height))
   if @house.near == false and @house.get == false
     @house_sprite.bitmap = nil
     return
   end
   x = (self.bitmap.width / 2) - (@house_bonus.width / 2)
   y = (self.bitmap.height / 2) - (@house_bonus.height / 2)
   @house_sprite.bitmap = @house_bonus
   @house_sprite.ox = -x
   @house_sprite.oy = -y
   @house_sprite.color.set(0, 0, 0, 0)
   if (@house.get == false)
     @house_sprite.color.set(128, 128, 128, 128)
     return
   end
 end

end

#===============================================================================
# FFXII - Spriteset_Licence_Spots
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Spriteset_Licence_Spots

 include FFXII::LICENCES

 attr_reader :ox
 attr_reader :oy

 def initialize(actor_data)
   @ox = 0
   @oy = 0
   @actor_data = actor_data
   @viewport = Viewport.new(0, 0, 640, 480)
   @back = Plane.new(@viewport)
   @back.bitmap = RPG::Cache.licence(LICENCE_BACK)
   @licence_spots = Licence_Table.new
   for x in 0...MAX_LICENCES_WIDTH
     for y in 0...MAX_LICENCES_HEIGHT
       sprite = Sprite_Licences_Spot.new(@viewport, @actor_data[x, y])
       sprite.x = x * 32
       sprite.y = y * 32
       @licence_spots[x, y] = sprite
     end
   end  
 end

 def refresh(x, y)
   @licence_spots[x, y].refresh
 end

 def refresh_all
   for x in 0...MAX_LICENCES_WIDTH
     for y in 0...MAX_LICENCES_HEIGHT
       @licence_spots[x, y].refresh
     end
   end
 end

 def update
   @back.ox += LICENCE_BACK_OX_SPEED
   @back.oy += LICENCE_BACK_OY_SPEED
 end

 def ox=(valor)
   return if @ox == valor
   @back.ox -= (@ox - valor)
   @ox = valor
   for x in 0...MAX_LICENCES_WIDTH
     for y in 0...MAX_LICENCES_HEIGHT
       @licence_spots[x, y].ox = @ox
     end
   end
 end

 def oy=(valor)
   return if @oy == valor
   @back.oy -= (@oy - valor)
   @oy = valor
   for x in 0...MAX_LICENCES_WIDTH
     for y in 0...MAX_LICENCES_HEIGHT
       @licence_spots[x, y].oy = @oy
     end
   end
 end

 def dispose
   for x in @licence_spots
     next if x.nil?
     x.dispose
   end
   @licence_spots = []
   @back.dispose
   @viewport.dispose
 end

end

#===============================================================================
# FFXII - Sprite_Licence_Cursor
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Sprite_Licence_Cursor < Sprite

 #--------------------------------------------------------------------------
 # - Inicialização dos Objetos
 #--------------------------------------------------------------------------

 def initialize(counter_max=0, viewport=nil)
   if viewport.nil?
     super()
   else
     super(viewport)
   end
   @up_down = true
   self.bitmap = RPG::Cache.licence("glove")
   @cursor_growing = false
   @cursor_counter_max = counter_max
   @cursor_counter = 0
   @updating = false
 end

 #--------------------------------------------------------------------------
 # - Muda o Up_Down
 #--------------------------------------------------------------------------

 def up_down=(valor)
   @up_down = valor
   self.ox = 0
   self.oy = 0
 end

 #--------------------------------------------------------------------------
 # - Muda o OX
 #--------------------------------------------------------------------------

 def ox=(valor)
   super
   if (@updating == false)
     @cursor_counter = 0 
     @cursor_growing = false
   end
 end

 #--------------------------------------------------------------------------
 # - Muda o OY
 #--------------------------------------------------------------------------

 def oy=(valor)
   unless @up_down
     valor -= self.bitmap.height - 7
   end
   super
   if (@updating == false)
     @cursor_counter = 0 
     @cursor_growing = false
   end
 end

 #--------------------------------------------------------------------------
 # - Atualização
 #--------------------------------------------------------------------------

 def update
   super()
   @updating = true
   if @cursor_counter_max > 0
     if @cursor_growing
       if @up_down
         self.oy = self.oy - 1
       else
         self.ox = self.ox - 1
       end
       @cursor_counter = @cursor_counter + 1
       if @cursor_counter >= @cursor_counter_max
         @cursor_growing = false
         @cursor_counter = 0
       end
     else
       if @up_down
         self.oy = self.oy + 1
       else
         self.ox = self.ox + 1
       end
       @cursor_counter = @cursor_counter + 1
       if @cursor_counter >= @cursor_counter_max
         @cursor_growing = true
         @cursor_counter = 0
       end
     end
   end
   @updating = false
 end

end  

#===============================================================================
# FFXII - Window_Licence_Select
#-------------------------------------------------------------------------------
# Criador: RTH
# Modified by: Anthonyaiken
#===============================================================================

class Window_Licence_Select < Window_Command

 def initialize
   @data = ["hp", "sp", "str", "dex", "agi", "int", "skill", "skill_licence", "weapon", ""]
   commands = []
   for x in @data
     case x
     when ""
       commands.push("Nothing")
     when "skill_licence"
       commands.push("Skill Licence")
     else
       eval("commands.push($data_system.words.#{x})")
     end
   end
   commands.push("Sair")
   super(240, commands)
   self.back_opacity = 160
   self.y = 64
   self.height = 480-64
 end

 def data
   return @data[self.index]
 end

 def last_index?
   return (self.index == (@item_max - 1))
 end

 def update_help
   text = @commands[self.index]
   @help_window.set_text(text)
 end

end

#===============================================================================
# FFXII - Window_Licence_Select
#-------------------------------------------------------------------------------
# Criador: RTH
# Modified by: Anthonyaiken
#===============================================================================

class Window_Licence_Spot_Status < Window_Base

 attr_reader :spot

 def initialize(spot, actor=nil)
   super(0, 480-96, 640, 96)
   @spot = spot
   @actor = actor
   self.contents = Bitmap.new(width - 32, height - 32)
   self.back_opacity = 160
   refresh
 end

 def spot=(valor)
   return if @spot == valor
   @spot = valor
   refresh
 end

 def refresh
   self.contents.clear
   if @actor != nil
     text = "#{FFXII::LICENCES::LICENCE_POINTS_S} "
     text2 = sprintf("%04d", @actor.lp)
     self.contents.font.color = system_color
     self.contents.draw_text((width - 40) - self.contents.text_size(text2).width - self.contents.text_size(text).width, 32, self.contents.text_size(text).width, 32, text)
     self.contents.font.color = normal_color
     self.contents.draw_text((width - 40) - self.contents.text_size(text2).width, 32, self.contents.text_size(text2).width, 32, text2)
   end
   return if @spot.type == ""
   x = 4
   if @spot.type == "skill" or @spot.type == "skill_licence"
     refresh_skill
   elsif @spot.type == "weapon"
     refresh_weapon
   else
     text = eval("$data_system.words.#{@spot.type}")
     self.contents.font.color = system_color
     self.contents.draw_text(x, 0, width - 40, 32, text)
     x += self.contents.text_size(text).width
     text = " +" + ((@spot.near == false and !@spot.get and !$scene.instance_of?(Scene_Create_Licences)) ? "???" : "#{@spot.id}")
     self.contents.font.color = normal_color
     self.contents.draw_text(x, 0, width - 40, 32, text)
   end
   self.contents.font.color = system_color
   text = "#{FFXII::LICENCES::LICENCE_POINTS_COST_S} "
   text2 = ((@spot.near == false and !@spot.get and !$scene.instance_of?(Scene_Create_Licences)) ? "????" : sprintf("%04d", @spot.cost))
   self.contents.draw_text((width - 40) - self.contents.text_size(text2).width - self.contents.text_size(text).width, 0, self.contents.text_size(text).width, 32, text)
   self.contents.font.color = normal_color
   self.contents.draw_text((width - 40) - self.contents.text_size(text2).width, 0, self.contents.text_size(text2).width, 32, text2)
   self.contents.draw_text(4, 32, width - 40, 32, "Owned") if @spot.get
 end

 def refresh_skill
   x = 4
   self.contents.font.color = system_color
   self.contents.draw_text(x, 0, 200, 32, $data_system.words.skill + " - ")
   x += [self.contents.text_size($data_system.words.skill + " - ").width, 200].min
   self.contents.font.color = normal_color
   if (@spot.near == false and !@spot.get and !$scene.instance_of?(Scene_Create_Licences))
     self.contents.draw_text(x, 0, 200, 32, "???")
     return
   end
   opacity = 255
   if @spot.type == "skill_licence"
     opacity = 160 unless $game_party.skill_learn?(@spot.id)
   end
   if $data_skills[@spot.id].icon_name != ""
     self.contents.blt(x, 0, RPG::Cache.icon($data_skills[@spot.id].icon_name), Rect.new(0, 0, 24, 24), opacity)
     x += 28
   end
   self.contents.font.color = disabled_color if opacity == 160
   self.contents.draw_text(x, 0, 200, 32, $data_skills[@spot.id].name)
 end

 def refresh_weapon
   x = 4
   self.contents.font.color = system_color
   self.contents.draw_text(x, 0, 200, 32, $data_system.words.weapon + " - ")
   x += [self.contents.text_size($data_system.words.weapon + " - ").width, 200].min
   self.contents.font.color = normal_color
   if (@spot.near == false and !@spot.get and !$scene.instance_of?(Scene_Create_Licences))
     self.contents.draw_text(x, 0, 200, 32, "???")
     return
   end
   opacity = 255
   if @spot.type == "skill_licence"
     opacity = 160 unless $game_party.skill_learn?(@spot.id)
   end
   if $data_weapons[@spot.id].icon_name != ""
     self.contents.blt(x, 0, RPG::Cache.icon($data_weapons[@spot.id].icon_name), Rect.new(0, 0, 24, 24), opacity)
     x += 28
   end
   self.contents.font.color = disabled_color if opacity == 160
   self.contents.draw_text(x, 0, 200, 32, $data_weapons[@spot.id].name)
 end

end

#===============================================================================
# FFXII - Window_Licence_Skills
#-------------------------------------------------------------------------------
# Criador: RTH
#===============================================================================

class Window_Licence_Skills < Window_Command

 attr_reader :spot

 def initialize()
   commands = []
   for i in 1...$data_skills.size
     commands.push($data_skills[i].name)
   end
   super(640, commands)
   self.back_opacity = 160
   self.y = 64
   self.height = 480 - 64
 end

 def skills
   return ($data_skills[self.index+1])
 end

end

#===============================================================================
# FFXII - Window_Licence_Weapons
#-------------------------------------------------------------------------------
# Criador: RTH
# Class implanted by: Anthonyaiken (This class was not in the original script)
#===============================================================================

class Window_Licence_Weapons < Window_Command

 attr_reader :spot

 def initialize()
   commands = []
   for i in 1...$data_weapons.size
     commands.push($data_weapons[i].name)
   end
   super(640, commands)
   self.back_opacity = 160
   self.y = 64
   self.height = 480 - 64
 end

 def weapons
   return ($data_weapons[self.index+1])
 end

end

#===============================================================================
# FFXII - Scene_Create_Licences
#-------------------------------------------------------------------------------
# Criador: RTH
# Modified by: Anthonyaiken
#===============================================================================

class Scene_Create_Licences

 include FFXII::LICENCES

 def initialize(actor_id)
   @actor_id = actor_id
 end

 def main
   # Carregar o Banco de Dados
   $data_actors        = load_data("Data/Actors.rxdata")
   $data_classes       = load_data("Data/Classes.rxdata")
   $data_skills        = load_data("Data/Skills.rxdata")
   $data_items         = load_data("Data/Items.rxdata")
   $data_weapons       = load_data("Data/Weapons.rxdata")
   $data_armors        = load_data("Data/Armors.rxdata")
   $data_enemies       = load_data("Data/Enemies.rxdata")
   $data_troops        = load_data("Data/Troops.rxdata")
   $data_states        = load_data("Data/States.rxdata")
   $data_animations    = load_data("Data/Animations.rxdata")
   $data_tilesets      = load_data("Data/Tilesets.rxdata")
   $data_common_events = load_data("Data/CommonEvents.rxdata")
   $data_system        = load_data("Data/System.rxdata")
   # Criar um Sistema
   $game_system = Game_System.new
   begin
     @data = load_data("Data/Licences.rxdata")
   rescue
     @data = []
   end
   @actor_data = @data[@actor_id]
   if @actor_data.nil?
     @actor_data = Licence_Table.new
   end
   for x in 0...MAX_LICENCES_WIDTH
     for y in 0...MAX_LICENCES_HEIGHT
       if @actor_data[x, y].nil?
         @actor_data[x, y] = Licence_Spot.new(x, y, "", 0)
       end
     end
   end 
   @spriteset = Spriteset_Licence_Spots.new(@actor_data)
   @help_window = Window_Help.new
   @help_window.back_opacity = 160
   @window_select = Window_Licence_Select.new
   @window_select.help_window = @help_window
   @window_select.active = false
   @window_select.visible = false
   @window_select.index = 0
   @input_number = Window_InputNumber.new(4)
   @input_number.back_opacity = 160
   @input_number.opacity = 255
   @input_number.active = false
   @input_number.visible = false
   @help_window.visible = false
   @x = 0
   @y = 0
   @spot_info = Window_Licence_Spot_Status.new(@actor_data[@x, @y])
   @cursor = Sprite_Licence_Cursor.new(10)
   @cursor.x = (@x * 32)
   @cursor.y = (@y * 32) - 16
   Graphics.transition()
   loop {
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   }
   if decision_exit
     @actor_data = nil
   end
   Graphics.freeze
   Graphics.freeze
   @spriteset.dispose
   @window_select.dispose
   @help_window.dispose
   @input_number.dispose
   @spot_info.dispose
   @cursor.dispose
   @data[@actor_id] = @actor_data
   file = File.open("Data/Licences.rxdata", "wb")
   Marshal.dump(@data, file)
   file.close
 end

 def update
   if @window_select.active
     update_window_select
     return
   end
   @cursor.update
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = nil
     return
   end
   if Input.trigger?(Input::C)
     $game_system.se_play($data_system.decision_se)
     @window_select.active = true
     @window_select.visible = true
     @help_window.visible = true
     @spot_info.visible = false
     return
   end
   if Input.repeat?(Input::DOWN)
     if Input.trigger?(Input::DOWN) or @y < (MAX_LICENCES_HEIGHT - 1)
       $game_system.se_play($data_system.cursor_se)
       self.y = (@y + 1) % MAX_LICENCES_HEIGHT
       return
     end
   end
   if Input.repeat?(Input::UP)
     if Input.trigger?(Input::UP) or @y > 0
       $game_system.se_play($data_system.cursor_se)
       self.y = (@y - 1) % MAX_LICENCES_HEIGHT
       return
     end
   end
   if Input.trigger?(Input::LEFT)
     $game_system.se_play($data_system.cursor_se)
     self.x = (@x - 1) % MAX_LICENCES_WIDTH
     return
   end
   if Input.trigger?(Input::RIGHT)
     $game_system.se_play($data_system.cursor_se)
     self.x = (@x + 1) % MAX_LICENCES_WIDTH
     return
   end
 end

 def update_window_select
   @window_select.update
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     @window_select.active = false
     @window_select.visible = false
     @help_window.visible = false
     @spot_info.visible = true
     return
   end
   if Input.trigger?(Input::C)
     $game_system.se_play($data_system.decision_se)
     if @window_select.last_index?
       @window_select.active = false
       @window_select.visible = false
       @help_window.visible = false
       @spot_info.visible = true
       return
     end
     @actor_data[@x, @y].type = @window_select.data
     @spriteset.refresh(@x, @y)
     @window_select.active = false
     @window_select.visible = false
     if @actor_data[@x, @y].type == ""
       @help_window.y = 0
       @help_window.visible = false
       @spot_info.visible = true
       @spot_info.refresh
       return
     end
     phase = 0
     loop do
       if phase == 0
         if @window_select.data == "skill" or @window_select.data == "skill_licence"
           unless window_skill
             @window_select.active = true
             @window_select.visible = true
             return
           end  
         elsif @window_select.data == "weapon"
           unless window_weapon
             @window_select.active = true
             @window_select.visible = true
             return
           end          
         else
           unless input_number
             @window_select.active = true
             @window_select.visible = true
             return
           end
           @actor_data[@x, @y].id = @input_number.number
         end
       end
       unless input_lp_number
         phase = 0
         next
       end
       phase = 1
       if decision
         break
       end
     end
     @spriteset.refresh(@x, @y)
     @help_window.y = 0
     @help_window.visible = false
     @spot_info.visible = true
     @spot_info.refresh
     return
   end
 end

 def window_skill
   window = Window_Licence_Skills.new
   @help_window.y = 0
   @help_window.set_text("Choose the skill.") 
   loop do
     Graphics.update
     Input.update
     window.update
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       window.dispose
       return false
     end
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       break
     end
   end  
   @actor_data[@x, @y].id = window.skill.id
   window.dispose
   @help_window.y = 0
   return true
 end

 def window_weapon
   window = Window_Licence_Weapons.new
   @help_window.y = 0
   @help_window.set_text("Choose the Weapon.") 
   loop do
     Graphics.update
     Input.update
     window.update
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       window.dispose
       return false
     end
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       break
     end
   end  
   @actor_data[@x, @y].id = window.weapons.id
   window.dispose
   @help_window.y = 0
   return true
 end

 def input_number
   @input_number.number = 0
   @input_number.x = 320 - (@input_number.width / 2)
   @input_number.y = 240 - (@input_number.height / 2)
   @help_window.y = @input_number.y - 64
   @help_window.set_text("Set the value.", 1) 
   @input_number.active = true
   @input_number.visible = true
   loop do
     Graphics.update
     Input.update
     @input_number.update
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       @input_number.active = false
       @input_number.visible = false
       @help_window.y = 0
       return false
     end
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       break
     end
   end  
   @input_number.active = false
   @input_number.visible = false
   @help_window.y = 0
   return true
 end

 def input_lp_number
   @input_number.number = 0
   @input_number.x = 320 - (@input_number.width / 2)
   @input_number.y = 240 - (@input_number.height / 2)
   @help_window.y = @input_number.y - 64
   @help_window.set_text("Set the LP Cost value.", 1) 
   @input_number.active = true
   @input_number.visible = true
   loop do
     Graphics.update
     Input.update
     @input_number.update
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       @input_number.active = false
       @input_number.visible = false
       @help_window.y = 0
       return false
     end
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       break
     end
   end  
   @actor_data[@x, @y].cost = @input_number.number
   @input_number.active = false
   @input_number.visible = false
   @help_window.y = 0
   return true
 end

 def decision
   command = Window_Command.new(100, ["Yes", "No"])
   command.x = 320 - (command.width / 2)
   command.y = 240 - (command.height / 2)
   command.back_opacity = 160
   @help_window.y = command.y - 64
   @help_window.set_text("Will the hero starts with this place owned?", 1) 
   loop do
     Graphics.update
     Input.update
     command.update
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       command.dispose
       @help_window.y = 0
       return false
     end
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       break
     end
   end  
   @actor_data[@x, @y].get = (command.index == 0)
   command.dispose
   @help_window.y = 0
   return true
 end

 def decision_exit
   command = Window_Command.new(100, ["No", "Yes"])
   command.x = 320 - (command.width / 2)
   command.y = 240 - (command.height / 2)
   command.back_opacity = 160
   @help_window.y = command.y - 64
   @help_window.set_text("Would you like to DELETE this table?", 1) 
   valor = false
   loop do
     Graphics.update
     Input.update
     command.update
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       command.dispose
       @help_window.y = 0
       valor = false
       break
     end
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       valor = (command.index == 1)
       break
     end
   end  
   command.dispose
   @help_window.visible = false
   return valor
 end

 def x=(valor)
   return if @x == valor
   @x = valor
   if ((@x + 1) * 32) > @spriteset.ox + 640
     @spriteset.ox = ((@x + 1) * 32) - 640
   elsif (@x * 32) < @spriteset.ox
     @spriteset.ox = (@x * 32)
   end
   @cursor.x = (@x * 32) - @spriteset.ox
   @spot_info.spot = @actor_data[@x, @y]
 end

 def y=(valor)
   return if @y == valor
   @y = valor
   if ((@y + 1) * 32) > @spriteset.oy + 480
     @spriteset.oy = ((@y + 1) * 32) - 480
   elsif (@y * 32) < @spriteset.oy
     @spriteset.oy = (@y * 32)
   end
   @cursor.y = (@y * 32) - 16 - @spriteset.oy
   @spot_info.spot = @actor_data[@x, @y]
 end

end

#===============================================================================
# FFXII - Scene_Create_Licences
#-------------------------------------------------------------------------------
# Criador: RTH
# Modified by: Anthonyaiken
#===============================================================================

class Scene_Licences

 include FFXII::LICENCES

 def initialize(party_id, main_menu_index=0)
   @actor_id = $game_party.actors[party_id].id
   @main_menu_index = main_menu_index
 end

 def main
   @actor = $game_actors[@actor_id]
   @spriteset = Spriteset_Licence_Spots.new(@actor.licence_table)
   @help_window = Window_Help.new
   @help_window.back_opacity = 160
   @help_window.visible = false
   @x = 0
   @y = 0
   @spot_info = Window_Licence_Spot_Status.new(@actor.licence_table[@x, @y], @actor)
   @cursor = Sprite_Licence_Cursor.new(10)
   @cursor.x = (@x * 32)
   @cursor.y = (@y * 32) - 16
   Graphics.transition()
   loop {
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   }
   Graphics.freeze
   @spriteset.dispose
   @help_window.dispose
   @spot_info.dispose
   @cursor.dispose
 end

 def update
   @spriteset.update
   update_cursor
   if ((@y + 1) * 32) > @spriteset.oy + (480 - @spot_info.height + 32)
     @spot_info.y = 0
   elsif (@y * 32) < @spriteset.oy + (@spot_info.height + 32)
     @spot_info.y = 480 - @spot_info.height
   end
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Menu.new(@main_menu_index)
     return
   end
   if Input.trigger?(Input::C)
     if @actor.licence_table[@x, @y].type == ""
       return
     end
     if ((@actor.lp < @actor.licence_table[@x, @y].cost) or (@actor.licence_table[@x, @y].get) or (!@actor.licence_table[@x, @y].near))
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     $game_system.se_play($data_system.decision_se)
     if decision
       @actor.lp -= @actor.licence_table[@x, @y].cost
       @actor.licence_table[@x, @y].get = true
       @actor.licence_table.refresh_table
       case @actor.licence_table[@x, @y].type
       when "hp"
         @actor.maxhp += @actor.licence_table[@x, @y].id
       when "sp"
         @actor.maxsp += @actor.licence_table[@x, @y].id
       when "str"
         @actor.str += @actor.licence_table[@x, @y].id
       when "dex"
         @actor.dex += @actor.licence_table[@x, @y].id
       when "agi"
         @actor.agi += @actor.licence_table[@x, @y].id
       when "int"
         @actor.int += @actor.licence_table[@x, @y].id
       when "skill"
         @actor.learn_skill(@actor.licence_table[@x, @y].id)
       when "skill_licence"
         @actor.learn_skill_licence(@actor.licence_table[@x, @y].id)
       when "weapon"
         $game_party.gain_weapon(@actor.licence_table[@x, @y].id, 1)
       end
       for i1 in 0..2
         for i2 in 0..2
           next if [[0, 0], [0, 2], [2, 0], [2, 2]].include?([i1, i2])
           real_i1 = [[@x+i1-1, 0].max, MAX_LICENCES_WIDTH-1].min
           real_i2 = [[@y+i2-1, 0].max, MAX_LICENCES_HEIGHT-1].min
           @spriteset.refresh(real_i1, real_i2)
         end
       end
       @spot_info.refresh
     end
     return
   end
 end

 def update_cursor
   @cursor.update
   if Input.repeat?(Input::DOWN)
     if Input.trigger?(Input::DOWN) or @y < (MAX_LICENCES_HEIGHT - 1)
       $game_system.se_play($data_system.cursor_se)
       self.y = (@y + 1) % MAX_LICENCES_HEIGHT
       return
     end
   end
   if Input.repeat?(Input::UP)
     if Input.trigger?(Input::UP) or @y > 0
       $game_system.se_play($data_system.cursor_se)
       self.y = (@y - 1) % MAX_LICENCES_HEIGHT
       return
     end
   end
   if Input.trigger?(Input::LEFT)
     $game_system.se_play($data_system.cursor_se)
     self.x = (@x - 1) % MAX_LICENCES_WIDTH
     return
   end
   if Input.trigger?(Input::RIGHT)
     $game_system.se_play($data_system.cursor_se)
     self.x = (@x + 1) % MAX_LICENCES_WIDTH
     return
   end
 end

 def decision
   command = Window_Command.new(100, ["Yes", "No"])
   command.x = 320 - (command.width / 2)
   command.y = 240 - (command.height / 2)
   command.back_opacity = 160
   @help_window.y = command.y - 64
   @help_window.set_text("You wish to obtain this licence?", 1) 
   for i in 0..20
     @help_window.back_opacity = (160 / 20.0) * i
     command.back_opacity = (160 / 20.0) * i
     Graphics.update
   end
   value = false
   loop do
     Graphics.update
     Input.update
     command.update
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       value = false
       break
     end
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       value = (command.index == 0)
       break
     end
   end  
   for i in 0..20
     @help_window.back_opacity = 160 - (160 / 20.0) * i
     command.back_opacity = 160 - (160 / 20.0) * i
     Graphics.update
   end
   command.dispose
   @help_window.visible = false
   return value
 end

 def x=(valor)
   return if @x == valor
   @x = valor
   if ((@x + 1) * 32) > @spriteset.ox + 640
     @spriteset.ox = ((@x + 1) * 32) - 640
   elsif (@x * 32) < @spriteset.ox
     @spriteset.ox = (@x * 32)
   end
   @cursor.x = (@x * 32) - @spriteset.ox
   @spot_info.spot = @actor.licence_table[@x, @y]
 end

 def y=(valor)
   return if @y == valor
   @y = valor
   if ((@y + 1) * 32) > @spriteset.oy + 480
     @spriteset.oy = ((@y + 1) * 32) - 480
   elsif (@y * 32) < @spriteset.oy
     @spriteset.oy = (@y * 32)
   end
   @cursor.y = (@y * 32) - 16 - @spriteset.oy
   @spot_info.spot = @actor.licence_table[@x, @y]
 end

end

 

 

 

Screens Attached

post-14533-088185600 1283285833_thumb.png

post-14533-048479300 1283286970_thumb.png

 

 

Now the problem is: is there any way to make a actor/class able to equip a specific weapon by scripting?

Cause when I get the licence for the weapon the actor gains the weapon.Like it gets in the iventory.

 

post-14533-037318500 1283287084_thumb.png

 

EDIT: Link to English Version: http://www.4shared.com/file/31925812/ea157d6d/FFXII_-_English.html

 

EDIT 2: I forgot to put the "Modified by:" thing so now you can see not only the creator but also the modifier...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...