Advertisement
Dekita

amn

Jan 8th, 2013
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.87 KB | None | 0 0
  1. =begin =========================================================================
  2. Dekita's v1.0
  3. ★ Animatéd Map Namé™ ★
  4.  
  5. ================================================================================
  6. Script Information:
  7. ====================
  8. This script creates a new map name "window" and gives the ability to remove
  9. the old (shit) one.
  10.  
  11. ================================================================================
  12. ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  13. ================================================================================
  14. 1. You must give credit to "Dekita"
  15. 2. You are NOT allowed to repost this script.(or modified versions)
  16. 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
  17. 4. You are NOT allowed to use this script for Commercial games.
  18. 5. ENJOY!
  19.  
  20. "FINE PRINT"
  21. By using this script you hereby agree to the above terms and conditions,
  22. if any violation of the above terms occurs "legal action" may be taken.
  23. Not understanding the above terms and conditions does NOT mean that
  24. they do not apply to you.
  25. If you wish to discuss the terms and conditions in further detail you can
  26. contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  27.  
  28. ================================================================================
  29. History:
  30. =========
  31. D /M /Y
  32. 06/01/2o13 - started && finished,
  33.  
  34. ================================================================================
  35. Known Bugs:
  36. ============
  37. N/A
  38.  
  39. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  40. If a new bug is found please contact me at
  41. http://dekitarpg.wordpress.com/
  42.  
  43. ================================================================================
  44. INSTRUCTIONS:
  45. ==============
  46. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  47.  
  48. ================================================================================
  49. NOTETAGS:
  50. ==========
  51. <icon: icon_id>
  52. notetag for maps that have unique map name icon images
  53.  
  54. =end #==========================================================================#
  55.  
  56. module Map_Name_Window
  57.  
  58. Remove_Default_Name_Window = true # obviously...
  59.  
  60. Icon = 304 #231
  61.  
  62. Icon_Pos = [10, 10] # [x, y]
  63.  
  64. Map_Name_Pos = [25, 5] # [x, y]
  65.  
  66. # replace this with a string of the font you wish to use. eg. "Comic Sans MS"
  67. Font_Name = Font.default_name
  68.  
  69. Font_Size = 18
  70.  
  71. Font_Bold = true
  72.  
  73. Font_Italic = true
  74.  
  75. # Font_Color = [ use? , color(red,grn,blu,alpha)]
  76. Font_Color = [ false , Color.new(255,0,0,255) ]
  77. # Font outline color.
  78. Font_Out_Col=[ false , Color.new(0 ,0 ,0,128) ]
  79.  
  80. # Z value for the new map name "window"
  81. Map_Name_z = 100
  82.  
  83. # The delay from entering the map till the name begins to show. (Frames)
  84. Delay_Timer = 30
  85.  
  86. # The delay between each letter showing, this results in a fade like effect.
  87. L_S_D_Timer = 10
  88.  
  89. end #####################
  90. # CUSTOMISATION END #
  91. #####################
  92. #===============================================================================#
  93. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  94. # #
  95. # http://dekitarpg.wordpress.com/ #
  96. # #
  97. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  98. #===============================================================================#
  99. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  100. # YES?\.\. #
  101. # OMG, REALLY? \| #
  102. # WELL SLAP MY FACE AND CALL ME A DITTO.\..\.. #
  103. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  104. #===============================================================================#
  105.  
  106. $imported = {} if $imported.nil?
  107. $imported[:Dekita_Anim_Map_Name] = true
  108.  
  109. #===============================================================================#
  110. class RPG::Map
  111. #===============================================================================#
  112.  
  113. attr_reader(:map_name_icon)
  114.  
  115. def get_map_name_icon_info
  116. @map_name_icon = Map_Name_Window::Icon
  117. self.note.split(/[\r\n]+/).each { |line|
  118. case line ;
  119. when /<icon: (.*)>/i
  120. @map_name_icon = $1.to_i
  121. end ; } # self.note.split
  122. end
  123.  
  124. end
  125.  
  126. #==============================================================================
  127. class Game_Temp
  128. #==============================================================================
  129.  
  130. attr_accessor :mapname
  131.  
  132. alias :map_name_initialize_GT :initialize
  133. def initialize
  134. map_name_initialize_GT
  135. @mapname = nil
  136. end
  137.  
  138. end
  139.  
  140. #===============================================================================#
  141. class Game_Map
  142. #===============================================================================#
  143.  
  144. alias :map_nameGMsetup :setup
  145. def setup(map_id)
  146. map_nameGMsetup(map_id)
  147. @map.get_map_name_icon_info
  148. end
  149.  
  150. def map_name_icon
  151. @map.map_name_icon
  152. end
  153.  
  154. end
  155.  
  156. #==============================================================================
  157. class Sprite_Name < Sprite
  158. #==============================================================================
  159.  
  160. include Map_Name_Window
  161.  
  162. def initialize(letter, x = 0, y = 0, timer = 0)
  163. super(nil)
  164. create_map_name(letter, x, y)
  165. @open = true
  166. @timer = timer
  167. @timer_val = 0
  168. end
  169.  
  170. def create_map_name(letter, x, y)
  171. size = Font_Size
  172. self.bitmap = Bitmap.new(size,size)
  173. self.bitmap.font.size = size
  174. self.bitmap.font.bold = Font_Bold
  175. self.bitmap.font.italic = Font_Italic
  176. self.bitmap.font.color = Font_Color[1] if Font_Color[0]
  177. self.bitmap.font.out_color = Font_Out_Col[1] if Font_Out_Col[0]
  178. self.bitmap.draw_text(0, 0, size, size, letter.to_s,0)
  179. self.x = x#(x - (self.bitmap.width/2))
  180. self.y = y + (size / 2).to_i
  181. self.z = Map_Name_z + 1
  182. self.opacity = 0
  183. end
  184.  
  185. def update
  186. super
  187. update_show
  188. end
  189.  
  190. def update_show
  191. if @timer_val <= @timer
  192. @timer_val += 1
  193. self.opacity = 1
  194. return
  195. end
  196. if @open ; self.opacity += 1
  197. else ; self.opacity -= 1
  198. end
  199. @open = false if self.opacity >= 255
  200. end
  201.  
  202. def dispose
  203. super
  204. end
  205.  
  206. end
  207.  
  208. #==============================================================================
  209. class Sprite_MapIcon < Sprite
  210. #==============================================================================
  211.  
  212. def initialize(icon, x = 0, y = 0)
  213. super(nil)
  214. self.bitmap = Cache.system("Iconset")
  215. rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
  216. self.bitmap.blt(0, 0, self.bitmap, rect)
  217. self.src_rect.set(rect.x, rect.y, 24, 24)
  218. self.x = x
  219. self.y = y
  220. self.z = Map_Name_Window::Map_Name_z
  221. self.opacity = 0
  222. @open = true
  223. end
  224.  
  225. def update
  226. super
  227. update_show
  228. end
  229.  
  230. def update_show
  231. if @open ; self.opacity += 1
  232. else ; self.opacity -= 1
  233. end
  234. @open = false if self.opacity >= 255
  235. end
  236.  
  237. def dispose
  238. super
  239. end
  240.  
  241. end
  242.  
  243. #==============================================================================
  244. class Spriteset_Map_Name
  245. #==============================================================================
  246.  
  247. def initialize
  248. return if $game_temp.mapname == $game_map.display_name
  249. dispose
  250. create_map_name_BG
  251. create_map_name
  252. @delay_timer = 0
  253. end
  254.  
  255. def create_map_name_BG
  256. x = Map_Name_Window::Icon_Pos[0]
  257. y = Map_Name_Window::Icon_Pos[1]
  258. icon = $game_map.map_name_icon
  259. @map_icon.dispose if @map_icon != nil
  260. @map_icon = Sprite_MapIcon.new(icon, x, y)
  261. end
  262.  
  263. def create_map_name
  264. x = Map_Name_Window::Map_Name_Pos[0]
  265. y = Map_Name_Window::Map_Name_Pos[1]
  266. $game_temp.mapname = $game_map.display_name
  267. n = $game_map.display_name.to_s.split(//)
  268. @map_name = []
  269. timer = Map_Name_Window::L_S_D_Timer
  270. for i in n
  271. @map_name.push( Sprite_Name.new(i[0], x, y, timer) )
  272. x += ($imported[:Dekita_Game_Settings] ? Font.default_size : Font_Size)/4*3
  273. timer += Map_Name_Window::L_S_D_Timer
  274. end
  275. end
  276.  
  277. def update
  278. initialize
  279. update_map_name
  280. end
  281.  
  282. def update_map_name
  283. return if @delay_timer == nil
  284. @delay_timer += 1
  285. return unless @delay_timer >= Map_Name_Window::Delay_Timer
  286. @map_icon.update if @map_icon != nil
  287. if @map_name != nil
  288. @map_name.each {|sprite|
  289. next unless sprite != nil
  290. sprite.update if !sprite.disposed?
  291. sprite.dispose if sprite != nil && !sprite.disposed? && sprite.opacity <= 0
  292. }
  293. end
  294. end
  295.  
  296. def dispose
  297. @map_icon.dispose if @map_icon != nil
  298. @map_name.each {|sprite| sprite.dispose if sprite != nil &&
  299. !sprite.disposed? } if @map_name != nil
  300. end
  301.  
  302. end
  303.  
  304. #==============================================================================
  305. class Spriteset_Map
  306. #==============================================================================
  307.  
  308. alias :initialize_map_name :initialize
  309. alias :dispose_map_name :dispose
  310. alias :update_map_name :update
  311.  
  312. def initialize
  313. initialize_map_name
  314. @mn = Spriteset_Map_Name.new
  315. end
  316.  
  317. def dispose
  318. dispose_map_name
  319. @mn.dispose if @mn != nil
  320. end
  321.  
  322. def update
  323. update_map_name
  324. @mn.update if @mn != nil
  325. end
  326.  
  327. end
  328.  
  329. #==============================================================================
  330. class Window_MapName < Window_Base
  331. #==============================================================================
  332.  
  333. if Map_Name_Window::Remove_Default_Name_Window
  334.  
  335. def update
  336. super
  337. end
  338.  
  339. def open
  340. refresh
  341. self
  342. end
  343.  
  344. def close
  345. self
  346. end
  347.  
  348. def refresh
  349. contents.clear
  350. end
  351.  
  352. end # if Map_Name_Window::Remove_Default_Name_Window
  353.  
  354. end
  355.  
  356. #==============================================================================#
  357. # - SCRIPT END - #
  358. #==============================================================================#
  359. # http://dekitarpg.wordpress.com/ #
  360. #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement