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

Final Fantasy Tactics Advance Shop System

Recommended Posts

Guest Mac

Introduction

 

Hello everbody and welcome to the Final Fantasy Tactics Advance Shop, i have recently just upgraded and messed around with it to make it look even more like the FFTA shop, there is still quiet a bit more to do but i have almost completely finished it, but to finish this completely i'm going to have to create my own skill equipment system

sleep.gif

...a challenge!

happy.gif

 

Enjoy!

 

Screenshots

post-1-0-72781500-1331859952_thumb.png

 

The Script

Final Fantasy Tactics Advance Shop System.txt

 

 

#----------------------------------------------------------------------------
# Final Fantasy Tactics Advance Shop System By Mac	  v. 0.7
#----------------------------------------------------------------------------
# Basically as it says in the title, this makes your shop system just like
# that of FFTA but due to being aliased you have the option at any point to
# switch it too and from the default system whenever you see fit.
#----------------------------------------------------------------------------
# Firstly to make this active in game you need to do a call script and call this:-
# $game_temp.call_fftshopsystem = true
#
# Then at any point you can call it again but with false to return it to the
# default shop system, or if you want this system to always stay on simply
# change the line:-
#
# @call_fftshopsystem = false
#
# Too:-
#
# @call_fftshopsystem = true
#----------------------------------------------------------------------------
#==============================================================================
# ** Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :call_fftshopsystem
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias_method :mac_fftshop_init, :initialize
def initialize
  # Original Initialization
  mac_fftshop_init
  # Set Call FFT Shop False
  @call_fftshopsystem = false
end
end
#==============================================================================
# ** Game_Party
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Total Weapon Number
#--------------------------------------------------------------------------
def total_weapon_number(weapon_id)
  n = weapon_number(weapon_id)
  n += equipped_weapon_number(weapon_id)
  return n
end
#--------------------------------------------------------------------------
# * Equipped Weapon Number
#--------------------------------------------------------------------------
def equipped_weapon_number(weapon_id)
  n = 0
  @actors.each do |actor|
 n += 1 if actor.weapon_id == weapon_id
  end
  return n
end
#--------------------------------------------------------------------------
# * Total Armor Number
#--------------------------------------------------------------------------
def total_armor_number(armor_id)
  n = armor_number(armor_id)
  n += equipped_armor_number(armor_id)
  return n
end
#--------------------------------------------------------------------------
# * Equipped Armor Number
#--------------------------------------------------------------------------
def equipped_armor_number(armor_id)
  n = 0
  @actors.each do |actor|
 n += 1 if actor.armor1_id == armor_id
 n += 1 if actor.armor2_id == armor_id
 n += 1 if actor.armor3_id == armor_id
 n += 1 if actor.armor4_id == armor_id
  end
  return n
end
end
#==============================================================================
# ** Scene_Shop
#==============================================================================
class Scene_Shop
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias_method :mac_fftshop_main, :main
def main
  # If Call FFT Shop
  if $game_temp.call_fftshopsystem
 # Change to FFT Shop
 $scene = FFT_ShopSystem::Scene_Shop.new
 # Turn call FFT Shop off
 $game_temp.call_fftshopsystem = false
 # End Method
 return
  end
  # Original Method
  mac_fftshop_main
end
end
#==============================================================================
# ** FFT_ShopSystem
#==============================================================================
module FFT_ShopSystem
& nbsp;#==========================================================================
==
# ** Window_ShopCommand
& nbsp;#==========================================================================
==
class Window_ShopCommand < ::Window_Command
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
 super(180, ['Buy', 'Sell', 'Exit'])
 # Reassign Window Parameters
 self.x, self.y, self.opacity = 16, 336, 0
 # Creates Background Graphic
 @command_graphic = Sprite.new
 @command_graphic.bitmap = RPG::Cache.picture('Shop Command')
 @command_graphic.x = self.x + 1
 @command_graphic.y = self.y + 7
 @command_graphic.z = self.z - 1
 @command_graphic.visible = true
 @gold_graphic = Sprite.new
 @gold_graphic.bitmap = RPG::Cache.picture('Gold Window')
 @gold_graphic.x = self.x + 480
 @gold_graphic.y = self.y + 104
 @gold_graphic.z = self.z - 2
 @gold_graphic.visible = true
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
 super
 @command_graphic.visible = self.visible
 @gold_graphic.visible = self.visible
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
 super
 @command_graphic.dispose
 @gold_graphic.dispose
  end
end

& nbsp;#==========================================================================
==
# ** Window_ShopBuy
& nbsp;#==========================================================================
==
class Window_ShopBuy < ::Window_ShopBuy
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(shop_goods)
 super(shop_goods)
 # Reassign Window Parameters
 self.x, self.y, self.width, self.height = 16, 20, 600, 228
 self.opacity, self.visible, self.active = 0, false, false
 # Creates Showback Graphic
 @showback_graphic = Sprite.new
 @showback_graphic.bitmap = RPG::Cache.picture('Shop Window')
 @showback_graphic.x = self.x + 1
 @showback_graphic.y = self.y + 1
 @showback_graphic.z = self.z - 1
 @showback_graphic.visible = self.visible
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
 # Gets item Number
 item = @data[index]
 # Gets Number Owned & Equipped
 case item
 when RPG::Item
   number = $game_party.item_number(item.id)
   equipped_number = 0
 when RPG::Weapon
   number = $game_party.weapon_number(item.id)
   equipped_number = $game_party.equipped_weapon_number(item.id)
 when RPG::Armor
   number = $game_party.armor_number(item.id)
   equipped_number = $game_party.equipped_armor_number(item.id)
 end
 # Adjust Color By Price
 if item.price <= $game_party.gold and number < 99
   self.contents.font.color = normal_color
 else
   self.contents.font.color = disabled_color
 end
 # Clears Area
 rect = Rect.new(0, index * 32, contents.width, 32)
 self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
 # Draws Icon
 bitmap = RPG::Cache.icon(item.icon_name)
 opacity = self.contents.font.color == normal_color ? 255 : 128
 self.contents.blt(4, index * 32 + 4, bitmap, Rect.new(0, 0, 24, 24),
   opacity)
 # Draws Item Name, Total, Equipped and Price
 self.contents.draw_text(32, index * 32, 212, 32, item.name, 0)
 self.contents.draw_text(374, index * 32, 88, 32,
   (number + equipped_number).to_s, 2)
 self.contents.draw_text(294, index * 32, 88, 32, equipped_number.to_s, 2)
 self.contents.draw_text(464, index * 32, 88, 32, item.price.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
 super
 @showback_graphic.visible = self.visible
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
 super
 @showback_graphic.dispose
  end
end

& nbsp;#==========================================================================
==
# ** Window_ShopSell
& nbsp;#==========================================================================
==
class Window_ShopSell < ::Window_ShopSell
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
 super
 # Reassign Window Parameters
 self.x, self.y, self.width, self.height = 16, 20, 600, 228
 self.opacity, self.visible, self.active = 0, false, false
 # Creates Showback Graphic
 @showback_graphic = Sprite.new
 @showback_graphic.bitmap = RPG::Cache.picture('Shop Window')
 @showback_graphic.x = self.x + 1
 @showback_graphic.y = self.y + 1
 @showback_graphic.z = self.z - 1
 @showback_graphic.visible = self.visible
 # Adjust Column Max
 @column_max = 1
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
 # Gets Item Data
 item = @data[index]
 # Gets Number & Equipped Number
 case item
 when RPG::Item
   number = $game_party.item_number(item.id)
   equipped_number = 0
 when RPG::Weapon
   number = $game_party.weapon_number(item.id)
   equipped_number = $game_party.equipped_weapon_number(item.id)
 when RPG::Armor
   number = $game_party.armor_number(item.id)
   equipped_number = $game_party.equipped_armor_number(item.id)
 end
 # Adjust Font Color By Price
 if item.price > 0
   self.contents.font.color = normal_color
 else
   self.contents.font.color = disabled_color
 end
 # Clears Area
 rect = Rect.new(0, index * 32, contents.width, 32)
 self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
 # Draws Icon
 bitmap = RPG::Cache.icon(item.icon_name)
 opacity = self.contents.font.color == normal_color ? 255 : 128
 self.contents.blt(4, index * 32 + 4, bitmap, Rect.new(0, 0, 24, 24),
   opacity)
 # Draws Item Name, Total Owned, Equipped and Price
 self.contents.draw_text(32, index * 32, 212, 32, item.name, 0)
 self.contents.draw_text(374, index * 32, 88, 32,
   (number + equipped_number).to_s, 2)
 self.contents.draw_text(294, index * 32, 88, 32, equipped_number.to_s, 2)
 self.contents.draw_text(464, index * 32, 88, 32,
   (item.price / 2).to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
 super
 @showback_graphic.visible = self.visible
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
 super
 @showback_graphic.dispose
  end
end

& nbsp;#==========================================================================
==
# ** Window_ShopNumber
& nbsp;#==========================================================================
==
class Window_ShopNumber < ::Window_ShopNumber
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
 super
 # Reassign Window Parameters
 self.x, self.y, self.width, self.height, self.opacity = 450, 242, 65, 64, 0
 # Recreates Window Contents
 @number_graphic = Sprite.new
 @number_graphic.bitmap = RPG::Cache.picture('Shop Number')
 @number_graphic.x = self.x + 3
 @number_graphic.y = self.y + 14
 @number_graphic.z = self.z - 1
 @number_graphic.visible = false
 self.contents = Bitmap.new(width - 32, height - 32)
 self.visible, self.active = false, false
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
 def update
 super
 @number_graphic.visible = self.visible
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
 super
 @number_graphic.dispose
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
 self.contents.clear
 self.contents.font.color = Color.new(0, 0, 0, 255)
 self.contents.draw_text(0, 0, 25, 32, "?")
 self.contents.draw_text(-25, 0, 56, 32, "#{@number}", 2)
 self.cursor_rect.set(256, 0, 64, 32)
 end
end

& nbsp;#==========================================================================
====
# ** FFT_ShopSystem
& nbsp;#==========================================================================
====

class Scene_Shop
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
 # Memorize BGM & Play Shop Music
 $game_temp.map_bgm = $game_system.playing_bgm
#	  Audio.bgm_play("Audio/BGM/31 - Mysterious Shop", 100, 100)
 # Create Command Window
 @command_window = Window_ShopCommand.new
 # Create Spriteset
 @spriteset = Spriteset_Map.new
 # Create Gold Window
 @gold_window = Window_Gold.new
 @gold_window.opacity = 0
 @gold_window.x = 650 - @gold_window.width - 16
 @gold_window.y = 500 - @gold_window.height - 16
 # Create Buy Window
 @buy_window = FFT_ShopSystem::Window_ShopBuy.new($game_temp.shop_goods)
 @buy_window.help_window = @help_window
 # Create Sell Window
 @sell_window = FFT_ShopSystem::Window_ShopSell.new
 @sell_window.help_window = @help_window
 # Create Number Window
 @number_window = FFT_ShopSystem::Window_ShopNumber.new
 # Transition run
 Graphics.transition
 # Main loop
 loop do
   # Update game screen
   Graphics.update
   # Update input information
   Input.update
   # Frame update
   update
   # Abort loop if screen is changed
   if $scene != self
	 break
   end
 end
 # Prepare for transition
 Graphics.freeze
 # Dispose Scene Objects
 @spriteset.dispose
 @command_window.dispose
 @gold_window.dispose
 @buy_window.dispose
 @sell_window.dispose
 @number_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
 # Update windows
 @command_window.update
 @gold_window.update
 @buy_window.update
 @sell_window.update
 @number_window.update
 # If command window is active: call update_command
 if @command_window.active
   update_command
   return
 # If buy window is active: call update_buy
 elsif @buy_window.active
   update_buy
   return
 # If sell window is active: call update_sell
 elsif @sell_window.active
   update_sell
   return
 # If quantity input window is active: call update_number
 elsif @number_window.active
   update_number
   return
 end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
 # If B button was pressed
 if Input.trigger?(Input::B)
   # Play cancel SE
   $game_system.se_play($data_system.cancel_se)
   # Switch to map screen
   $scene = Scene_Map.new
   return
 end
 # If C button was pressed
 if Input.trigger?(Input::C)
   # Play decision SE
   $game_system.se_play($data_system.decision_se)
   # Branch by command window cursor position
   case @command_window.index
   when 0  # buy
	 # Change windows to buy mode
	 @command_window.active = false
	 @buy_window.active = true
	 @buy_window.visible = true
	 @buy_window.refresh
   when 1  # sell
	 # Change windows to sell mode
	 @command_window.active = false
	 @sell_window.active = true
	 @sell_window.visible = true
	 @sell_window.refresh
   when 2  # quit
	 # Switch to map screen
	 $scene = Scene_Map.new
   end
   return
 end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when buy window is active)
  #--------------------------------------------------------------------------
  def update_buy
 # If B button was pressed
 if Input.trigger?(Input::B)
   # Play cancel SE
   $game_system.se_play($data_system.cancel_se)
   # Change windows to initial mode
   @command_window.active = true
   @buy_window.active = false
   @buy_window.visible = false
   return
 end
 # If C button was pressed
 if Input.trigger?(Input::C)
   # Get item
   @item = @buy_window.item
   # If item is invalid, or price is higher than money possessed
   if @item == nil or @item.price > $game_party.gold
	 # Play buzzer SE
	 $game_system.se_play($data_system.buzzer_se)
	 return
   end
   # Get items in possession count
   case @item
   when RPG::Item
	 number = $game_party.item_number(@item.id)
   when RPG::Weapon
	 number = $game_party.weapon_number(@item.id)
   when RPG::Armor
	 number = $game_party.armor_number(@item.id)
   end
   # If 99 items are already in possession
   if number == 99
	 # Play buzzer SE
	 $game_system.se_play($data_system.buzzer_se)
	 return
   end
   # Play decision SE
   $game_system.se_play($data_system.decision_se)
   # Calculate maximum amount possible to buy
   max = @item.price == 0 ? 99 : $game_party.gold / @item.price
   max = [max, 99 - number].min
   # Turn Buy Window Off
   @buy_window.active = false
   # Change windows to quantity input mode
   @number_window.set(@item, max, @item.price)
   @number_window.active = true
   @number_window.visible = true
 end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when sell window is active)
  #--------------------------------------------------------------------------
  def update_sell
 # If B button was pressed
 if Input.trigger?(Input::B)
   # Play cancel SE
   $game_system.se_play($data_system.cancel_se)
   # Change windows to initial mode
   @command_window.active = true
   @sell_window.active = false
   @sell_window.visible = false
   return
 end
 # If C button was pressed
 if Input.trigger?(Input::C)
   # Get item
   @item = @sell_window.item
   # If item is invalid, or item price is 0 (unable to sell)
   if @item == nil or @item.price == 0
	 # Play buzzer SE
	 $game_system.se_play($data_system.buzzer_se)
	 return
   end
   # Play decision SE
   $game_system.se_play($data_system.decision_se)
   # Get items in possession count
   case @item
   when RPG::Item
	 number = $game_party.item_number(@item.id)
   when RPG::Weapon
	 number = $game_party.weapon_number(@item.id)
   when RPG::Armor
	 number = $game_party.armor_number(@item.id)
   end
   # Maximum quanitity to sell = number of items in possession
   max = number
   # Turn Sell Window Off
   @sell_window.active = false
   # Change windows to quantity input mode
   @number_window.set(@item, max, @item.price / 2)
   @number_window.active = true
   @number_window.visible = true
 end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when quantity input window is active)
  #--------------------------------------------------------------------------
  def update_number
 # If B button was pressed
 if Input.trigger?(Input::B)
   # Play cancel SE
   $game_system.se_play($data_system.cancel_se)
   # Set quantity input window to inactive / invisible
   case @command_window.index
   when 0
   @buy_window.active = true
   @number_window.active = false
   @number_window.visible = false
   when 1
   @sell_window.active = true
   @number_window.active = false
   @number_window.visible = false
   return
 end
 end
 # If C button was pressed
 if Input.trigger?(Input::C)
   # Play shop SE
   $game_system.se_play($data_system.shop_se)
   # Set quantity input window to inactive / invisible
   @number_window.active = false
   @number_window.visible = false
   # Branch by command window cursor position
   case @command_window.index
   when 0  # buy
	 # Buy process
	 $game_party.lose_gold(@number_window.number * @item.price)
	 case @item
	 when RPG::Item
	   $game_party.gain_item(@item.id, @number_window.number)
	 when RPG::Weapon
	   $game_party.gain_weapon(@item.id, @number_window.number)
	 when RPG::Armor
	   $game_party.gain_armor(@item.id, @number_window.number)
	 end
	 # Refresh each window
	 @gold_window.refresh
	 @buy_window.refresh
	 # Change windows to buy mode
	 @buy_window.active = true
	 @buy_window.visible = true
   when 1  # sell
	 # Sell process
	 $game_party.gain_gold(@number_window.number * (@item.price / 2))
	 case @item
	 when RPG::Item
	   $game_party.lose_item(@item.id, @number_window.number)
	 when RPG::Weapon
	   $game_party.lose_weapon(@item.id, @number_window.number)
	 when RPG::Armor
	   $game_party.lose_armor(@item.id, @number_window.number)
	 end
	 # Refresh each window
	 @gold_window.refresh
	 @sell_window.refresh
	 # Change windows to sell mode
	 @sell_window.active = true
	 @sell_window.visible = true
   end
   return
 end
  end
end
end

 

 

Instructions

Add above main.

To call on it, call this script and then after it call on the shop as you usually would do.

$game_temp.call_fftshopsystem = true

Required Images

post-1-0-21511400-1331859955.png

post-1-0-65607500-1331859957_thumb.png

post-1-0-17689700-1331859959_thumb.png

post-1-0-36163100-1331859960_thumb.png

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...