The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Season In The Abyss on April 02, 2006, 04:44:53 PM

Title: Show Map Name (in map)
Post by: Season In The Abyss on April 02, 2006, 04:44:53 PM
Show Map Name 1.0

Description
A simple script to show the map's name in a small window when the player enter to the map.

Screenshots
i forgot them  :whoa:

Requirements
Standard Development Kit (SDK), tested with the version 1.4.

How use?
Paste the code in a new section above Main (in the script editor).
You can change some settings in the module called "Show_Map_Name".
To show it in certain map, only add in the Call Script command (before your Teleport command) this:$game_temp.show_mapname = true

F.A.Q.


Script
#==============================================================================
# ** Show Map Name
#------------------------------------------------------------------------------
# Slipknot
# 1.0
# 03.31.06
#==============================================================================

SDK.log('Show_Map_Name', 'Slipknot', '1.0', '03.31.06')

#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.enable('Show_Map_Name')
#--------------------------------------------------------------------------

$data_mapinfos = load_data('Data/MapInfos.rxdata')

module Show_Map_Name
 #--------------------------------------------------------------------------
 Show_Frames = 30
 Back_Opacity = 160
 Y = 32
 #--------------------------------------------------------------------------
end

#------------------------------------------------------------------------------
# Begin Game_Map Edit
#------------------------------------------------------------------------------
class Game_Map
 #--------------------------------------------------------------------------
 alias slipknot_showmapname_gamemap_setupmapid setup_map_id
 alias slipknot_showmapname_gamemap_update update
 #--------------------------------------------------------------------------
 def setup_map_id(map_id)
   slipknot_showmapname_gamemap_setupmapid(map_id)
   if $game_temp.show_mapname
     @window_mapname = Window_MapName.new(map_id)
     $game_temp.show_mapname = false
   end
 end
 #--------------------------------------------------------------------------
 def dispose_window_mapname
   unless @window_mapname.nil? or @window_mapname.disposed?
     @window_mapname.dispose
   end
 end
 #--------------------------------------------------------------------------
 def update
   slipknot_showmapname_gamemap_update
   unless @window_mapname.nil? or @window_mapname.disposed?
     @window_mapname.update
   end
 end
end
#------------------------------------------------------------------------------
# End Game_Map Edit
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Begin Scene_Map Edit
#------------------------------------------------------------------------------
class Scene_Map
 #--------------------------------------------------------------------------
 alias slipknot_showmapname_scenemap_maindispose main_dispose
 #--------------------------------------------------------------------------
 def main_dispose
   slipknot_showmapname_scenemap_maindispose
   $game_map.dispose_window_mapname
 end
end
#------------------------------------------------------------------------------
# End Scene_Map Edit
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Begin Game_Temp Edit
#------------------------------------------------------------------------------
class Game_Temp
 #--------------------------------------------------------------------------
 attr_accessor(:show_mapname)
 #--------------------------------------------------------------------------
 alias slipknot_showmapname_gametemp_init initialize
 #--------------------------------------------------------------------------
 def initialize
   slipknot_showmapname_gametemp_init
   @show_mapname = false
 end
end
#------------------------------------------------------------------------------
# End Game_Temp Edit
#------------------------------------------------------------------------------

class Window_MapName < Window_Base
 #--------------------------------------------------------------------------
 include(Show_Map_Name)
 #--------------------------------------------------------------------------
 def initialize(map_id)
   name = $data_mapinfos[map_id].name
   dumb = Bitmap.new(128, 32)
   width = dumb.text_size(name).width + 32
   dumb.dispose
   super(320 - width / 2, Y, width, 64)
   self.contents = Bitmap.new(width - 32, 32)
   self.contents.draw_text(0, 0, width - 32, 32, name, 1)
   self.opacity = 0
   self.back_opacity = Back_Opacity
   @phase = 1
   @otime = 4
   @time = Show_Frames
 end
 #--------------------------------------------------------------------------
 def opacity=(val)
   super(val)
   self.contents_opacity = val
 end
 #--------------------------------------------------------------------------
 def update
   if @otime > 0
     @otime -= 1
     return
   end
   if @phase == 1 and opacity < 255
     self.opacity += 32
     return
   elsif @phase == 1 and opacity == 255
     @phase = 2
     return
   end
   if @time > 0
     @time -= 1
   else
     if self.opacity == 0
       self.dispose
       return
     end
     self.opacity -= 48
   end
 end
