Jump to content
Rpg²S Forum

*Elabora


 Share

Recommended Posts

Elabora

Descrizione

Questo script permette di elaborare oggetti come in Final Fantasy VIII.
Consumando una determinata quantità di oggetti si possono ottenere nuovi oggetti o magie.

Script

#==============================================================================
#  Elabora
#------------------------------------------------------------------------------
#  Autore: The Sleeping Leonhart
#  Versione: 1.0
#  Data di rilascio: 18/06/2008
#------------------------------------------------------------------------------
#  Descrizione:
#	Questo script permette di elaborare oggetti come in Final Fantasy VIII.
#	Consumando una determinata quantità di oggetti si possono ottenere nuovi
#	oggetti o magie.
#------------------------------------------------------------------------------
#  Istruzioni:
#	Per richiamare la scena usare il seguente codice:
#	  $scene = Scene_Elaborate.new
#	Per elaborare le magie dovete avere anche lo script Final Fantasy VIII Magic System
#	o lo script vi darà errore.
#	Per personalizzare lo script andate nella sezione configurazione.
#==============================================================================

#==============================================================================
# Configurazione
#==============================================================================
module Elabora
  #=========================================================================
  #  ItemToSkill: Imposta gli oggetti che elaborano skill.
  #-------------------------------------------------------------------------
  #  Sintassi:
  #	ItemToSkill = {Item_ID=>[N1,Skill_ID,N2],...}
  #  Parametri:
  #	Item_ID: Id dell'oggetto nel database (oggetto da elaborare)
  #	N1 = Numero di oggetti richiesti
  #	Skill_ID: Id della skill nel database (skill ottenuta)
  #	N2: Numero di skill ottenute
  #=========================================================================  
  ItemToSkill = {1=>[1,2,10]}
  #=========================================================================
  #  ItemToItem: Imposta gli oggetti che elaborano oggetti
  #-------------------------------------------------------------------------
  #  Sintassi:
  #	ItemToItem = {Item_ID1=>[N1,Item_ID2,N2],...}
  #  Parametri:
  #	Item_ID1: Id dell'oggetto nel database (oggetto da elaborare)
  #	N1 = Numero di oggetti richiesti
  #	Item_ID2: Id dell'oggetto nel database (oggetto ottenuto)
  #	N2: Numero di skill ottenute
  #=========================================================================  
  ItemToItem = {2=>[10,1,2]}
  #=========================================================================
  # WeaponToSkill: Imposta le armi che elaborano skill.
  #-------------------------------------------------------------------------
  #  Sintassi:
  #	WeaponToSkill = {Weapon_ID=>[N1,Skill_ID,N2],...}
  #  Parametri:
  #	Weapon_ID: Id dell'arma nel database (arma da elaborare)
  #	N1 = Numero di oggetti richiesti
  #	Skill_ID: Id della skill nel database (skill ottenuta)
  #	N2: Numero di skill ottenute
  #=========================================================================  
  WeaponToSkill = {4=>[1,3,10]}
  #=========================================================================
  #  WeaponToItem: Imposta le armi che elaborano oggetti
  #-------------------------------------------------------------------------
  #  Sintassi:
  #	WeaponToItem = {Weapon_ID=>[N1,Item_ID,N2],...}
  #  Parametri:
  #	Weapon_ID: Id dell'arma nel database (arma da elaborare)
  #	N1 = Numero di oggetti richiesti
  #	Item_ID: Id dell'oggetto nel database (oggetto ottenuto)
  #	N2: Numero di skill ottenute
  #=========================================================================  
  WeaponToItem = {2=>[10,7,3]}
  #=========================================================================
  # ArmorToSkill: Imposta le armature che elaborano skill.
  #-------------------------------------------------------------------------
  #  Sintassi:
  #	ArmorToSkill = {Armor_ID=>[N1,Skill_ID,N2],...}
  #  Parametri:
  #	Armor_ID: Id dell'armatura nel database (armatura da elaborare)
  #	N1 = Numero di oggetti richiesti
  #	Skill_ID: Id della skill nel database (skill ottenuta)
  #	N2: Numero di skill ottenute
  #=========================================================================  
  ArmorToSkill = {2=>[1,1,2]}
  #=========================================================================
  #  ArmorToItem: Imposta le armature che elaborano oggetti
  #-------------------------------------------------------------------------
  #  Sintassi:
  #	ArmorToItem = {Armor_ID=>[N1,Item_ID,N2],...}
  #  Parametri:
  #	Armor_ID: Id dell'armatura nel database (armatura da elaborare)
  #	N1 = Numero di oggetti richiesti
  #	Item_ID: Id dell'oggetto nel database (oggetto ottenuto)
  #	N2: Numero di skill ottenute
  #=========================================================================  
  ArmorToItem = {3=>[8,4,4]}
  #=========================================================================
  #  Result_Time: Imposta il tempo di visualizzazione del risultato
  #-------------------------------------------------------------------------
  #  Sintassi:
  #	Result_Time = N
  #  Parametri:
  #	N = Numero di frame d'attesa (20 frame = 1 secondo)
  #=========================================================================  
  Result_Time = 30
end

class Window_ElaborableItem < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
	super(320, 64, 320, 416)
	@column_max = 1
	refresh
	self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def item
	return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
	if self.contents != nil
	  self.contents.dispose
	  self.contents = nil
	end
	@data = []
	# Add item
	add_item
	# Add weapon
	add_weapon
	# Add armor
	add_armor
	# If item count is not 0, make a bit map and draw all items
	@item_max = @data.size
	if @item_max > 0
	  self.contents = Bitmap.new(width - 32, row_max * 32)
	  for i in 0...@item_max
		draw_item(i)
	  end
	end
  end
  #--------------------------------------------------------------------------
  # * Add Item
  #--------------------------------------------------------------------------
  def add_item
	elaborable = []
	for i in Elabora::ItemToSkill.keys
	  elaborable.push(i)
	end
	for i in Elabora::ItemToItem.keys
	  elaborable.push(i)
	end
	for i in 1...$data_items.size
	  if $game_party.item_number(i) > 0 and elaborable.include?(i)
		@data.push($data_items[i])
	  end
	end
  end
  #--------------------------------------------------------------------------
  # * Add Weapon
  #--------------------------------------------------------------------------
  def add_weapon
	elaborable = []
	for i in Elabora::WeaponToSkill.keys
	  elaborable.push(i)
	end
	for i in Elabora::WeaponToItem.keys
	  elaborable.push(i)
	end
	for i in 1...$data_weapons.size
	  if $game_party.weapon_number(i) > 0 and elaborable.include?(i)
		@data.push($data_weapons[i])
	  end
	end
  end
  #--------------------------------------------------------------------------
  # * Add Weapon
  #--------------------------------------------------------------------------
  def add_armor
	elaborable = []
	for i in Elabora::ArmorToSkill.keys
	  elaborable.push(i)
	end
	for i in Elabora::ArmorToItem.keys
	  elaborable.push(i)
	end
	for i in 1...$data_armors.size
	  if $game_party.armor_number(i) > 0 and elaborable.include?(i)
		@data.push($data_armors[i])
	  end
	end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #	 index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
	item = @data[index]
	case item
	when RPG::Item
	  number = $game_party.item_number(item.id)
	when RPG::Weapon
	  number = $game_party.weapon_number(item.id)
	when RPG::Armor
	  number = $game_party.armor_number(item.id)
	end
	self.contents.font.color = normal_color
	x = 4 + index % @column_max * (288 + 32)
	y = index / @column_max * 32
	rect = Rect.new(x, y, self.width / @column_max - 32, 32)
	self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
	bitmap = RPG::Cache.icon(item.icon_name)
	self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
	self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
	self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
	self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
	@help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

class Window_ElaborationResult < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(item, n)
	super(160, 208, 320, 64)
	self.contents = Bitmap.new(width - 32, height - 32)
	self.z = 2000
	refresh(item, n)
  end  
  def refresh(item, n)
	self.contents.clear
	self.contents.draw_text(0, 0, 298, 32, "Hai ottenuto #{n} unità di #{item.name}!")
  end
end

class Window_ElaborateTarget < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
	super(0, 64, 320, 416)
	self.contents = Bitmap.new(width - 32, height - 32)
	self.z += 10
	@item_max = $game_party.actors.size
	refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
	self.contents.clear
	for i in 0...$game_party.actors.size
	  x = 4
	  y = i * 96
	  actor = $game_party.actors[i]
	  draw_actor_name(actor, x + 64, y)
	  draw_actor_class(actor, x + 64, y + 32)
	  draw_actor_graphic(actor, x + 24, y + 64)
	  draw_actor_level(actor, x + 208, y + 32)
	end
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
	# Cursor position -1 = all choices, -2 or lower = independent choice
	# (meaning the user's own choice)
	if @index <= -2
	  self.cursor_rect.set(0, (@index + 10) * 96, self.width - 32, 76)
	elsif @index == -1
	  self.cursor_rect.set(0, 0, self.width - 32, @item_max * 96 - 20)
	else
	  self.cursor_rect.set(0, @index * 96, self.width - 32, 86)
	end
  end
end

class Scene_Elaborate
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
	# Make help window, item window
	@help_window = Window_Help.new
	@item_window = Window_ElaborableItem.new
	# Make target window (set to invisible / inactive)
	@target_window = Window_ElaborateTarget.new
	@target_window.visible = false
	@target_window.active = false
	# Execute transition
	Graphics.transition
	# Main loop
	loop do
	  # Update game screen
	  Graphics.update
	  # Update input information
	  Input.update
	  # Frame update
	  update
	  # Abort loop if screen is changed
	  if $scene != self
		break
	  end
	end
	# Prepare for transition
	Graphics.freeze
	# Dispose of windows
	@help_window.dispose
	@item_window.dispose
	@target_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
	# Update windows
	@help_window.update
	@item_window.update
	@target_window.update
	if @item_window.active
	  update_item
	  return
	end
	if @target_window.active
	  update_target
	  return
	end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when item window is active)
  #--------------------------------------------------------------------------
  def update_item
	update_help
	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)
	  @item = @item_window.item
	  # Item?
	  if @item.is_a?(RPG::Item)
		if Elabora::ItemToItem.include?(@item.id)
		  o = Elabora::ItemToItem[@item.id]
		  if $game_party.item_number(@item.id) >= o[0]
			$game_system.se_play($data_system.decision_se)
			$game_party.lose_item(@item.id, o[0])
			$game_party.gain_item(o[1], o[2])
			@item_window.refresh
			@result_window = Window_ElaborationResult.new($data_items[o[1]], o[2])
			wait
			@result_window.dispose
		  else
			$game_system.se_play($data_system.buzzer_se)
		  end
		elsif Elabora::ItemToSkill.include?(@item.id)
		  o = Elabora::ItemToSkill[@item.id]
		  if $game_party.item_number(@item.id) >= o[0]
			$game_system.se_play($data_system.decision_se)
			$game_party.lose_item(@item.id, o[0])
			@help_window.set_text("Seleziona il personaggio che vuoi che acquisisca la magia")
			@item_window.active = false
			@target_window.active = true
			@target_window.visible = true
			@target_window.index = 0
		  else
			$game_system.se_play($data_system.buzzer_se)
		  end
		end
	  elsif @item.is_a?(RPG::Weapon)
		if Elabora::WeaponToItem.include?(@item.id)
		  o = Elabora::WeaponToItem[@item.id]
		  if $game_party.weapon_number(@item.id) >= o[0]
			$game_system.se_play($data_system.decision_se)
			$game_party.lose_weapon(@item.id, o[0])
			$game_party.gain_item(o[1], o[2])
			@item_window.refresh
			@result_window = Window_ElaborationResult.new($data_items[o[1]], o[2])
			wait
			@result_window.dispose
		  else
			$game_system.se_play($data_system.buzzer_se)
		  end
		elsif Elabora::WeaponToSkill.include?(@item.id)
		  o = Elabora::WeaponToSkill[@item.id]
		  if $game_party.weapon_number(@item.id) >= o[0]
			$game_system.se_play($data_system.decision_se)
			$game_party.lose_weapon(@item.id, o[0])
			@help_window.set_text("Seleziona il personaggio che vuoi che acquisisca la magia")
			@item_window.active = false
			@target_window.active = true
			@target_window.visible = true
			@target_window.index = 0
		  else
			$game_system.se_play($data_system.buzzer_se)
		  end
		end
	  elsif @item.is_a?(RPG::Armor)
		if Elabora::ArmorToItem.include?(@item.id)
		  o = Elabora::ArmorToItem[@item.id]
		  if $game_party.armor_number(@item.id) >= o[0]
			$game_system.se_play($data_system.decision_se)
			$game_party.lose_armor(@item.id, o[0])
			$game_party.gain_item(o[0], o[1])
			@item_window.refresh
			@result_window = Window_ElaborationResult.new($data_items[o[1]], o[2])
			wait
			@result_window.dispose
		  else
			$game_system.se_play($data_system.buzzer_se)
		  end
		elsif Elabora::ArmorToSkill.include?(@item.id)
		  o = Elabora::ArmorToSkill[@item.id]
		  if $game_party.armor_number(@item.id) >= o[0]
			$game_system.se_play($data_system.decision_se)
			$game_party.lose_armor(@item.id, o[0])
			@help_window.set_text("Seleziona il personaggio che vuoi che acquisisca la magia")
			@item_window.active = false
			@target_window.active = true
			@target_window.visible = true
			@target_window.index = 0
		  else
			$game_system.se_play($data_system.buzzer_se)
		  end
		end
	  end
	  return
	end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when target window is active)
  #--------------------------------------------------------------------------
  def update_target
	# If C button was pressed
	if Input.trigger?(Input::C)
	  if @item.is_a?(RPG::Item)
		o = Elabora::ItemToSkill[@item.id]
	  elsif @item.is_a?(RPG::Weapon)
		o = Elabora::WeaponToSkill[@item.id]
	  else @item.is_a?(RPG::Armor)
		o = Elabora::ArmorToSkill[@item.id]
	  end
	  $game_party.actors[@target_window.index].learn_skill(o[1], o[2])
	  @item_window.refresh
	  @result_window = Window_ElaborationResult.new($data_skills[o[1]], o[2])
	  wait
	  @result_window.dispose
	  @item_window.active = true
	  @target_window.visible = false
	  @target_window.active = false
	  return
	end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (help window)
  #--------------------------------------------------------------------------
  def update_help
	if @item_window.item.is_a?(RPG::Item)
	  if Elabora::ItemToItem.include?(@item_window.item.id)
		o = Elabora::ItemToItem[@item_window.item.id]
		@help_window.set_text(o[0].to_s+" unità per elaborare "+o[2].to_s+" "+$data_items[o[1]].name)
	  elsif Elabora::ItemToSkill.include?(@item_window.item.id)
		o = Elabora::ItemToSkill[@item_window.item.id]
		@help_window.set_text(o[0].to_s+" unità per elaborare "+o[2].to_s+" magie "+$data_skills[o[1]].name)
	  end
	elsif @item_window.item.is_a?(RPG::Weapon)
	  if Elabora::WeaponToItem.include?(@item_window.item.id)
		o = Elabora::WeaponToItem[@item_window.item.id]
		@help_window.set_text("#{o[0]} unità per elaborare #{o[2]} #{$data_items[o[1]].name}")
	  elsif Elabora::WeaponToSkill.include?(@item_window.item.id)
		o = Elabora::WeaponToSkill[@item_window.item.id]
		@help_window.set_text(o[0].to_s+" unità per elaborare "+o[2].to_s+" magie "+$data_skills[o[1]].name)
	  end
	elsif @item_window.item.is_a?(RPG::Armor)
	  if Elabora::ArmorToItem.include?(@item_window.item.id)
		o = Elabora::ArmorToItem[@item_window.item.id]
		@help_window.set_text(o[0].to_s+" unità per elaborare "+o[2].to_s+" "+$data_items[o[1]].name)
	  elsif Elabora::ArmorToSkill.include?(@item_window.item.id)
		o = Elabora::ArmorToSkill[@item_window.item.id]
		@help_window.set_text(o[0].to_s+" unità per elaborare "+o[2].to_s+" magie "+$data_skills[o[1]].name)
	  end
	end
  end
  #--------------------------------------------------------------------------
  # * Wait
  #--------------------------------------------------------------------------
  def wait
	for i in 0...Elabora::Result_Time
	  sleep 0.01
	  Graphics.update
	end
  end
end

 

 

 



Istruzioni per l'uso

Per richiamare la scena usare il seguente codice:
CODICE

$scene = Scene_Elaborate.new 

 

Per elaborare le magie dovete avere anche lo script Final Fantasy VIII Magic System o lo script vi darà errore.

Per personalizzare lo script andate nella sezione configurazione.

Bugs e Conflitti Noti


N/A

Edited by Apo
applicato tag code
Link to comment
Share on other sites

Impeccabile come sempre.

Partecipante al Rpg2s.net Game Contest 2008/2009
http://www.rpg2s.net/contest/GameContest0809/gc0809-bannerino.jpg
Gioco in Sviluppo: Oromis' Tale

Premi Rpg2s.net Game Contest 2008/2009:
http://www.rpg2s.net/gif/GC_programmazione2.gif Miglior Programmazione XP: 2°
http://www.rpg2s.net/gif/GC_premio3.gif Longevità: 3°

Hiken... Tsubame Gaeshi!

Link to comment
Share on other sites

Scusa ma ho trovato un bug.

 

Se non si ha almeno 1 unità IN PIU' di quelle richieste non si elabora niente.

 

Mi spiego:

 

Con 3 unità di Pozione ne elabori 1 di Pozione Raffinata.

 

Se hai solo 3 Pozioni e cerchi di elaborare, non funziona (è come se l'elaborazione fosse impossibile) mentre se ne hai 4 o più si può elaborare.

 

E' possibile correggere?

Partecipante al Rpg2s.net Game Contest 2008/2009
http://www.rpg2s.net/contest/GameContest0809/gc0809-bannerino.jpg
Gioco in Sviluppo: Oromis' Tale

Premi Rpg2s.net Game Contest 2008/2009:
http://www.rpg2s.net/gif/GC_programmazione2.gif Miglior Programmazione XP: 2°
http://www.rpg2s.net/gif/GC_premio3.gif Longevità: 3°

Hiken... Tsubame Gaeshi!

Link to comment
Share on other sites

  • 8 months later...

mmm funziona e devo farti i complimenti, ma non è possibile elaborare un oggetto che richiede più di un ingrediente diverso?

 

Per esempio... voglio fare Armatura Super, e per elaborarla servono 2 Armature rotte e 1 Polvere aggiustina (!).... come si fa? Riesco a fare solo elaborazioni che richiedono 1 ingrediente °°

 

Se non è programmata (temo di sì) la potresti tenere in considerazione per un update?

Link to comment
Share on other sites

Guarda che manca input B per tornare indietro dalla windowstatus... ok editato

 

#=======================================================
# Elabora
#------------------------------------------------------------------------------
# Autore: The Sleeping Leonhart
# Versione: 1.0
# Data di rilascio: 18/06/2008
#------------------------------------------------------------------------------
# Descrizione:
# Questo script permette di elaborare oggetti come in Final Fantasy VIII.
# Consumando una determinata quantità di oggetti si possono ottenere nuovi
# oggetti o magie.
#------------------------------------------------------------------------------
# Istruzioni:
# Per richiamare la scena usare il seguente codice:
# $scene = Scene_Elaborate.new
# Per elaborare le magie dovete avere anche lo script Final Fantasy VIII Magic System
# o lo script vi darà errore.
# Per personalizzare lo script andate nella sezione configurazione.
#==============================================================================

#==============================================================================
# Configurazione
#==============================================================================
module Elabora
#=========================================================================
# ItemToSkill: Imposta gli oggetti che elaborano skill.
#-------------------------------------------------------------------------
# Sintassi:
# ItemToSkill = {Item_ID=>[N1,Skill_ID,N2],...}
# Parametri:
# Item_ID: Id dell'oggetto nel database (oggetto da elaborare)
# N1 = Numero di oggetti richiesti
# Skill_ID: Id della skill nel database (skill ottenuta)
# N2: Numero di skill ottenute
#=========================================================================
ItemToSkill = {1=>[1,2,10]}
#=========================================================================
# ItemToItem: Imposta gli oggetti che elaborano oggetti
#-------------------------------------------------------------------------
# Sintassi:
# ItemToItem = {Item_ID1=>[N1,Item_ID2,N2],...}
# Parametri:
# Item_ID1: Id dell'oggetto nel database (oggetto da elaborare)
# N1 = Numero di oggetti richiesti
# Item_ID2: Id dell'oggetto nel database (oggetto ottenuto)
# N2: Numero di skill ottenute
#=========================================================================
ItemToItem = {2=>[10,1,2]}
#=========================================================================
# WeaponToSkill: Imposta le armi che elaborano skill.
#-------------------------------------------------------------------------
# Sintassi:
# WeaponToSkill = {Weapon_ID=>[N1,Skill_ID,N2],...}
# Parametri:
# Weapon_ID: Id dell'arma nel database (arma da elaborare)
# N1 = Numero di oggetti richiesti
# Skill_ID: Id della skill nel database (skill ottenuta)
# N2: Numero di skill ottenute
#=========================================================================
WeaponToSkill = {4=>[1,3,10]}
#=========================================================================
# WeaponToItem: Imposta le armi che elaborano oggetti
#-------------------------------------------------------------------------
# Sintassi:
# WeaponToItem = {Weapon_ID=>[N1,Item_ID,N2],...}
# Parametri:
# Weapon_ID: Id dell'arma nel database (arma da elaborare)
# N1 = Numero di oggetti richiesti
# Item_ID: Id dell'oggetto nel database (oggetto ottenuto)
# N2: Numero di skill ottenute
#=========================================================================
WeaponToItem = {2=>[10,7,3]}
#=========================================================================
# ArmorToSkill: Imposta le armature che elaborano skill.
#-------------------------------------------------------------------------
# Sintassi:
# ArmorToSkill = {Armor_ID=>[N1,Skill_ID,N2],...}
# Parametri:
# Armor_ID: Id dell'armatura nel database (armatura da elaborare)
# N1 = Numero di oggetti richiesti
# Skill_ID: Id della skill nel database (skill ottenuta)
# N2: Numero di skill ottenute
#=========================================================================
ArmorToSkill = {2=>[1,1,2]}
#=========================================================================
# ArmorToItem: Imposta le armature che elaborano oggetti
#-------------------------------------------------------------------------
# Sintassi:
# ArmorToItem = {Armor_ID=>[N1,Item_ID,N2],...}
# Parametri:
# Armor_ID: Id dell'armatura nel database (armatura da elaborare)
# N1 = Numero di oggetti richiesti
# Item_ID: Id dell'oggetto nel database (oggetto ottenuto)
# N2: Numero di skill ottenute
#=========================================================================
ArmorToItem = {3=>[8,4,4]}
#=========================================================================
# Result_Time: Imposta il tempo di visualizzazione del risultato
#-------------------------------------------------------------------------
# Sintassi:
# Result_Time = N
# Parametri:
# N = Numero di frame d'attesa (20 frame = 1 secondo)
#=========================================================================
Result_Time = 30
end

class Window_ElaborableItem < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(320, 64, 320, 416)
@column_max = 1
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Add item
add_item
# Add weapon
add_weapon
# Add armor
add_armor
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Add Item
#--------------------------------------------------------------------------
def add_item
elaborable = []
for i in Elabora::ItemToSkill.keys
elaborable.push(i)
end
for i in Elabora::ItemToItem.keys
elaborable.push(i)
end
for i in 1...$data_items.size
if $game_party.item_number(i) > 0 and elaborable.include?(i)
@data.push($data_items[i])
end
end
end
#--------------------------------------------------------------------------
# * Add Weapon
#--------------------------------------------------------------------------
def add_weapon
elaborable = []
for i in Elabora::WeaponToSkill.keys
elaborable.push(i)
end
for i in Elabora::WeaponToItem.keys
elaborable.push(i)
end
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and elaborable.include?(i)
@data.push($data_weapons[i])
end
end
end
#--------------------------------------------------------------------------
# * Add Weapon
#--------------------------------------------------------------------------
def add_armor
elaborable = []
for i in Elabora::ArmorToSkill.keys
elaborable.push(i)
end
for i in Elabora::ArmorToItem.keys
elaborable.push(i)
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and elaborable.include?(i)
@data.push($data_armors[i])
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
self.contents.font.color = normal_color
x = 4 + index % @column_max * (288 + 32)
y = index / @column_max * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end

class Window_ElaborationResult < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(item, n)
super(160, 208, 320, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.z = 2000
refresh(item, n)
end
def refresh(item, n)
self.contents.clear
self.contents.draw_text(0, 0, 298, 32, "Hai ottenuto #{n} unità di #{item.name}!")
end
end

class Window_ElaborateTarget < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 64, 320, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.z += 10
@item_max = $game_party.actors.size
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 4
y = i * 96
actor = $game_party.actors[i]
draw_actor_name(actor, x + 64, y)
draw_actor_class(actor, x + 64, y + 32)
draw_actor_graphic(actor, x + 24, y + 64)
draw_actor_level(actor, x + 208, y + 32)
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
# Cursor position -1 = all choices, -2 or lower = independent choice
# (meaning the user's own choice)
if @index <= -2
self.cursor_rect.set(0, (@index + 10) * 96, self.width - 32, 76)
elsif @index == -1
self.cursor_rect.set(0, 0, self.width - 32, @item_max * 96 - 20)
else
self.cursor_rect.set(0, @index * 96, self.width - 32, 86)
end
end
end

class Scene_Elaborate
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make help window, item window
@help_window = Window_Help.new
@item_window = Window_ElaborableItem.new
# Make target window (set to invisible / inactive)
@target_window = Window_ElaborateTarget.new
@target_window.visible = false
@target_window.active = false
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@item_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@help_window.update
@item_window.update
@target_window.update
if @item_window.active
update_item
return
end
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
def update_item
update_help
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)
@item = @item_window.item
# Item?
if @item.is_a?(RPG::Item)
if Elabora::ItemToItem.include?(@item.id)
o = Elabora::ItemToItem[@item.id]
if $game_party.item_number(@item.id) >= o[0]
$game_system.se_play($data_system.decision_se)
$game_party.lose_item(@item.id, o[0])
$game_party.gain_item(o[1], o[2])
@item_window.refresh
@result_window = Window_ElaborationResult.new($data_items[o[1]], o[2])
wait
@result_window.dispose
else
$game_system.se_play($data_system.buzzer_se)
end
elsif Elabora::ItemToSkill.include?(@item.id)
o = Elabora::ItemToSkill[@item.id]
if $game_party.item_number(@item.id) >= o[0]
$game_system.se_play($data_system.decision_se)
$game_party.lose_item(@item.id, o[0])
@help_window.set_text("Seleziona il personaggio che vuoi che acquisisca la magia")
@item_window.active = false
@target_window.active = true
@target_window.visible = true
@target_window.index = 0

else
$game_system.se_play($data_system.buzzer_se)
end
end
elsif @item.is_a?(RPG::Weapon)
if Elabora::WeaponToItem.include?(@item.id)
o = Elabora::WeaponToItem[@item.id]
if $game_party.weapon_number(@item.id) >= o[0]
$game_system.se_play($data_system.decision_se)
$game_party.lose_weapon(@item.id, o[0])
$game_party.gain_item(o[1], o[2])
@item_window.refresh
@result_window = Window_ElaborationResult.new($data_items[o[1]], o[2])
wait
@result_window.dispose
else
$game_system.se_play($data_system.buzzer_se)
end
elsif Elabora::WeaponToSkill.include?(@item.id)
o = Elabora::WeaponToSkill[@item.id]
if $game_party.weapon_number(@item.id) >= o[0]
$game_system.se_play($data_system.decision_se)
$game_party.lose_weapon(@item.id, o[0])
@help_window.set_text("Seleziona il personaggio che vuoi che acquisisca la magia")
@item_window.active = false
@target_window.active = true
@target_window.visible = true
@target_window.index = 0
else
$game_system.se_play($data_system.buzzer_se)
end
end
elsif @item.is_a?(RPG::Armor)
if Elabora::ArmorToItem.include?(@item.id)
o = Elabora::ArmorToItem[@item.id]
if $game_party.armor_number(@item.id) >= o[0]
$game_system.se_play($data_system.decision_se)
$game_party.lose_armor(@item.id, o[0])
$game_party.gain_item(o[0], o[1])
@item_window.refresh
@result_window = Window_ElaborationResult.new($data_items[o[1]], o[2])
wait
@result_window.dispose
else
$game_system.se_play($data_system.buzzer_se)
end
elsif Elabora::ArmorToSkill.include?(@item.id)
o = Elabora::ArmorToSkill[@item.id]
if $game_party.armor_number(@item.id) >= o[0]
$game_system.se_play($data_system.decision_se)
$game_party.lose_armor(@item.id, o[0])
@help_window.set_text("Seleziona il personaggio che vuoi che acquisisca la magia")
@item_window.active = false
@target_window.active = true
@target_window.visible = true
@target_window.index = 0
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
def update_target
# If C button was pressed
if Input.trigger?(Input::B)
@item_window.active = true
@target_window.visible = false
@target_window.active = false
end
if Input.trigger?(Input::C)
if @item.is_a?(RPG::Item)
o = Elabora::ItemToSkill[@item.id]
elsif @item.is_a?(RPG::Weapon)
o = Elabora::WeaponToSkill[@item.id]
else @item.is_a?(RPG::Armor)
o = Elabora::ArmorToSkill[@item.id]
end
$game_party.actors[@target_window.index].learn_skill(o[1], o[2])
@item_window.refresh
@result_window = Window_ElaborationResult.new($data_skills[o[1]], o[2])
wait
@result_window.dispose
@item_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (help window)
#--------------------------------------------------------------------------
def update_help
if @item_window.item.is_a?(RPG::Item)
if Elabora::ItemToItem.include?(@item_window.item.id)
o = Elabora::ItemToItem[@item_window.item.id]
@help_window.set_text(o[0].to_s+" unità per elaborare "+o[2].to_s+" "+$data_items[o[1]].name)
elsif Elabora::ItemToSkill.include?(@item_window.item.id)
o = Elabora::ItemToSkill[@item_window.item.id]
@help_window.set_text(o[0].to_s+" unità per elaborare "+o[2].to_s+" magie "+$data_skills[o[1]].name)
end
elsif @item_window.item.is_a?(RPG::Weapon)
if Elabora::WeaponToItem.include?(@item_window.item.id)
o = Elabora::WeaponToItem[@item_window.item.id]
@help_window.set_text("#{o[0]} unità per elaborare #{o[2]} #{$data_items[o[1]].name}")
elsif Elabora::WeaponToSkill.include?(@item_window.item.id)
o = Elabora::WeaponToSkill[@item_window.item.id]
@help_window.set_text(o[0].to_s+" unità per elaborare "+o[2].to_s+" magie "+$data_skills[o[1]].name)
end
elsif @item_window.item.is_a?(RPG::Armor)
if Elabora::ArmorToItem.include?(@item_window.item.id)
o = Elabora::ArmorToItem[@item_window.item.id]
@help_window.set_text(o[0].to_s+" unità per elaborare "+o[2].to_s+" "+$data_items[o[1]].name)
elsif Elabora::ArmorToSkill.include?(@item_window.item.id)
o = Elabora::ArmorToSkill[@item_window.item.id]
@help_window.set_text(o[0].to_s+" unità per elaborare "+o[2].to_s+" magie "+$data_skills[o[1]].name)
end
end
end
#--------------------------------------------------------------------------
# * Wait
#--------------------------------------------------------------------------
def wait
for i in 0...Elabora::Result_Time
sleep 0.01
Graphics.update
end
end
end

 

 

 

Edited by Apo
applicato tag code

http://img256.imageshack.us/img256/7639/ihateyou.gif

Un uomo senza religione è come un pesce senza bicicletta.

http://img18.imageshack.us/img18/3668/decasoft1.png

http://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gif

Link to comment
Share on other sites

una volta che aprivi la window status eri costretto a selezionare un target adesso no schiacci B e torna indietro

http://img256.imageshack.us/img256/7639/ihateyou.gif

Un uomo senza religione è come un pesce senza bicicletta.

http://img18.imageshack.us/img18/3668/decasoft1.png

http://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gif

Link to comment
Share on other sites

Lol possibile che mi perda pezzi di codice?

Grazie MasterSion, appena posso sistemo.

@Goofy !

Francamente non ricordo, comunque penso di no in quanto in Final Fantasy VIII un ogetto ne elaborava tanti e non viceversa quindi credo di aver usato quella struttura, quando posso do una sistemata generale.

Link to comment
Share on other sites

Ho già sistemato lol

http://img256.imageshack.us/img256/7639/ihateyou.gif

Un uomo senza religione è come un pesce senza bicicletta.

http://img18.imageshack.us/img18/3668/decasoft1.png

http://rpg2s.net/gif/SCContest1Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gifhttp://rpg2s.net/gif/SCContest2Oct.gif

Link to comment
Share on other sites

  • 2 years later...
una curiosità ragazzi, questo script che è una figata assurda(mi è venuto il dubbio leggendo qui sopra)se devo elaborare un oggetto con 100 unità di un qualcosa, me lo fa fare? cmq piccolo problema o no a parte, veramente un ottimo lavoro! degno di nota!
Link to comment
Share on other sites

Come ti ho detto prima di chiedere prova!

Leggi il regolamento e ricordati di cercare provare prima da solo prima di chiedere o saranno presi provvedimenti.

^ ^

(\_/)
(^ ^) <----coniglietto rosso, me!
(> <)


Il mio Tumblr dove seguire i miei progetti, i progetti della Reverie : : Project ^ ^

http://i.imgur.com/KdUDtQt.png disponibile su Google Play, qui i dettagli! ^ ^

http://i.imgur.com/FwnGMI3.png completo! Giocabile online, qui i dettagli! ^ ^

REVERIE : : RENDEZVOUS (In allenamento per apprendere le buone arti prima di cominciarlo per bene ^ ^) Trovate i dettagli qui insieme alla mia intervista (non utilizzerò più rpgmaker) ^ ^

 

SUWOnzB.jpg 🖤
http://www.rpg2s.net/dax_games/r2s_regali2s.png E:3 http://www.rpg2s.net/dax_games/xmas/gifnatale123.gif
http://i.imgur.com/FfvHCGG.png by Testament (notare dettaglio in basso a destra)! E:3
http://i.imgur.com/MpaUphY.jpg by Idriu E:3

Membro Onorario, Ambasciatore dei Coniglietti (Membro n.44)

http://i.imgur.com/PgUqHPm.png
Ufficiale
"Ad opera della sua onestà e del suo completo appoggio alla causa dei Panda, Guardian Of Irael viene ufficialmente considerato un Membro portante del Partito, e Ambasciatore del suo Popolo presso di noi"


http://i.imgur.com/TbRr4iS.png<- Grazie Testament E:3
Ricorda...se rivolgi il tuo sguardo ^ ^ a Guardian anche Guardian volge il suo sguardo ^ ^ a te ^ ^
http://i.imgur.com/u8UJ4Vm.gifby Flame ^ ^
http://i.imgur.com/VbggEKS.gifhttp://i.imgur.com/2tJmjFJ.gifhttp://projectste.altervista.org/Our_Hero_adotta/ado2.png
Grazie Testament XD Fan n°1 ufficiale di PQ! :D

Viva
il Rhaxen! <- Folletto te lo avevo detto (fa pure rima) che non
avevo programmi di grafica per fare un banner su questo pc XD (ora ho di
nuovo il mio PC veramente :D)

Rosso Guardiano della
http://i.imgur.com/Os5rvhx.png

Rpg2s RPG BY FORUM:

Nome: Darth Reveal

 

PV totali 2
PA totali 16

Descrizione: ragazzo dai lunghi capelli rossi ed occhi dello stesso colore. Indossa una elegante giacca rossa sopra ad una maglietta nera. Porta pantaloni rossi larghi, una cintura nera e degli stivali dello stesso colore. E' solito trasportare lo spadone dietro la schiena in un fodero apposito. Ha un pendente al collo e tiene ben legato un pezzo di stoffa (che gli sta particolarmente a cuore) intorno al braccio sinistro sotto la giacca, copre una cicatrice.
Bozze vesti non definitive qui.

Equipaggiamento:
Indossa:
60$ e 59$ divisi in due tasche interne
Levaitan

Spada a due mani elsa lunga

Guanti del Defender (2PA)
Anello del linguaggio animale (diventato del Richiamo)

Scrinieri da lanciere (2 PA)

Elmo del Leone (5 PA)

Corazza del Leone in Ferro Corrazzato (7 PA)

ZAINO (20) contenente:
Portamonete in pelle di cinghiale contenente: 100$
Scatola Sanitaria Sigillata (può contenere e tenere al sicuro fino a 4 oggetti curativi) (contiene Benda di pronto soccorso x3, Pozione di cura)
Corda
Bottiglia di idromele
Forma di formaggio
Torcia (serve ad illuminare, dura tre settori)

Fiasca di ceramica con Giglio Amaro (Dona +1PN e Velocità all'utilizzatore)
Ampolla Bianca

Semi di Balissa

 

CAVALLO NORMALE + SELLA (30 +2 armi) contentente:
66$
Benda di pronto soccorso x3
Spada a due mani

Fagotto per Adara (fazzoletto ricamato)


 

Link to comment
Share on other sites

mado'....non pensavo ce la si prendesse per così poco ma ok! scusate! taglio qui la risposta cmq perchè non mi va di polemizzare, non è il contesto giusto..niente, spero invece di avere aggiornamenti su altri script sulle relative pagine ma questo è un altro discorso!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...