Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Closed TopicStart new topic
> Super Simple Map Name Script
amaranth
post Dec 21 2008, 07:35 PM
Post #1


Level 6
Group Icon

Group: Member
Posts: 78
Type: Developer
RM Skill: Masterful




I'm moving all of my scripts from rmxp.org to this site. I like it here better.

Introduction

A simple script that shows you how to have the name of your map appear on screen while you walk around. I've seen other scripts that were created to perform this task, but I found that they were either incomplete or had too much clutter. I've also kept this script simple so that you can build off of it.

Features

Show the name of the current map on screen

Script
NOTE: ONLY ADD ITEMS IN BLUE TO YOUR SCRIPTS. YOU DO NOT NEED TO DELETE ANY EXISTING SCRIPTS.

Use the the following scripts to modify your existing classes. For a script that merges all of these things together, scroll down to Raziel's post.

Update the Game_Map class with these changes:

CODE
#=======================================================
# ■ Game_Map
#=======================================================

class Game_Map

  #-------------------------------------------------------------------
  # ● Properties
  #-------------------------------------------------------------------
  [COLOR=blue]attr_reader   :map_name[/COLOR]

  #-------------------------------------------------------------------
  # ● Set up game
  #-------------------------------------------------------------------
  def setup(map_id)

[COLOR=blue]    # Get the name of the map
    @map_id = map_id    
    @map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))
    @map_name = load_data("Data/MapInfos.rxdata")[$game_map.map_id].name[/COLOR]

  end


Create the following class, Window_MapName, and put it with your window classes. (Copy and paste it)

CODE
[COLOR=blue]#========================================================
# ■ Window_MapName
#========================================================

class Window_MapName < Window_Base
  #---------------------------------------------------------------------
  # ● Initializes the Map Name window
  #---------------------------------------------------------------------
  def initialize
    super(0, 0, 260, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  
  #----------------------------------------------------------------------
  # ● Draw the name of the map
  #----------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 220, 32, $game_map.map_name.to_s, 2)  
  end
  
  #---------------------------------------------------------------------
  # ● Update the name of the map
  #---------------------------------------------------------------------
  def update
    super
    refresh
  end  
  
end[/COLOR]


Update the Scene_Map class:

CODE
#=======================================================
# ■ Scene_Map
#=======================================================

  #---------------------------------------------------------------------
  # ● Set up the scene
  #---------------------------------------------------------------------
  def main

    @spriteset = Spriteset_Map.new
    @message_window = Window_Message.new
    
[COLOR=Blue]    # Add name of map to window
    @name_window = Window_MapName.new
    @name_window.opacity = 0
    @name_window.x = 390
    @name_window.y = 430[/COLOR]

    Graphics.transition

    Graphics.freeze

    @spriteset.dispose
    @message_window.dispose
[COLOR=blue]    @name_window.dispose[/COLOR]

  end


  #----------------------------------------------------------------------
  # ● Player Place Move
  #----------------------------------------------------------------------
  def transfer_player

    $game_temp.player_transferring = false

    # Map to teleport to
    if $game_map.map_id != $game_temp.player_new_map_id
      $game_map.setup($game_temp.player_new_map_id)
      [COLOR=blue]@name_window.update[/COLOR]
    end
  
  end

end



Instructions

1. In the Game_Map class, add this to the list of properties:
attr_reader :map_name

2. In the Game_Map class, within the setup method, add this line beneath the @map_id = map_id line:
@map_name = load_data("Data/MapInfos.rxdata")[$game_map.map_id].name

3. Copy the Window_MapName class (see code above) and create a new section for it in the Script Editor. It should appear in the section where you have all of your Window classes.

4. In the Scene_Map class, within the main method, add this beneath the @message_window = Window_Message.new line:
# Add name of map to window
@name_window = Window_MapName.new
@name_window.opacity = 0
@name_window.x = 390
@name_window.y = 430

5. In the Scene_Map class, within the main method, add this beneath the @message_window.dispose line:
@name_window.dispose

6. In the Scene_Map class, within the transfer_player method, add this within the if $game_map.map_id != $game_temp.player_new_map_id statement:
@name_window.update

This post has been edited by amaranth: Dec 21 2008, 07:38 PM


__________________________
Go to the top of the page
 
+Quote Post
   
killachaldo
post Nov 5 2009, 04:48 PM
Post #2



Group Icon

Group: Member
Posts: 4
Type: Writer
RM Skill: Intermediate




Nice Tutorial Thank's For Helping Out This Community
Go to the top of the page
 
+Quote Post
   
Rik evil of fina...
post Nov 11 2009, 01:53 AM
Post #3


Level 1
Group Icon

Group: Member
Posts: 12
Type: Event Designer
RM Skill: Beginner




sorry i dont want to make a disaster can you post an a demo please?
Go to the top of the page
 
+Quote Post
   
Taiine
post Nov 11 2009, 10:41 PM
Post #4


Level 17
Group Icon

Group: Revolutionary
Posts: 333
Type: Mapper
RM Skill: Advanced




Screenshots would also be nice.

also does this stay up at all times?


__________________________

an RMXP Game utilizing Blizz-ABS


Concept Projects: DASH! The Masters Game | Finny Adventures (temp title)
My first RMXP Script: Taiine's Solo Player Custom Menu System v0.6 (UPDATED 13th of Nov 10)

Go to the top of the page
 
+Quote Post
   
Mister America
post Nov 14 2009, 12:35 AM
Post #5


Level 7
Group Icon

Group: Banned
Posts: 100
Type: None
RM Skill: Undisclosed




-,-


__________________________
Banned for being a total loser and taking the time to write 126 spam posts!!

Regards and have a nice day

The Management
Go to the top of the page
 
+Quote Post
   
MentalSickness
post Nov 14 2009, 03:55 AM
Post #6


Level 2
Group Icon

Group: Member
Posts: 20
Type: Scripter
RM Skill: Beginner




For some reason it doesn't work for me..
It would be nice if you would put screenshots..
Go to the top of the page
 
+Quote Post
   
slimmmeiske2
post Dec 3 2011, 06:23 AM
Post #7


Level 2
Group Icon

Group: Member
Posts: 22
Type: Developer
RM Skill: Beginner




The @name_window.update should also be posted under (Scene_Map):
# Update map (run parallel process event)
$game_map.update

Otherwise the name's always a map too late.


__________________________
Projects I support:



Go to the top of the page
 
+Quote Post
   

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 24th May 2013 - 06:27 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker