Jump to content
Rpg²S Forum

-Map Item


Luigi
 Share

Recommended Posts

Autore: Daniel_Maximus2

 

Descrizione: permete di inserire una mappa nel gioco

 

Demo: LINK

 

Hai bisogno delle seguenti immagini:

 

* Una mappa di 640x380

* Una bussola di 60x60

* Una riga di 640x3 (linea y)

* Una riga di 3x380 (linea x)

Le immaggini devono stare nella cartella Pictures/Mapa

 

Istruzioni:

Copia questo script sopra main

 

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


#-------------------------------------------------------------------------------
# - 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 = 24				#id of Compass
MAP = 23					#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
WORLDCENTERX = 240		  #World center X (Optional)
WORLDCENTERY = 300		  #World center Y (Optional)
#  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 = 65
#  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
# delete below if you don´t use a WORLDCENTER
actualx = $game_variables[VAR_MAP_X]  #character x pos
actualy = $game_variables[VAR_MAP_Y]  #character y pos
centerx = WORLDCENTERX				#world center x pos
centery = WORLDCENTERY				#world center y pos
x = (actualx - centerx) * 2
y = (actualy - centery) * 2
centerdist = Math.sqrt(x ** 2 + y ** 2)
if x < 0
  dir_x = "West"
else x > 0
  dir_x = "East"
end
if y < 0
  dir_y = "North"
else y > 0
  dir_y = "South"
end
if x == 0
  dir_x = "Center"
end
if y == 0
  dir_y = "Center"
end
if $game_party.item_number(COMPASS) > 0
  text = "Your location: #{$game_map.name}: #{y} Km #{dir_y}, #{x} Km #{dir_x}." #{centerdist} km de (Name of world center place or city)." Put the name of center place
else
  text = "Your location: #{$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)
  return
end
 end
end

 

ed ora in Scene_item in def update_item (scritto qua sotto)

if @item.common_event_id > 0
	 $game_temp.common_event_id = @item.common_event_id
	 $game_system.se_play(@item.menu_se)
	 if @item.consumable
	   $game_party.lose_item(@item.id, 1)
	   @item_window.draw_item(@item_window.index)
	 end
	 $scene = Scene_Map.new
	 return
   end

 

aggiungi questo:

 

#use map==========
   if @item.id == MAP
	 $game_system.se_play(@item.menu_se)
	 if @item.consumable
	   $game_party.lose_item(@item.id, 1)
	   @item_window.draw_item(@item_window.index)
	 end
	 $scene = Scene_Mapa.new
	 return
   end
   #use map==========

 

http://img01.picoodle.com/img/img01/6/12/24/f_mapa0i_305bm_5a7b14d2.jpg

 

http://img01.picoodle.com/img/img01/6/12/24/f_mapa1i_305bm_7b4b8d92.jpg

 

create the map item and the compass item and put the ID in the Script. These items do nothing, as the commands are in Scene_Item (They are not common event, like in rmk2).

* in each map of RMXP make a paralell process event that defines values for a variable x and a variable y (the ID of the variable must be put in the script, changing the constants VAR_MAP_X e VAR_MAP_Y).

* the constants WORLDCERTERX e WORLDCENTERY are the world center point. If you don´t want a center, the written location will be wrong...

* If you don´t know the cordinates of cities and places, open your map in paint and put the mouse pointer above the point of the place. right in the screen, will be shown the screen cordinate. Now go to the event and define these values in the variables you created and the compass will be moved to this cordinate.

 

Obs.: PLEASE! do not use the maps in the Screenshots in your games (If you want I can help to make a map picture, since I have free time...).

Qeste sono le istruzioni dell'autore.

Edited by Luigi
Link to comment
Share on other sites

Forse sarebbe utile avere i file grafici...

di modo tale da poterli modificare a piacimento...

 

Non aveva una demo questo script?

http://www.browsergamer.net/banner/190x60/browsergamer.jpg http://www.medioshopping.com/img/medioshopping_logo_mini.png

 

www.havana24.net

Premi vinti

 

 

http://www.rpg2s.net/gif/GC_bestof1.gif http://www.rpg2s.net/gif/GC_bestoftool1.gif

http://www.rpg2s.net/gif/GC_musica3.gif http://www.rpg2s.net/gif/GC_effettispeciali1.gif http://www.rpg2s.net/gif/GC_effettispeciali1.gif http://www.rpg2s.net/gif/GC_gameplay2.gif http://www.rpg2s.net/gif/GC_mapping1.gif http://www.rpg2s.net/gif/GC_programmazione1.gif http://www.rpg2s.net/gif/GC_programmazione1.gif http://www.rpg2s.net/gif/GC_trama1.gif http://www.rpg2s.net/gif/GC_grafica1.gif http://www.rpg2s.net/gif/GC_grafica1.gif http://www.rpg2s.net/gif/GC_premio3.gif http://www.rpg2s.net/gif/GC_premio3.gif http://www.rpg2s.net/gif/GC_premio1.gif http://www.rpg2s.net/gif/GC_premio1.gif http://www.rpg2s.net/gif/GC_premio1.gif http://www.rpg2s.net/gif/GC_premio1.gif

 

http://www.rpg2s.net/awards/bestgraphic1.jpg http://www.rpg2s.net/awards/bestmaker1.jpg

http://www.rpg2s.net/awards/bestmapper1.jpg http://www.rpg2s.net/awards/bestprogrammer3.jpg

http://rpg2s.net/gif/SCContest1Oct.gif http://i54.tinypic.com/15cikht.gif http://img42.imageshack.us/img42/3015/terzoposto.png

 

 

Link to comment
Share on other sites

Non aveva una demo e comunque leggi qui:
Obs.: PLEASE! do not use the maps in the Screenshots in your games (If you want I can help to make a map picture, since I have free time...).
Link to comment
Share on other sites

Già, davvero bello script, il problema è riuscire a fare la mappa XD

 

 

 

O_______________________________________________________O

(metà delle cose che fanno le faccio anch'io zizi)

(sto qua invece è un mostro....)

 

 

 

Link to comment
Share on other sites

  • 1 year later...
certo,usi la funzione Call script nella terza pagina del pannello eventi

Bisogno di creare un sito internet?Vai a visitare il White Rabbit ;D

Screen contest #23
http://rpg2s.net/gif/SCContest3Oct.gif


Partecipante al Rpg2s.net Game Contest 2008/2009
http://www.rpg2s.net/contest/GameContest0809/gc0809-bannerino.jpg
Gioco in Sviluppo: Restricted : Project 15

Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...
Non mi và il link potresti riupparlo magari non da rapidshare?

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 months later...
si concordo è utile riuppare

http://mypsn.eu.playstation.com/psn/profile/gianlu9767.png

 

Il mio progetto personale: (Sospeso)

 

http://img833.imageshack.us/img833/3821/progresso.png <-------Clicca sul banner per vedere il mio sito

Cercasi personale (anche alle prime armi) possibilmente grafico e storyboarder

 

 

Link to comment
Share on other sites

  • 5 weeks later...

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