Jump to content
Rpg²S Forum
  • 0

Problemi per lo script della mappa


Thund
 Share

Question

Ciao a tutti!

Dunque ho due problemi, il primo penso sia semplice, il secondo di meno.

 

1 - In primo luogo c'è un comando in RGSS che mi permette di cambiare windowskin oppure di non mostrarla (HIDE?) Perchè quando mi fa visualizzare la mappa sopra appare, dove c'è il nome della mappa, una finestra di messaggio e si vede la windowskin! Ovviamente devo mettere un comando all'inizio per mostrarmi un system e uno alla fine per mostrarmene un'altro oppure mettere un comando all'inizio per nascondermi il system e uno alla fine per rimostrarmelo.. @.@

 

2 - Veniamo al problema più complicato.. in pratica ho lo script per mostrare la mappa, bene, me la mostra perfettamente solo che non se ne va via l'immagine! Si accorge di sta cosa solo quando uso l'opzione "Ritorna ai Titoli" nel caso uno volesse ricaricare la partita che se ne va il menu e si vede la mappa dietro come sfondo! E' fastidiosa come cosa, in pratica e come se mi mostrasse l'immagine dietro a tutto ma non me la fa cancellare! Io ora, non sono un genio nel ruby, ma sto cercando di impararlo ma per questa cosa non riesco a risolverla..

 

Vi posto lo script di Daniel_Maximus2 se magari qualcuno vuole fare entrambe le aggiunte (o la seconda direttamente lì)

 

 

#===============================================================================



#-------------------------------------------------------------------------------
# - Map Item Script
#-------------------------------------------------------------------------------
#===============================================================================



#
# - Shows a map and compass in the screen
# - Made by - Daniel_Maximus2
#	   Cardinalis Corp ®
# - Script free for personal use since included the name and the team
# of the creator
# - Compatibility with many Scripts. See instructions for more information
#
# - Put the pictures in the folder Graphics/Pictures/Mapa (create the folder Mapa)
# - A map of 640x380
# - A compass of 60x60 (different sizes changes lines 81 and 82)
# - A picture of 640x3 (linha y)
# - A picture of 3x380 (linha x)
# - Created in 12-14-06
#
# classes: Window_Mapa
#		  Window_Text
#		  Scene_Mapa
#
#-------------------------------------------------------------------------------
#===============================================================================




COMPASS = 33				#id of Compass
MAP = 27					#id of Map
VAR_MAP_X = 2			  #$game_variable[id] that stores X cordinate
VAR_MAP_Y= 3			   #$game_variable[id] that stores Y cordinate

#  If you do not define a cordinate for center of the world, delete lines 142
#  to 172 and activate lines 173 e 174.

#===============================================================================



#-------------------------------------------------------------------------------
# - Window_Mapa
#-------------------------------------------------------------------------------
#===============================================================================




class Window_Mapa < Window_Base
 def initialize
super(0, 65, 640, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.opacity = 0
refresh	
 end
 def refresh
#  variables that stores cordinates (Events/Paralell Process)
@wx = $game_variables[VAR_MAP_X]
@wy = $game_variables[VAR_MAP_Y]
@f_linex = @wx #cord x
@f_liney = @wy #cord y

#  Draw the map ========================================================
@map = Sprite.new
@map.bitmap = RPG::Cache.picture("Mapa/worldmap.jpg")#Name of map file
@map.x = 0
@map.y = 0
#  Draw the map ========================================================

#  Draw the compass, if have  ========================================
if $game_party.item_number(COMPASS) > 0
  @i_linex = Sprite.new
  @i_linex.bitmap = RPG::Cache.picture("Mapa/compasso_x.png")#Name of line x file
  @i_linex.x = @map.x
  @i_linex.y = @map.y
  
  @i_liney = Sprite.new
  @i_liney.bitmap = RPG::Cache.picture("Mapa/compasso_y.png")#Name of line y file
  @i_liney.x = @map.x
  @i_liney.y = @map.y
  
  @compass = Sprite.new
  @compass.bitmap = RPG::Cache.picture("Mapa/compasso.png")#Name of compass file
  @cwid = 30 #half of compass width
  @chei = 30 #half of compass height
  @compass.x = @map.x - @cwid
  @compass.y = @map.y - @chei
end
 end
 #  Fim  ======================================================================
 def move_compass
correctx = @f_linex - @i_linex.x
correcty = @f_liney - @i_liney.y
correctcompx = @wx - @cwid - @compass.x
correctcompy = @wy - @chei - @compass.y
#====================
if @i_linex.x < (@f_linex - 10)
  @i_linex.x += 10
end
if @i_linex.x >= (@f_linex - 10)
  @i_linex.x += correctx
end
#====================
if @i_liney.y < (@f_liney - 10)
  @i_liney.y += 10
end
if @i_liney.y >= (@f_liney - 10)
  @i_liney.y += correcty
end
#====================
if @compass.x < (@wx - 10 - @cwid)
  @compass.x += 10
end
if @compass.x >= (@wx - 10 - @cwid)
  @compass.x += correctcompx
end
#====================  
if @compass.y < (@wy - 10 - @chei)
  @compass.y += 10
end
if @compass.y >= (@wy - 10 - @chei)
  @compass.y += correctcompy
end
#====================  
 end
end
 
#===============================================================================



#-------------------------------------------------------------------------------
# - Mapa_Text - Write the location
#-------------------------------------------------------------------------------
#===============================================================================



class Game_Map

 def name
$map_infos[@map_id]
 end
end
class Scene_Title
 $map_infos = load_data("Data/MapInfos.rxdata")
 for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
 end
end

class Mapa_Text < Window_Base
 def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 200#
refresh
 end
 def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = $fontsize
if $game_party.item_number(COMPASS) > 0
  text = "Posizione attuale: #{$game_map.name}" #{centerdist} km de (Name of world center place or city)." Put the name of center place
else
  text = "Posizione attuale: #{$game_map.name}"
end
self.contents.draw_text(4, 0, self.width - 40, 32, text)
# delete till here and activate below (delete "#")
# text = "Your location: #{$game_map.name}."
# self.contents.draw_text(4, 0, self.width - 40, 32, text)
 end
end

#===============================================================================



#-------------------------------------------------------------------------------
# - Scene_Mapa
#-------------------------------------------------------------------------------
#===============================================================================




class Scene_Mapa
 def main
@help_window = Mapa_Text.new
@mapa_window = Window_Mapa.new
Graphics.transition
loop do
  Graphics.update
  Input.update
  update
  if $game_party.item_number(COMPASS) > 0
	@mapa_window.move_compass
  end
  if $scene != self
	break
  end
end
Graphics.freeze
@help_window.dispose
@mapa_window.dispose
 end
 
#-------------------------------------------------------------------------------
# - Update
#-------------------------------------------------------------------------------
 
 def update
if Input.trigger?(Input::B)
  $game_system.se_play($data_system.cancel_se)
  $scene = Scene_Menu.new(0)
  @map = Sprite.new
  @map.bitmap = RPG::Cache.picture("Mapa/worldmapvuota.png")#Name of map file
  @map.x = 0
  @map.y = 0
  return
end
 end
end

 

 

Edited by Thund

ico_youtube.png ThundPlayer - Canale Dedicato a RPG Maker

bannerssmini2.png?w=100 bannerq.png?w=100 banner1mini.png

banneryourchoice2mini.png bannerrhmini.png banner2bmini.png

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

1: nomefinestra.opacity=255

2: nomeimmagine.dispose alla fine di tutto

Vieni a visitare Multi Saga, la community dove puoi mostrarci le tua creazioni di ogni genere

link

Partecipante al Rpg2s.net Game Contest 2007/2008

http://www.rpg2s.net/contest/GameContest0708/userbar_r2sgc.gif

Gioco in Sviluppo: Progetto segreto(by Maske Software)

 

Ecco la dimostrazione del secolo!!!!!!!(by Axel Lucius Kantaros)

Le abbreviazioni sono da truzzi.

La grammatica è da fighi.

La grammatica è utilizzata correttamente da chi non è truzzo.

Quindi i truzzi non sono fighi.

Link to comment
Share on other sites

  • 0

Giusto quello che ha detto Ghalok, nel caso ti servisse counqe cambiare window skin via script basta scrivere nella parte di codice che ti interessa:

$game_system.windowskin_name = "Nomedellaskin.png"

Ovvio che la skin deve essere presente nella cartella Graphics/Windowskins.

 

Ah, per la 1 puoi mettere sia un:

nomeimmagine.opacity = 0 # Immagine invisibile
nomeimmagine.opacity = 255 # Immagine visibile

che ti permette di scrivere precisamente quanta opacità voi dare alla finestra (puoi mettere tutti i numeri tra 0~255 per dare meno~più opacità), oppure se devi solo settare una finestra visibile o no utilizzare:

nomeimmagine.visible = false # Immagine invisibile
nomeimmagine.visible = true # Immagine visibile

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