Jump to content
Rpg²S Forum
  • 0

Suddividere gli oggetti in 2 categorie per id


MasterSion
 Share

Question

Ho un problema devo creare un altra window_item che "scriva" solo gli oggetti con un id maggiore a 900.

Spero di essere stato chiaro.

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

4 answers to this question

Recommended Posts

  • 0

Ecco la Window_Item2, nella quale ci sono tutti gli items, weapons e armors con ID superiore a 900.

Intendevi solo la Window, no?

Naturalmente, per il resto è identica a quella RTP.

PS: Ho inserito un "# Edit" sulle righe che ho aggiunto.

#==============================================================================# ** Window_Item2#------------------------------------------------------------------------------#  This window displays items in possession on the item and battle screens.#============================================================================== class Window_Item2 < Window_Selectable  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize	super(0, 64, 640, 416)	@column_max = 2	refresh	self.index = 0	# If in battle, move window to center of screen	# and make it semi-transparent	if $game_temp.in_battle	  self.y = 64	  self.height = 256	  self.back_opacity = 160	end  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	for i in 1...$data_items.size	  if $data_items[i].id > 900 # Edit		if $game_party.item_number(i) > 0		  @data.push($data_items[i])		end	  end # Edit	end	# Also add weapons and items if outside of battle	unless $game_temp.in_battle	  for i in 1...$data_weapons.size		if $data_weapons[i].id > 900 # Edit		  if $game_party.weapon_number(i) > 0			@data.push($data_weapons[i])		  end # Edit		end	  end	  for i in 1...$data_armors.size		if $data_armors[i].id > 900 # Edit		  if $game_party.armor_number(i) > 0			@data.push($data_armors[i])		  end		end # Edit	  end	end	# If item count is not 0, make a bit map and draw all items	@item_max = @data.size	if @item_max > 0	  self.contents = Bitmap.new(width - 32, row_max * 32)	  for i in 0...@item_max		draw_item(i)	  end	end  end  #--------------------------------------------------------------------------  # * Draw Item  #	 index : item number  #--------------------------------------------------------------------------  def draw_item(index)	item = @data[index]	case item	when RPG::Item	  number = $game_party.item_number(item.id)	when RPG::Weapon	  number = $game_party.weapon_number(item.id)	when RPG::Armor	  number = $game_party.armor_number(item.id)	end	if item.is_a?(RPG::Item) and	   $game_party.item_can_use?(item.id)	  self.contents.font.color = normal_color	else	  self.contents.font.color = disabled_color	end	x = 4 + index % 2 * (288 + 32)	y = index / 2 * 32	rect = Rect.new(x, y, self.width / @column_max - 32, 32)	self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))	bitmap = RPG::Cache.icon(item.icon_name)	opacity = self.contents.font.color == normal_color ? 255 : 128	self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)	self.contents.draw_text(x + 28, y, 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)  endend

Edited by Amos_MHF

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

  • 0

hahaha che cavolata e io mi stavo cervellando

  @item_max = @data.size	@item_id = item.id	if @item_max > 0 if item.id > 900	  self.contents = Bitmap.new(width - 32, row_max * 32)	  for i in 0...@item_max		draw_item(i)		end		end	  end	end

guarda cosa stavo scrivendo.

Non mi sono reso conto che in quel punto che hai editato utilizzava già l'id

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

  • 0

Sinceramente, ero praticamente sicuro di non aver capito la tua richiesta, dato che da qualche tuo post si legge che saresti perfettamente in grado di fare una cosa del genere.

 

Beh, per lo scervellamento... capita ^ ^

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

  • 0
Si infatti. Grazie mille comunque :smile:

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

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