Jump to content
Rpg²S Forum
  • 0

Il mio script non da il valore alle variabili.


Morshudiego
 Share

Question

Stavo costruendo uno script che in base al valore di una variabile (@id_eroe) si acquisiscono i vari parametri della persona nella variabile in altre variabili, solo che mi considera tutte le variabili "nil".

 

lo script è questo:

#By Morshudiego, VX Scripter (www.rpg2s.net)#Vari script uniti assieme per creare la battaglia. class Battaglia_Custom  #variabilidi raccolta informazioni eroe.  attr_accessor :id_eroe, :nome, :hp, :maxhp, :mp, :maxmp, :att, :dif, :spi, 				:agi, :arma, :scudo, :armatura, :elmo, :accessorio, :livello,				:esp   def initialize	inializza_variabili_eroe  end   def update	update_variabili_eroe  end   def inializza_variabili_eroe	@id_eroe = 0	@nome = 0	@hp = 0	@maxhp = 0	@mp = 0	@maxmp = 0	@att = 0	@dif = 0	@spi = 0	@agi = 0	@arma = 0	@scudo = 0	@armatura = 0	@elmo = 0	@accessorio = 0	@livello = 0	@esp = 0  end   def update_variabili_eroe	return if @id_eroe == 0	@nome = $game_actors[@id_eroe].name	@hp = $game_actors[@id_eroe].hp	@maxhp = $game_actors[@id_eroe].maxhp	@mp = $game_actors[@id_eroe].mp	@maxmp = $game_actors[@id_eroe].maxmp	@att = $game_actors[@id_eroe].atk	@dif = $game_actors[@id_eroe].def	@spi = $game_actors[@id_eroe].spi	@agi = $game_actors[@id_eroe].agi	@arma = $game_actors[@id_eroe].weapon_id	@scudo = $game_actors[@id_eroe].armor1_id	@armatura = $game_actors[@id_eroe].armor3_id	@elmo = $game_actors[@id_eroe].armor2_id	@accessorio = $game_actors[@id_eroe].armor4_id	@livello = $game_actors[@id_eroe].level	@esp = $game_actors[@id_eroe].exp  endend class Scene_Map < Scene_Base  def update	super	$game_map.interpreter.update	  # Update interpreter	$game_map.update				  # Update map	$game_player.update			   # Update player	$game_system.update			   # Update timer	@spriteset.update				 # Update sprite set	@message_window.update			# Update message window	unless $game_message.visible	  # Unless displaying a message	  update_transfer_player	  update_encounter	  update_call_menu	  update_call_debug	  update_scene_change	end	#mettere gli update della mappa qui.	$battaglia.update  endend

 

Questo invece è il comando che uso per chiamare lo script, cambiare id della variabile e mostrarmi 4 variabili.

$battaglia = Battaglia_Custom.new@id_eroe = 1$battaglia.updatep @id_eroep @nomep @hpp @armap @att

 

non so cosa c'è di sbagliato, spero che mi possiate aiutare :|

Edited by Morshudiego

Succodipera: Il blog di Morshudiego su RPG Maker (Leggetelo, lì ci sono più aggiornamenti che sulla firma!)

<AGGIORNAMENTI> (Ultima modifica: Oct 30 2014)
Myth of First Star - Facendo il punto della situazione
Project Sudoku - Il multitasking non è il mio forte. XD (Spero comunque di risolvere il bug per rilasciare la 0.3 :P)
Tutorial Menu Eventi - Uscita parte 2 (però è malformattata, non so se riuscirò ad editare tutto in un giorno. Abbiate pasiensa :P)

<PROGETTI>
Myth of First Star - Project Sudoku (*trollface*)

<SCRIPTS>
Zelda Map Scrolling - Switch Post Caricamento - Messaggi Istantanei - Picture Manager - Minimalist Menu

<TUTORIAL>
Uso corretto acqua RTP - Creare un menu ad eventi

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Molto probabilemte vengono richiamati prima che Game_Actors diventi diverso da nil.

Oltre che hai messo la vairabile $battaglia senza definirla

Edited by kingartur2

Per qualsiasi motivo non aprite questo spoiler.

 

 

Ho detto di non aprirlo !

 

 

Se lo apri ancora esplode il mondo.

 

 

Aaaaaa è un vizio.

 

 

Contento? Il mondo è esploso, sono tutti morti

per colpa della tua curiosità .

 

 

Vuoi che ti venga anche il morbillo, la varicella e l'AIDS???

 

 

O bravo ora sei un malato terminale e nessuno

ti puo curare, sono tutti morti !

 

 

Se clicchi ancora una volta il PC esplode.

 

 

E dai smettila !!

 

Uff!! Hai cliccato tante volte che ho dovuto sostituirlo con un codebox.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

http://s8.postimg.org/yntv9nxld/Banner.png

http://img204.imageshack.us/img204/8039/sccontest3octpl3.gif

Link to comment
Share on other sites

  • 0
Molto probabilemte vengono richiamati prima che Game_Actors diventi diverso da nil.

Oltre che hai messo la vairabile $battaglia senza definirla

no purtroppo. Mi vergogno di aver fatto una domanda inutile senza ragionare XP.

Ho sbagliato e ho messo al posto del simbolo globale "$" un'altro simbolo "@"

Ora funziona tutto XP scusate per il disturbo.

 

$battaglia è una variabile come $scene e funzionava anche con altri script di mia invenzione.

 

ancora scusate XP.

 

OFF TOPIC EDIT: tu sei quello che sta facendo il tutorial in RGSS sulla battaglia in tempo reale? ti dico che mi hai ispirato te a fare la battaglia custom 8Q_

Edited by Morshudiego

Succodipera: Il blog di Morshudiego su RPG Maker (Leggetelo, lì ci sono più aggiornamenti che sulla firma!)

<AGGIORNAMENTI> (Ultima modifica: Oct 30 2014)
Myth of First Star - Facendo il punto della situazione
Project Sudoku - Il multitasking non è il mio forte. XD (Spero comunque di risolvere il bug per rilasciare la 0.3 :P)
Tutorial Menu Eventi - Uscita parte 2 (però è malformattata, non so se riuscirò ad editare tutto in un giorno. Abbiate pasiensa :P)

<PROGETTI>
Myth of First Star - Project Sudoku (*trollface*)

<SCRIPTS>
Zelda Map Scrolling - Switch Post Caricamento - Messaggi Istantanei - Picture Manager - Minimalist Menu

<TUTORIAL>
Uso corretto acqua RTP - Creare un menu ad eventi

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