Jump to content
Rpg²S Forum

*Personaggi animati nei menu


mikb89
 Share

Recommended Posts

Personaggi animati nel menu

Descrizione

Questo script permette di fare in modo che i charaset 'camminino' nei menu invece di stare fermi com'è di predefinito

 

Autore

mikb89

 

Istruzioni per l'uso

Create uno script sopra Main e inseritegli què

 

 

class Window_Base < Window
 
 def draw_actor_graphic(actor, x, y, im = 0, am = 0, draw = false)
if draw == true
  bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  cw = bitmap.width / 4
  ch = bitmap.height / 4
  src_rect = Rect.new(cw * im, ch * am, cw, ch)
  self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
 end
 
end

class Window_MenuStatus < Window_Selectable
 
 alias animated_initialize initialize
 alias animated_refresh refresh
 
 def initialize
@im = 0
@am = 0
@om = 0
animated_initialize
 end
 
 def refresh
animated_refresh
@sec = Graphics.frame_count / (Graphics.frame_rate/4)
for i in 0...$game_party.actors.size
  x = 64
  y = i * 116
  actor = $game_party.actors[i]
  draw_actor_graphic(actor, x - 40, y + 80, @im, @am, true)
end
 end
 
 def update
super
if Graphics.frame_count / (Graphics.frame_rate/4) != @sec
  @im +=1
  if @im == 4
	@im = 0
	@om += 1
	if @om == 3
	  @om = 0
	  @am += 1
	  if @am == 4
		@am = 0
	  end
	end
  end
  refresh
end
 end
 
end

class Window_Status < Window_Base
 
 alias animated_initialize initialize
 alias animated_refresh refresh
 
 def initialize(actor)
@im = 0
@am = 0
@om = 0
animated_initialize(actor)
 end
 
 def refresh
animated_refresh
@sec = Graphics.frame_count / (Graphics.frame_rate/4)
draw_actor_graphic(@actor, 40, 112, @im, @am, true)
 end
 
 def update
super
if Graphics.frame_count / (Graphics.frame_rate/4) != @sec
  @im +=1
  if @im == 4
	@im = 0
	@om += 1
	if @om == 3
	  @om = 0
	  @am += 1
	  if @am == 4
		@am = 0
	  end
	end
  end
  refresh
end
 end
 
end

class Window_SaveFile < Window_Base
 
 alias animated_initialize initialize
 
 def initialize(file_index, filename)
@im = 0
@am = 0
@om = 0
animated_initialize(file_index, filename)
 end
 
 def refresh
self.contents.clear
@sec = Graphics.frame_count / (Graphics.frame_rate/4)
self.contents.font.color = normal_color
name = "File #{@file_index + 1}"
self.contents.draw_text(4, 0, 600, 32, name)
@name_width = contents.text_size(name).width
if @file_exist
  for i in 0...@characters.size
	bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
	cw = bitmap.rect.width / 4
	ch = bitmap.rect.height / 4
	src_rect = Rect.new(cw * @im, ch * @am, cw, ch)
	x = 300 - @characters.size * 32 + i * 64 - cw / 2
	self.contents.blt(x, 68 - ch, bitmap, src_rect)
  end
  hour = @total_sec / 60 / 60
  min = @total_sec / 60 % 60
  sec = @total_sec % 60
  time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  self.contents.font.color = normal_color
  self.contents.draw_text(4, 8, 600, 32, time_string, 2)
  self.contents.font.color = normal_color
  time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  self.contents.draw_text(4, 40, 600, 32, time_string, 2)
end
 end
 
 def update
super
if Graphics.frame_count / (Graphics.frame_rate/4) != @sec
  @im +=1
  if @im == 4
	@im = 0
	@om += 1
	if @om == 3
	  @om = 0
	  @am += 1
	  if @am == 4
		@am = 0
	  end
	end
  end
  refresh
end
 end
 
end

class Window_NameEdit < Window_Base
 
 alias animated_initialize initialize
 alias animated_refresh refresh
 
 def initialize(actor, max_char)
@im = 0
@am = 0
@om = 0
animated_initialize(actor, max_char)
 end
 
 def refresh
animated_refresh
@sec = Graphics.frame_count / (Graphics.frame_rate/4)
draw_actor_graphic(@actor, 320 - @max_char * 14 - 40, 80, @im, @am, true)
 end
 
 def update
super
if Graphics.frame_count / (Graphics.frame_rate/4) != @sec
  @im +=1
  if @im == 4
	@im = 0
	@om += 1
	if @om == 3
	  @om = 0
	  @am += 1
	  if @am == 4
		@am = 0
	  end
	end
  end
  refresh
end
 end
 
end

class Scene_Status

 alias animated_update update
 
 def update
animated_update
@status_window.update
 end
 
end

 

 

Edited by mikb89

Script!

 

Roba scritta, guide:

 

Applicazioni:

 

Progetti!

http://img69.imageshack.us/img69/2143/userbarctaf.png http://img641.imageshack.us/img641/5227/userbartemplateb.pnghttp://i46.tinypic.com/ac6id0.png

Link to comment
Share on other sites

Si, basta sostituire

src_rect = Rect.new(cw * im, ch * am, cw, ch)

con

src_rect = Rect.new(cw * im, 0, cw, ch)

 

e più avanti

src_rect = Rect.new(cw * @im, ch * @am, cw, ch)

con

src_rect = Rect.new(cw * @im, 0, cw, ch)

 

non l'ho provato, ma dovrebbe funzionare

Script!

 

Roba scritta, guide:

 

Applicazioni:

 

Progetti!

http://img69.imageshack.us/img69/2143/userbarctaf.png http://img641.imageshack.us/img641/5227/userbartemplateb.pnghttp://i46.tinypic.com/ac6id0.png

Link to comment
Share on other sites

  • 1 year later...
Non si potrebbe inserire nel menù principale :ahsi: :sisi: ?

Lo fa già . . .

Inserisce la versione animata del chara di ogni PG nelle seguenti finestre (Scene in cui si trova la finestra):

- Window_MenuStatus (Scene_Menu)

- Window_Status (Scene_Status)

- Window_SaveFile (Scene_Load e Scene_Save)

- Window_NameEdit (Scene_Name)

 


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

  • 1 month later...
Lo fa già . . .

Inserisce la versione animata del chara di ogni PG nelle seguenti finestre (Scene in cui si trova la finestra):

- Window_MenuStatus (Scene_Menu)

- Window_Status (Scene_Status)

- Window_SaveFile (Scene_Load e Scene_Save)

- Window_NameEdit (Scene_Name)

Io intendevo quando avvii il gioco

http://img14.imageshack.us/img14/9595/obbiettivogiocaconnoi.png
Link to comment
Share on other sites

Io intendevo quando avvii il gioco

Allora, in attesa che mikb89 possa realizzare la modifica che desideri, puoi provare ad usare questo add-on che ho creato, ovviamente da inserire SOTTO lo script di mikb89, che permette di sfruttare chara animati (solo degli actor nel database, però, anche se non sarebbe difficile modificarlo per usare qualunque chara) nello Scene_Title, in posizioni fisse dello schermo.

 

L'Add-on (Istruzioni ed avvertenze all'interno del codice)

 

 

# giver Scene_Title add-on - INIZIO - =============================================##	 giver's Animated Chara in Title (2009-05-03)##	 E' un add-on per lo script Personaggi Animati nel Menù by mikb89 @ rpg2s.net (it)#	   e non può funzionare senza di esso. Lo trovate a:#	   [url="http://www.rpg2s.net/forum/index.php?showtopic=3462"]http://www.rpg2s.net/forum/index.php?showtopic=3462[/url]##==========================================================================##   NOTE IMPORTANTI:##	 - Non esistendo un party finchè non si sceglie NUOVA PARTITA, lo script si appoggia#	   all'elenco degli actors nel DataBase per funzionare, volendo mantenere coerenza#	   con lo script originale esteso da questo Add-on#	   Quindi, qualunque chara si voglia usare per le animazioni del title, bisognerà#	   creare un actor che non parteciperà al gioco, dotato del chara che include#	   quella animazione, e non c'è bisogno di di inserire due actor dotati dello stesso#	   chara per animazioni che sfruttano due righe diverse di uno stesso chara . . .##	 - Al momento si può scegliere solo se usare una riga singola del chara oppure#	   l'intero chara, e non è possibile specificare la velocità a cui si alternano i#	   fotogrammi, che risulta uguale per tutte come lo script a cui si appoggia l'add-on##	 - Eventuale LAG è generabile inserendo TANTE animazioni, piuttosto che dall'uso di#	   chara molto grandi (anche se questi consumano più memoria)##	 - Purtroppo, pur richiedendo solo due istruzioni aggiuntive nel (def) main della#	   Scene_Title, non ho potuto usare alias per aggiungerle, quindi ho dovuto reinserire#	   l'intero metodo in questo add-on.#	   Se il vostro Scene_Title è diverso da quello di default, dovrete inserire tale#	   coppia di istruzioni nella vostra versione di Scene_Title e cancellare la parte#	   di questo add-on che riguarda il def main della Scene##	 - Le istruzioni per "configurare" le animazioni da eseguire nel Title sono all'interno#	   della classe che le gestisce##	 - Per scripter con un minimo di esperienza ed intraprendenza non dovrebbe risultare#	   difficile rendere l'add-on generico in modo da sfruttarne le funzioni in altre#	   Scene simili al Title (End, Gameover, ecc.)##==========================================================================  class Window_TitleAnimChara < Window_Base   def initialize	super(0, 0, 640, 480)	self.z = 100	self.opacity = 0	@im = 0	@am = 0	@om = 0	@characters = []#=== DEFINIZIONE ANIMAZIONI - Inizio =============================================# Per aggiungere chara da usare, inserire la seguente istruzione#	@characters.push([id_actor_database, coord_x, coord_y, riga_da_usare])# dove:#	id_actor_database è la posizione dell'actor di cui si userà il chara#						per ottenere l'animazione#	coord_x		   è la posizione x (del centro orizzontale) dei fotogrammi#						sullo schermo#	coord_y		   è la posizione y (della base) dei fotogrammi sullo schermo#	riga_da_usare	 è da specificare se si vuole usare solo una riga del chara#						invece di tutti e sedici i fotogrammi che lo compongono.#						Va da 0 (prima riga) a 3 (quarta riga), oppure nil se si#						desidera sfruttare l'intero chara (invece di inserire nil#						si ottiene lo stesso effetto senza inserire questo quarto#						parametro)# Non esiste un limite "vero" al numero di animazioni sfruttabili, se non per il#   rischio di un calo di performance/lag nel Title#---------------------------------------------------------------------------------	# Usa solo la prima riga del chara associato all'actor 1, in posizione 264, 240	@characters.push([1, 264, 240, 0])	# Usa solo la prima riga del chara associato all'actor 4, in posizione 344, 240	@characters.push([4, 344, 240, 0])	# Usa solo la seconda riga del chara associato all'actor 6, in posizione 80, 420	@characters.push([6, 80, 420, 1])	# Usa solo la terza riga (nuovamente) del chara associato all'actor 6, in posizione 528, 420	@characters.push([6, 528, 420, 2])	# Usa l'intero chara associato all'actor 7, in posizione 120, 196	@characters.push([7, 120, 196])#=== DEFINIZIONE ANIMAZIONI - Fine   =============================================	self.contents = Bitmap.new(width - 32, height - 32)	refresh  end   def refresh	self.contents.clear	@sec = Graphics.frame_count / (Graphics.frame_rate/4)	for chara in @characters	  actor = $data_actors[chara[0]]	  chara_am = chara[3] == nil ? @am : chara[3]	  draw_actor_graphic(actor, chara[1], chara[2], @im, chara_am, true)	end  end   def update	super	if Graphics.frame_count / (Graphics.frame_rate/4) != @sec	  @im +=1	  if @im == 4		@im = 0		@om += 1		if @om == 3		  @om = 0		  @am += 1		  if @am == 4			@am = 0		  end		end	  end	  refresh	end  end end class Scene_Title   alias animated_update update   def main	# If battle test	if $BTEST	  battle_test	  return	end	# Load database	$data_actors		= load_data("Data/Actors.rxdata")	$data_classes	   = load_data("Data/Classes.rxdata")	$data_skills		= load_data("Data/Skills.rxdata")	$data_items		 = load_data("Data/Items.rxdata")	$data_weapons	   = load_data("Data/Weapons.rxdata")	$data_armors		= load_data("Data/Armors.rxdata")	$data_enemies	   = load_data("Data/Enemies.rxdata")	$data_troops		= load_data("Data/Troops.rxdata")	$data_states		= load_data("Data/States.rxdata")	$data_animations	= load_data("Data/Animations.rxdata")	$data_tilesets	  = load_data("Data/Tilesets.rxdata")	$data_common_events = load_data("Data/CommonEvents.rxdata")	$data_system		= load_data("Data/System.rxdata")	# Make system object	$game_system = Game_System.new	# Make title graphic	@sprite = Sprite.new	@sprite.bitmap = RPG::Cache.title($data_system.title_name)#============================================================================# Copiare l'istruzione sottostante nel main del proprio Scene_Title se non è# quello di default	@anim_window = Window_TitleAnimChara.new#============================================================================	# Make command window	s1 = "New Game"	s2 = "Continue"	s3 = "Shutdown"	@command_window = Window_Command.new(192, [s1, s2, s3])	@command_window.back_opacity = 160	@command_window.x = 320 - @command_window.width / 2	@command_window.y = 288	# Continue enabled determinant	# Check if at least one save file exists	# If enabled, make @continue_enabled true; if disabled, make it false	@continue_enabled = false	for i in 0..3	  if FileTest.exist?("Save#{i+1}.rxdata")		@continue_enabled = true	  end	end	# If continue is enabled, move cursor to "Continue"	# If disabled, display "Continue" text in gray	if @continue_enabled	  @command_window.index = 1	else	  @command_window.disable_item(1)	end	# Play title BGM	$game_system.bgm_play($data_system.title_bgm)	# Stop playing ME and BGS	Audio.me_stop	Audio.bgs_stop	# 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 command window	@command_window.dispose#============================================================================# Copiare l'istruzione sottostante nel main del proprio Scene_Title se non è# quello di default	@anim_window.dispose#============================================================================	# Dispose of title graphic	@sprite.bitmap.dispose	@sprite.dispose  end   def update	animated_update	@anim_window.update  end end# giver Scene_Title add-on -  FINE  - =============================================

 

 

 

ed una Demo (sarebbe più appropriato definirlo obbrobrio)

Scarica Demo Title con Chara Animati by giver + mikb89 @ Megauload

Edited by giver

 


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

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