end

#--------------------------------------------------------------------------
# End SDK Enabled Test
#--------------------------------------------------------------------------
end
#--------------------------------------------------------------------------
Title: Show Map Name (in map)
Post by: Dalton on April 02, 2006, 05:05:13 PM
That's nice and all but the SDK is a piece of crap that ruins half of the best scripts.  There are more non-SDK good scripts than SDK good scripts.

It's be nice if you can make a non-SDK version (like your message system that has SDK and non-SDK versions)
Title: Show Map Name (in map)
Post by: Neko on April 02, 2006, 05:18:36 PM
... (noobs) You take out the SDK parts yourself... making this...

#==============================================================================
# ** Show Map Name
#------------------------------------------------------------------------------
# Slipknot
# 1.0
# 03.31.06
#==============================================================================




#--------------------------------------------------------------------------

$data_mapinfos = load_data('Data/MapInfos.rxdata')

module Show_Map_Name
 #--------------------------------------------------------------------------
 Show_Frames = 30
 Back_Opacity = 160
 Y = 32
 #--------------------------------------------------------------------------
end

#------------------------------------------------------------------------------
# Begin Game_Map Edit
#------------------------------------------------------------------------------
class Game_Map
 #--------------------------------------------------------------------------
 alias slipknot_showmapname_gamemap_setupmapid setup_map_id
 alias slipknot_showmapname_gamemap_update update
 #--------------------------------------------------------------------------
 def setup_map_id(map_id)
   slipknot_showmapname_gamemap_setupmapid(map_id)
   if $game_temp.show_mapname
     @window_mapname = Window_MapName.new(map_id)
     $game_temp.show_mapname = false
   end
 end
 #--------------------------------------------------------------------------
 def dispose_window_mapname
   unless @window_mapname.nil? or @window_mapname.disposed?
     @window_mapname.dispose
   end
 end
 #--------------------------------------------------------------------------
 def update
   slipknot_showmapname_gamemap_update
   unless @window_mapname.nil? or @window_mapname.disposed?
     @window_mapname.update
   end
 end
end
#------------------------------------------------------------------------------
# End Game_Map Edit
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Begin Scene_Map Edit
#------------------------------------------------------------------------------
class Scene_Map
 #--------------------------------------------------------------------------
 alias slipknot_showmapname_scenemap_maindispose main_dispose
 #--------------------------------------------------------------------------
 def main_dispose
   slipknot_showmapname_scenemap_maindispose
   $game_map.dispose_window_mapname
 end
end
#------------------------------------------------------------------------------
# End Scene_Map Edit
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Begin Game_Temp Edit
#------------------------------------------------------------------------------
class Game_Temp
 #--------------------------------------------------------------------------
 attr_accessor(:show_mapname)
 #--------------------------------------------------------------------------
 alias slipknot_showmapname_gametemp_init initialize
 #--------------------------------------------------------------------------
 def initialize
   slipknot_showmapname_gametemp_init
   @show_mapname = false
 end
end
#------------------------------------------------------------------------------
# End Game_Temp Edit
#------------------------------------------------------------------------------

class Window_MapName < Window_Base
 #--------------------------------------------------------------------------
 include(Show_Map_Name)
 #--------------------------------------------------------------------------
 def initialize(map_id)
   name = $data_mapinfos[map_id].name
   dumb = Bitmap.new(128, 32)
   width = dumb.text_size(name).width + 32
   dumb.dispose
   super(320 - width / 2, Y, width, 64)
   self.contents = Bitmap.new(width - 32, 32)
   self.contents.draw_text(0, 0, width - 32, 32, name, 1)
   self.opacity = 0
   self.back_opacity = Back_Opacity
   @phase = 1
   @otime = 4
   @time = Show_Frames
 end
 #--------------------------------------------------------------------------
 def opacity=(val)
   super(val)
   self.contents_opacity = val
 end
 #--------------------------------------------------------------------------
 def update
   if @otime > 0
     @otime -= 1
     return
   end
   if @phase == 1 and opacity < 255
     self.opacity += 32
     return
   elsif @phase == 1 and opacity == 255
     @phase = 2
     return
   end
   if @time > 0
     @time -= 1
   else
     if self.opacity == 0
       self.dispose
       return
     end
     self.opacity -= 48
   end
 end
end

#--------------------------------------------------------------------------

FTW.
Title: Show Map Name (in map)
Post by: Blizzard on April 02, 2006, 05:48:58 PM
Lol, I have something similar implemented in my CMS and my save/load screen. Te CMS shows, where you
Title: Show Map Name (in map)
Post by: Neko on April 03, 2006, 12:47:43 AM
I still pwnd deathtrooper.
Title: Show Map Name (in map)
Post by: Dalton on April 03, 2006, 12:53:58 AM
The fact that I don't touch SDK scripts and didn't know it was possible to simply edit a few lines to suddenly not be SDK scripts because I never touch them doesn't mean you pwned me.  Within my first 3 days of using RPG Maker XP (I hadn't used any others either =/) I had done a succesful edit to the default systems to allow 5 party members to fit.
Title: Show Map Name (in map)
Post by: Blizzard on April 03, 2006, 12:58:55 AM
I nearly learned scripting Ruby in 3 days, while implementing and editing other
Title: Show Map Name (in map)
Post by: Andromeda on April 03, 2006, 04:28:52 AM
Hmmm....Neko, I put in that code you put (non-sdk) and when I try to test my game it comes up with this error:

???? 'Show_Mapname' ? 29 ??? NameError ???????

undefined method 'setup_map_id' for class 'Game_Map'

P.S.   I'm an rgss noob
Title: Show Map Name (in map)
Post by: Neko on April 03, 2006, 02:54:53 PM
Me too =] Thats just what I do to all scripts that I use lol. I dont know nor do I wish to learn RGSS at any time.
Title: Show Map Name (in map)
Post by: Andromeda on April 03, 2006, 11:44:15 PM
Can anyone give me a hint of why the script won't work for me? (see above error--also, I used the modified script that neko posted since it is non-sdk) Also, since I'm total noob, what do I have to use for the call script?
Title: Re: Show Map Name (in map)
Post by: Dalton on April 03, 2006, 11:51:06 PM
Quote from: Season In The AbyssPaste the code in a new section above Main (in the script editor). You can change some settings in the module called "Show_Map_Name". To show it in certain map, only add in the Call Script command (before your Teleport command) this:$game_temp.show_mapname = true

Also Neko's version might only work for Postality Knights if it even works at all.
Title: Show Map Name (in map)
Post by: Andromeda on April 03, 2006, 11:56:02 PM
Hmmm....ya that is what I tried the first time Deathtrooper, but for some reason it didn't work. Thanks anyway though.  :)
Title: Re: Show Map Name (in map)
Post by: Season In The Abyss on April 04, 2006, 08:13:45 PM
As the Requiremets says in the 1 post, this script needs SDK, without can't be used.
Title: Re: Show Map Name (in map)
Post by: dwarra on April 04, 2006, 08:16:24 PM
Quote from: DeathTrooper on April 03, 2006, 12:53:58 AM
The fact that I don't touch SDK scripts and didn't know it was possible to simply edit a few lines to suddenly not be SDK scripts because I never touch them doesn't mean you pwned me.  Within my first 3 days of using RPG Maker XP (I hadn't used any others either =/) I had done a succesful edit to the default systems to allow 5 party members to fit.

And that was hard why?