Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if true # << Make true to use this script, false to disable.
- #===============================================================================
- #
- # ☆ $D13x - Icon Events
- # -- Author : Dekita
- # -- Version : 1.0
- # -- Level : Easy / Normal
- # -- Requires : $D13x Core Script v2.3+
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:IconEvents]=true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # 11/o3/2014 - Small Efficieny Update,
- # o8/o3/2o14 - Started, Finished,
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This simple script allows for events to use an icon from your iconset as its
- # event image via simple event comments. You also change the hue value of the
- # icon image.
- #
- # NOTE:
- # If you are using this script to create items that disapear when picked up,
- # you must erase the event. This will remove the icon image from the screen.
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- #===============================================================================
- # 1. You MUST give credit to "Dekita" !!
- # 2. You are NOT allowed to repost this script.(or modified versions)
- # 3. You are NOT allowed to convert this script.
- # 4. You are NOT allowed to use this script for Commercial games.
- # 5. ENJOY!
- #
- # "FINE PRINT"
- # By using this script you hereby agree to the above terms and conditions,
- # if any violation of the above terms occurs "legal action" may be taken.
- # Not understanding the above terms and conditions does NOT mean that
- # they do not apply to you.
- # If you wish to discuss the terms and conditions in further detail you can
- # contact me at http://dekitarpg.wordpress.com/
- #
- #===============================================================================
- # ☆ Instructions
- #-------------------------------------------------------------------------------
- # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
- #
- #===============================================================================
- # ☆ Notetags ( to be used in comment box of an event )
- #-------------------------------------------------------------------------------
- # <icon: ID, HUE>
- # ID = the iconset id of the image you want to use.
- # HUE = the hue of the icon image
- #
- #===============================================================================
- module IconEvents
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- Note = /<icon:(.*),(.*)>/i
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- Set = "Iconset"
- #####################
- # CUSTOMISATION END #
- end #####################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- #===============================================================================#
- # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
- # YES?\.\. #
- # OMG, REALLY? \| #
- # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
- # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
- #===============================================================================#
- class RPG::Event::Page
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Notebox (Comment Command)
- #-----------------------------------------------------------------------------
- def note_box
- return "" if !@list || @list.size <= 0
- notes = []
- @list.each do |item|
- next unless item && (item.code == 108 || item.code == 408)
- notes << item.parameters[0]
- end
- notes.join("\r\n")
- end
- #-----------------------------------------------------------------------------
- # Get icon Index
- #-----------------------------------------------------------------------------
- def icon_index
- if note_box =~ IconEvents::Note
- return $1.to_i
- else
- return 0
- end
- end
- #-----------------------------------------------------------------------------
- # Get icon Hue
- #-----------------------------------------------------------------------------
- def icon_hue
- if note_box =~ IconEvents::Note
- return $2.to_i
- else
- return 0
- end
- end
- end
- #===============================================================================
- class Sprite_CharIcon < Sprite
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Initialize
- #-----------------------------------------------------------------------------
- def initialize(vp=nil,icon=0,hue=0)
- super(vp)
- @icon = Cache.icon(IconEvents::Set,hue)
- rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
- self.bitmap = Bitmap.new(24,24)
- self.bitmap.blt(0, 0, @icon, rect)
- @icon.dispose
- @icon = nil
- end
- #-----------------------------------------------------------------------------
- # Dispose
- #-----------------------------------------------------------------------------
- def dispose
- super
- if self.bitmap != nil
- self.bitmap.dispose
- end
- end
- #-----------------------------------------------------------------------------
- # Update
- #-----------------------------------------------------------------------------
- def update
- super
- end
- end
- #===============================================================================
- class Sprite_Character < Sprite_Base
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :set_char_iconset :set_character_bitmap
- alias :disp_iconindex :dispose
- alias :updt_iconindex :update
- alias :updtpos_icon :update_position
- alias :updtoth_icon :update_other
- #-----------------------------------------------------------------------------
- # Set Char Bitmap
- #-----------------------------------------------------------------------------
- def set_character_bitmap
- if @character.icon_index != 0
- set_char_icon
- else
- set_char_iconset
- end
- end
- #-----------------------------------------------------------------------------
- # Set Char Icon
- #-----------------------------------------------------------------------------
- def set_char_icon
- v = viewport
- i = @character.icon_index
- h = @character.icon_hue
- @icon_bitmap = Sprite_CharIcon.new(v,i,h)
- @icon_bitmap.ox = 12
- @icon_bitmap.oy = 28
- @cw = 24
- @ch = 24
- end
- #-----------------------------------------------------------------------------
- # Dispose
- #-----------------------------------------------------------------------------
- def dispose
- dispose_icon_bitmap
- disp_iconindex
- end
- #-----------------------------------------------------------------------------
- # Dispose Icon
- #-----------------------------------------------------------------------------
- def dispose_icon_bitmap
- return unless @icon_bitmap
- @icon_bitmap.dispose
- @icon_bitmap = nil
- end
- #-----------------------------------------------------------------------------
- # Update
- #-----------------------------------------------------------------------------
- def update
- update_icon_bitmap_b4
- updt_iconindex
- update_icon_bitmap
- end
- #-----------------------------------------------------------------------------
- # Update Icon Before
- #-----------------------------------------------------------------------------
- def update_icon_bitmap_b4
- return unless @icon_bitmap
- return unless @character.has_erased?
- dispose_icon_bitmap
- end
- #-----------------------------------------------------------------------------
- # Update Icon (after)
- #-----------------------------------------------------------------------------
- def update_icon_bitmap
- return unless @icon_bitmap
- @icon_bitmap.update
- end
- #-----------------------------------------------------------------------------
- # Update Position
- #-----------------------------------------------------------------------------
- def update_position
- updtpos_icon
- update_icon_pos
- end
- #-----------------------------------------------------------------------------
- # Update Icon Position
- #-----------------------------------------------------------------------------
- def update_icon_pos
- return unless @icon_bitmap
- @icon_bitmap.x = (@character.screen_x)
- @icon_bitmap.y = (@character.screen_y)
- @icon_bitmap.z = (@character.screen_z)
- end
- #-----------------------------------------------------------------------------
- # Update Other
- #-----------------------------------------------------------------------------
- def update_other
- updtoth_icon
- update_icon_other
- end
- #-----------------------------------------------------------------------------
- # Update Icon Other
- #-----------------------------------------------------------------------------
- def update_icon_other
- return unless @icon_bitmap
- @icon_bitmap.opacity = @character.opacity
- @icon_bitmap.blend_type = @character.blend_type
- @icon_bitmap.bush_depth = @character.bush_depth
- @icon_bitmap.visible = !@character.transparent
- end
- end
- #===============================================================================
- class Game_Character < Game_CharacterBase
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Get Icon Data
- #-----------------------------------------------------------------------------
- def icon_index
- @icon_index || 0
- end
- #-----------------------------------------------------------------------------
- # Get Icon Hue
- #-----------------------------------------------------------------------------
- def icon_hue
- @icon_hue || 0
- end
- end
- #===============================================================================
- class Game_Event < Game_Character
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Alias List
- #-----------------------------------------------------------------------------
- alias :setup_icon_char :setup_page_settings
- #-----------------------------------------------------------------------------
- # Setup Icon For Page
- #-----------------------------------------------------------------------------
- def setup_page_settings
- setup_icon_char
- @icon_index = @page.icon_index
- @icon_hue = @page.icon_hue
- end
- #-----------------------------------------------------------------------------
- # Has Event Erased?
- #-----------------------------------------------------------------------------
- def has_erased?
- return @erased
- end
- end
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement