Jump to content
Rpg²S Forum
  • 0

Stavo creando un menù


Squall_Leonheart
 Share

Question

Salve a tutti,dunque stavo cercando di creare un menù impostato in questo modo:

 

Nell'index del menù ci sono le opzioni esci salva ed oggetti,sotto c'è la window play time e la window gold,a sinistra si dovrebbero visualizzare gli oggetti in possesso,qui se ne ho uno il maker mi segnala l'errore nella window item,precisamente qui :

  def refresh	if self.contents != nil	  self.contents.dispose	  self.contents = nil	end	@data = []	for i in 1...$data_items.size	  if $game_party.item_number(i) > 0		@data.push($data_items[i])	  end	end	@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

 

Credo riguardo la visione del bitmap,ma non capisco perchè faccia cosi.

Inoltre per usare gli oggetti ho messo che clikkando sul comando si interagisca come di solito nella casella item,questo funge tranquillamente però..Quindi non trovo l'errore

Iscriviti sul mio canale youtube -

https://www.youtube.com/channel/UCYOxXExvlXiOFfYD1fTFpww?view_as=subscriber

Seguimi su Instagram -

https://www.instagram.com/ancestralguitarist/

---------------------------------------------------------------------------------------------------------------------------------------
Contest vinti
---------------------------------------------------------------------------------------------------------------------------------------

FACE CONTEST # 3
BANNER CONTEST #69

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

Non ho capito niente.

Allora hai un menù solo con le voci salva, esci ed oggetti.

TU vuoi che, quando il giocatore clicca su oggetti compaia la finestra oggetti nella scene_menù ?

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
Allora la finestra oggetti si deve già vedere nella scene,poi quando premi su oggetti i bottoni salva etc scompaiono e si può interagire con gli oggetti

Iscriviti sul mio canale youtube -

https://www.youtube.com/channel/UCYOxXExvlXiOFfYD1fTFpww?view_as=subscriber

Seguimi su Instagram -

https://www.instagram.com/ancestralguitarist/

---------------------------------------------------------------------------------------------------------------------------------------
Contest vinti
---------------------------------------------------------------------------------------------------------------------------------------

FACE CONTEST # 3
BANNER CONTEST #69

Link to comment
Share on other sites

  • 0

alllora richiama la scene menù e riduci le dimensioni del commando con una if.

Puoi scaricarti il compact menù di sleeping (presente in questo forum) per capire come funziona

 

Edit: devo essere ubriaco...

Allora devi richiamare la window_item.

Per ridurre le dimensioni della window_command inserisci when 1 (per esempio) altro che (s1,s2,s3) scrivi solo s1

Edited by MasterSion

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

Si ma questo lo avevo fattoASD

Se leggi sopra il mio problema è che quando l'eroe ha degli oggetti mi da l'errore nelle righe sopracitate

Iscriviti sul mio canale youtube -

https://www.youtube.com/channel/UCYOxXExvlXiOFfYD1fTFpww?view_as=subscriber

Seguimi su Instagram -

https://www.instagram.com/ancestralguitarist/

---------------------------------------------------------------------------------------------------------------------------------------
Contest vinti
---------------------------------------------------------------------------------------------------------------------------------------

FACE CONTEST # 3
BANNER CONTEST #69

Link to comment
Share on other sites

  • 0

hai copiato anche tutte le parti dalla scene_item nella scene_menù?

tipo update item e blablabla

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

Allora,ora ti posto le 3 classi cosi vedi tu:

 

Scene_Menu

 

#==============================================================================# ** Scene_Menu#------------------------------------------------------------------------------#  This class performs menu screen processing.#==============================================================================class Scene_Menu  #--------------------------------------------------------------------------  # * Object Initialization  #	 menu_index : command cursor's initial position  #--------------------------------------------------------------------------  def initialize(menu_index = 0)	@menu_index = menu_index   end  #--------------------------------------------------------------------------  # * Main Processing  #--------------------------------------------------------------------------  def main	# Make command window	s1 = "Usa Oggetti"	s2 = "Save"	s3 = "End Game"	@command_window = Window_Command.new(160, [s1, s2, s3,])	@command_window.x = 500	@command_window.y = 100	@command_window.opacity = 0	@command_window.index = @menu_index	# If number of party members is 0	if $game_party.actors.size == 0	  # Disable items, skills, equipment, and status	  @command_window.disable_item(0)	  @command_window.disable_item(1)	  @command_window.disable_item(2)	  @command_window.disable_item(3)	end	# If save is forbidden	if $game_system.save_disabled	  # Disable save	  @command_window.disable_item(4)	end	# Make play time window	@playtime_window = Window_PlayTime.new	@playtime_window.x = 0	@playtime_window.y = 400	@playtime_window.opacity = 0	# Make steps window	# Make gold window	@gold_window = Window_Gold.new	@gold_window.x = 400	@gold_window.y = 416	@gold_window.opacity = 0	@items_window = Window_ItemS.new	@items_window.opacity = 0	# Make status window	@menu = Sprite.new	@menu.bitmap = Bitmap.new("Graphics/Pictures/Menù")	# 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	@command_window.dispose	@playtime_window.dispose	@gold_window.dispose  end  #--------------------------------------------------------------------------  # * Frame Update  #--------------------------------------------------------------------------  def update	# Update windows		@command_window.update	@playtime_window.update	@gold_window.update	# If command window is active: call update_command	if @command_window.active	  update_command	  return	end	# If status window is active: call update_status	if @status_window.active	  update_status	  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)	  # If command other than save or end game, and party members = 0	  if $game_party.actors.size == 0 and @command_window.index < 4		# Play buzzer SE		$game_system.se_play($data_system.buzzer_se)		return	  end	  # Branch by command window cursor position	  case @command_window.index	  when 0  # item		# Play decision SE		$game_system.se_play($data_system.decision_se)		# Switch to item screen		$scene = Scene_ItemS.new	  when 1  # save		# If saving is forbidden		if $game_system.save_disabled		  # Play buzzer SE		  $game_system.se_play($data_system.buzzer_se)		  return		end		# Play decision SE		$game_system.se_play($data_system.decision_se)		# Switch to save screen		$scene = Scene_Save.new	  when 2  # end game		# Play decision SE		$game_system.se_play($data_system.decision_se)		# Switch to end game screen		$scene = Scene_End.new	  end	  return	end  end  end

 

 

Scene_ItemS

 

#==============================================================================# ** Scene_Item#------------------------------------------------------------------------------#  This class performs item screen processing.#============================================================================== class Scene_ItemS  #--------------------------------------------------------------------------  # * Main Processing  #--------------------------------------------------------------------------  def main	# Make help window, item window	@help_window = Window_Help.new	@item_window = Window_Item.new	# Associate help window	@item_window.help_window = @help_window	# Make target window (set to invisible / inactive)	@target_window = Window_Target.new	@target_window.visible = false	@target_window.active = false	@item_window.opacity = 0	@help_window.y = 420	@help_window.opacity = 0	@menu = Sprite.new	@menu.bitmap = Bitmap.new("Graphics/Pictures/Menù")	# 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 is active: call update_item	if @item_window.active	  update_item	  return	end	# If target window is active: call update_target	if @target_window.active	  update_target	  return	end  end  #--------------------------------------------------------------------------  # * Frame Update (when item window is active)  #--------------------------------------------------------------------------  def update_item	# If B button was pressed	if Input.trigger?(Input::B)	  # Play cancel SE	  $game_system.se_play($data_system.cancel_se)	  # Switch to menu screen	  $scene = Scene_Menu.new(0)	  return	end	# If C button was pressed	if Input.trigger?(Input::C)	  # Get currently selected data on the item window	  @item = @item_window.item	  # If not a use item	  unless @item.is_a?(RPG::Item)		# Play buzzer SE		$game_system.se_play($data_system.buzzer_se)		return	  end	  # If it can't be used	  unless $game_party.item_can_use?(@item.id)		# Play buzzer SE		$game_system.se_play($data_system.buzzer_se)		return	  end	  # Play decision SE	  $game_system.se_play($data_system.decision_se)	  # If effect scope is an ally	  if @item.scope >= 3		# Activate target window		@item_window.active = false		@target_window.x = (@item_window.index + 1) % 2 * 304		@target_window.visible = true		@target_window.active = true		# Set cursor position to effect scope (single / all)		if @item.scope == 4 || @item.scope == 6		  @target_window.index = -1		else		  @target_window.index = 0		end	  # If effect scope is other than an ally	  else		# If command event ID is valid		if @item.common_event_id > 0		  # Command event call reservation		  $game_temp.common_event_id = @item.common_event_id		  # Play item use SE		  $game_system.se_play(@item.menu_se)		  # If consumable		  if @item.consumable			# Decrease used items by 1			$game_party.lose_item(@item.id, 1)			# Draw item window item			@item_window.draw_item(@item_window.index)		  end		  # Switch to map screen		  $scene = Scene_Map.new		  return		end	  end	  return	end  end  #--------------------------------------------------------------------------  # * Frame Update (when target window is active)  #--------------------------------------------------------------------------  def update_target	# If B button was pressed	if Input.trigger?(Input::B)	  # Play cancel SE	  $game_system.se_play($data_system.cancel_se)	  # If unable to use because items ran out	  unless $game_party.item_can_use?(@item.id)		# Remake item window contents		@item_window.refresh	  end	  # Erase target window	  @item_window.active = true	  @target_window.visible = false	  @target_window.active = false	  return	end	# If C button was pressed	if Input.trigger?(Input::C)	  # If items are used up	  if $game_party.item_number(@item.id) == 0		# Play buzzer SE		$game_system.se_play($data_system.buzzer_se)		return	  end	  # If target is all	  if @target_window.index == -1		# Apply item effects to entire party		used = false		for i in $game_party.actors		  used |= i.item_effect(@item)		end	  end	  # If single target	  if @target_window.index >= 0		# Apply item use effects to target actor		target = $game_party.actors[@target_window.index]		used = target.item_effect(@item)	  end	  # If an item was used	  if used		# Play item use SE		$game_system.se_play(@item.menu_se)		# If consumable		if @item.consumable		  # Decrease used items by 1		  $game_party.lose_item(@item.id, 1)		  # Redraw item window item		  @item_window.draw_item(@item_window.index)		end		# Remake target window contents		@target_window.refresh		# If all party members are dead		if $game_party.all_dead?		  # Switch to game over screen		  $scene = Scene_Gameover.new		  return		end		# If common event ID is valid		if @item.common_event_id > 0		  # Common event call reservation		  $game_temp.common_event_id = @item.common_event_id		  # Switch to map screen		  $scene = Scene_Map.new		  return		end	  end	  # If item wasn't used	  unless used		# Play buzzer SE		$game_system.se_play($data_system.buzzer_se)	  end	  return	end  endend

 

 

Window ItemS:

 

 

#=========================================================================== class Window_ItemS < Window_Base #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize	super(0, 0, 480, 16)	@column_max = 3	refresh	  self.y = 74	  self.height = 340	  self.back_opacity = 255	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 = []	for i in 1...$data_items.size	  if $game_party.item_number(i) > 0		@data.push($data_items[i])	  end	end	@item_max = @data.size	if @item_max > 0	  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)  end

 

 

 

 

Il problema me lo da quando deve visualizzare l'icona dell'oggetto nello scene menu.

Non fare caso hai commenti perchè ho editato quelli standard

Edited by Squall_Leonheart

Iscriviti sul mio canale youtube -

https://www.youtube.com/channel/UCYOxXExvlXiOFfYD1fTFpww?view_as=subscriber

Seguimi su Instagram -

https://www.instagram.com/ancestralguitarist/

---------------------------------------------------------------------------------------------------------------------------------------
Contest vinti
---------------------------------------------------------------------------------------------------------------------------------------

FACE CONTEST # 3
BANNER CONTEST #69

Link to comment
Share on other sites

  • 0
Ascolta lo faccio io poi vedi le differenze, perchè così non riesco a capire l'errore.

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

C'è un'incongruenza tra il codice che hai postato nel primo post ed il terzo script (Window_ItemS) del tuo ultimo post . . .

 

Nel primo post, i contents vengono creati prima di disegnare la lista degli oggetti (riga 14), mentre in quello script, quella stessa istruzione, che dovrebbe stare sulla riga 37, non c'è . . .

 

In ogni caso, tutti e tre gli script sono stracolmi di errori e bug. Difficilmente riuscirai a farlo funzionare come si deve, anche correggendo questo errore . . .

 


SCRIPT RGSS (RPG Maker XP) VINTAGE LIBRARY [2018+]


Breaking (in ogni senso) News: "Treno deraglia per via del seno di Sakurai Aoi . . ." - Info nello spoiler !!

 


http://afantasymachine.altervista.org/_altervista_ht/NOOOOOOOOOilMIOtreninooooo_500.gif


Non riesco a smettere di essere affascinato da immagini come questa . . .

http://anime.vl-vostok.ru/art/photos2011/17/78049800/wall_VladAnime_WWA_1885-1680x1050.jpg


Alcuni wallpapers che faccio ruotare sul mio vecchio PC . . .


http://afantasymachine.altervista.org/_altervista_ht/gits_window.jpg

http://afantasymachine.altervista.org/_altervista_ht/madoka_group01.jpg
http://afantasymachine.altervista.org/_altervista_ht/arisu_picipici_01.jpg
http://afantasymachine.altervista.org/_altervista_ht/phantom_wp01_einzwei.jpg


La parte più spassosa della mia vita è quando gli altri cercano di spiegarmi i miei pensieri . . .


BBCode Testing


Typeface & Size



Link to comment
Share on other sites

  • 0
Allora aspetto Mastersion

Iscriviti sul mio canale youtube -

https://www.youtube.com/channel/UCYOxXExvlXiOFfYD1fTFpww?view_as=subscriber

Seguimi su Instagram -

https://www.instagram.com/ancestralguitarist/

---------------------------------------------------------------------------------------------------------------------------------------
Contest vinti
---------------------------------------------------------------------------------------------------------------------------------------

FACE CONTEST # 3
BANNER CONTEST #69

Link to comment
Share on other sites

  • 0

http://www.mediafire.com/download.php?mm3ddjmmilt

Prego scarica ho aggiunto anche la window_help al menù.

Poi ho tolto la window_steps... Mentre la window Gold e time sono diventate un unica finestra.

An dimenticavo, c'è la window_menustatus invisible.

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

Ti ringrazio,ma manca che la window item sia visibile anche quando non è interagibile :/

 

Edit: Risolto,bastava mettere true alla prima window Grazie^^

Edited by Squall_Leonheart

Iscriviti sul mio canale youtube -

https://www.youtube.com/channel/UCYOxXExvlXiOFfYD1fTFpww?view_as=subscriber

Seguimi su Instagram -

https://www.instagram.com/ancestralguitarist/

---------------------------------------------------------------------------------------------------------------------------------------
Contest vinti
---------------------------------------------------------------------------------------------------------------------------------------

FACE CONTEST # 3
BANNER CONTEST #69

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