Advertisement
Dekita

Icon Events v1.0

Mar 13th, 2014
578
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.83 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Icon Events
  5. # -- Author : Dekita
  6. # -- Version : 1.0
  7. # -- Level : Easy / Normal
  8. # -- Requires : $D13x Core Script v2.3+
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:IconEvents]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # 11/o3/2014 - Small Efficieny Update,
  21. # o8/o3/2o14 - Started, Finished,
  22. #
  23. #===============================================================================
  24. # ☆ Introduction
  25. #-------------------------------------------------------------------------------
  26. # This simple script allows for events to use an icon from your iconset as its
  27. # event image via simple event comments. You also change the hue value of the
  28. # icon image.
  29. #
  30. # NOTE:
  31. # If you are using this script to create items that disapear when picked up,
  32. # you must erase the event. This will remove the icon image from the screen.
  33. #
  34. #===============================================================================
  35. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  36. #===============================================================================
  37. # 1. You MUST give credit to "Dekita" !!
  38. # 2. You are NOT allowed to repost this script.(or modified versions)
  39. # 3. You are NOT allowed to convert this script.
  40. # 4. You are NOT allowed to use this script for Commercial games.
  41. # 5. ENJOY!
  42. #
  43. # "FINE PRINT"
  44. # By using this script you hereby agree to the above terms and conditions,
  45. # if any violation of the above terms occurs "legal action" may be taken.
  46. # Not understanding the above terms and conditions does NOT mean that
  47. # they do not apply to you.
  48. # If you wish to discuss the terms and conditions in further detail you can
  49. # contact me at http://dekitarpg.wordpress.com/
  50. #
  51. #===============================================================================
  52. # ☆ Instructions
  53. #-------------------------------------------------------------------------------
  54. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  55. #
  56. #===============================================================================
  57. # ☆ Notetags ( to be used in comment box of an event )
  58. #-------------------------------------------------------------------------------
  59. # <icon: ID, HUE>
  60. # ID = the iconset id of the image you want to use.
  61. # HUE = the hue of the icon image
  62. #
  63. #===============================================================================
  64. module IconEvents
  65. #===============================================================================
  66. #-----------------------------------------------------------------------------
  67. #
  68. #-----------------------------------------------------------------------------
  69. Note = /<icon:(.*),(.*)>/i
  70. #-----------------------------------------------------------------------------
  71. #
  72. #-----------------------------------------------------------------------------
  73. Set = "Iconset"
  74. #####################
  75. # CUSTOMISATION END #
  76. end #####################
  77. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  78. # #
  79. # http://dekitarpg.wordpress.com/ #
  80. # #
  81. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  82. #===============================================================================#
  83. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  84. # YES?\.\. #
  85. # OMG, REALLY? \| #
  86. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  87. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  88. #===============================================================================#
  89. class RPG::Event::Page
  90. #===============================================================================
  91. #-----------------------------------------------------------------------------
  92. # Notebox (Comment Command)
  93. #-----------------------------------------------------------------------------
  94. def note_box
  95. return "" if !@list || @list.size <= 0
  96. notes = []
  97. @list.each do |item|
  98. next unless item && (item.code == 108 || item.code == 408)
  99. notes << item.parameters[0]
  100. end
  101. notes.join("\r\n")
  102. end
  103. #-----------------------------------------------------------------------------
  104. # Get icon Index
  105. #-----------------------------------------------------------------------------
  106. def icon_index
  107. if note_box =~ IconEvents::Note
  108. return $1.to_i
  109. else
  110. return 0
  111. end
  112. end
  113. #-----------------------------------------------------------------------------
  114. # Get icon Hue
  115. #-----------------------------------------------------------------------------
  116. def icon_hue
  117. if note_box =~ IconEvents::Note
  118. return $2.to_i
  119. else
  120. return 0
  121. end
  122. end
  123. end
  124.  
  125. #===============================================================================
  126. class Sprite_CharIcon < Sprite
  127. #===============================================================================
  128. #-----------------------------------------------------------------------------
  129. # Initialize
  130. #-----------------------------------------------------------------------------
  131. def initialize(vp=nil,icon=0,hue=0)
  132. super(vp)
  133. @icon = Cache.icon(IconEvents::Set,hue)
  134. rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
  135. self.bitmap = Bitmap.new(24,24)
  136. self.bitmap.blt(0, 0, @icon, rect)
  137. @icon.dispose
  138. @icon = nil
  139. end
  140. #-----------------------------------------------------------------------------
  141. # Dispose
  142. #-----------------------------------------------------------------------------
  143. def dispose
  144. super
  145. if self.bitmap != nil
  146. self.bitmap.dispose
  147. end
  148. end
  149. #-----------------------------------------------------------------------------
  150. # Update
  151. #-----------------------------------------------------------------------------
  152. def update
  153. super
  154. end
  155. end
  156.  
  157. #===============================================================================
  158. class Sprite_Character < Sprite_Base
  159. #===============================================================================
  160. #-----------------------------------------------------------------------------
  161. # Alias List
  162. #-----------------------------------------------------------------------------
  163. alias :set_char_iconset :set_character_bitmap
  164. alias :disp_iconindex :dispose
  165. alias :updt_iconindex :update
  166. alias :updtpos_icon :update_position
  167. alias :updtoth_icon :update_other
  168. #-----------------------------------------------------------------------------
  169. # Set Char Bitmap
  170. #-----------------------------------------------------------------------------
  171. def set_character_bitmap
  172. if @character.icon_index != 0
  173. set_char_icon
  174. else
  175. set_char_iconset
  176. end
  177. end
  178. #-----------------------------------------------------------------------------
  179. # Set Char Icon
  180. #-----------------------------------------------------------------------------
  181. def set_char_icon
  182. v = viewport
  183. i = @character.icon_index
  184. h = @character.icon_hue
  185. @icon_bitmap = Sprite_CharIcon.new(v,i,h)
  186. @icon_bitmap.ox = 12
  187. @icon_bitmap.oy = 28
  188. @cw = 24
  189. @ch = 24
  190. end
  191. #-----------------------------------------------------------------------------
  192. # Dispose
  193. #-----------------------------------------------------------------------------
  194. def dispose
  195. dispose_icon_bitmap
  196. disp_iconindex
  197. end
  198. #-----------------------------------------------------------------------------
  199. # Dispose Icon
  200. #-----------------------------------------------------------------------------
  201. def dispose_icon_bitmap
  202. return unless @icon_bitmap
  203. @icon_bitmap.dispose
  204. @icon_bitmap = nil
  205. end
  206. #-----------------------------------------------------------------------------
  207. # Update
  208. #-----------------------------------------------------------------------------
  209. def update
  210. update_icon_bitmap_b4
  211. updt_iconindex
  212. update_icon_bitmap
  213. end
  214. #-----------------------------------------------------------------------------
  215. # Update Icon Before
  216. #-----------------------------------------------------------------------------
  217. def update_icon_bitmap_b4
  218. return unless @icon_bitmap
  219. return unless @character.has_erased?
  220. dispose_icon_bitmap
  221. end
  222. #-----------------------------------------------------------------------------
  223. # Update Icon (after)
  224. #-----------------------------------------------------------------------------
  225. def update_icon_bitmap
  226. return unless @icon_bitmap
  227. @icon_bitmap.update
  228. end
  229. #-----------------------------------------------------------------------------
  230. # Update Position
  231. #-----------------------------------------------------------------------------
  232. def update_position
  233. updtpos_icon
  234. update_icon_pos
  235. end
  236. #-----------------------------------------------------------------------------
  237. # Update Icon Position
  238. #-----------------------------------------------------------------------------
  239. def update_icon_pos
  240. return unless @icon_bitmap
  241. @icon_bitmap.x = (@character.screen_x)
  242. @icon_bitmap.y = (@character.screen_y)
  243. @icon_bitmap.z = (@character.screen_z)
  244. end
  245. #-----------------------------------------------------------------------------
  246. # Update Other
  247. #-----------------------------------------------------------------------------
  248. def update_other
  249. updtoth_icon
  250. update_icon_other
  251. end
  252. #-----------------------------------------------------------------------------
  253. # Update Icon Other
  254. #-----------------------------------------------------------------------------
  255. def update_icon_other
  256. return unless @icon_bitmap
  257. @icon_bitmap.opacity = @character.opacity
  258. @icon_bitmap.blend_type = @character.blend_type
  259. @icon_bitmap.bush_depth = @character.bush_depth
  260. @icon_bitmap.visible = !@character.transparent
  261. end
  262. end
  263.  
  264. #===============================================================================
  265. class Game_Character < Game_CharacterBase
  266. #===============================================================================
  267. #-----------------------------------------------------------------------------
  268. # Get Icon Data
  269. #-----------------------------------------------------------------------------
  270. def icon_index
  271. @icon_index || 0
  272. end
  273. #-----------------------------------------------------------------------------
  274. # Get Icon Hue
  275. #-----------------------------------------------------------------------------
  276. def icon_hue
  277. @icon_hue || 0
  278. end
  279. end
  280.  
  281. #===============================================================================
  282. class Game_Event < Game_Character
  283. #===============================================================================
  284. #-----------------------------------------------------------------------------
  285. # Alias List
  286. #-----------------------------------------------------------------------------
  287. alias :setup_icon_char :setup_page_settings
  288. #-----------------------------------------------------------------------------
  289. # Setup Icon For Page
  290. #-----------------------------------------------------------------------------
  291. def setup_page_settings
  292. setup_icon_char
  293. @icon_index = @page.icon_index
  294. @icon_hue = @page.icon_hue
  295. end
  296. #-----------------------------------------------------------------------------
  297. # Has Event Erased?
  298. #-----------------------------------------------------------------------------
  299. def has_erased?
  300. return @erased
  301. end
  302. end
  303.  
  304. #==============================================================================#
  305. # http://dekitarpg.wordpress.com/ #
  306. #==============================================================================#
  307. end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement