Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as Ruby by Deity ( 14 years ago )
=begin
 To show an icon on a event just take CtI = Iconid
 as the name of the event.
 Example: CtI = 1
 If you want to set the icon visible just use this in a
 Call Script...
 icon_visibility(id,status)
 id = eventid
 status = true/false
 this command works only for an event on the visited map.
 To change the visibility of all icons on the visited map use:
 all_icon_visibility(status)
 status = true/false
 To change the visibility of all icons on all visited maps use:
 global_icon_visibility(status)
 status = true/false
=end
class Game_Temp
  attr_accessor :eventicons
  alias initialize_icon initialize unless $@
  def initialize
    initialize_icon
    @eventicons = []
  end
end
class Game_System
  attr_accessor :eventiconsvisibility
  alias initialize_iconvis initialize unless $@
  def initialize
    initialize_iconvis
    @eventiconsvisibility = {}
  end
end
class Game_Event
  attr_accessor :name
  alias initialize_name initialize unless $@
  def initialize(map_id, event)
    initialize_name(map_id, event)
    @name = event.name
  end
end
class Game_Map
  attr_reader :map_id
  alias setup_emptyvisibilityicons setup unless $@
  def setup(map_id)
    $game_temp.eventicons = [] if @map_id != map_id
    setup_emptyvisibilityicons(map_id)
    if $game_system.eventiconsvisibility.include?(map_id) == false
      $game_system.eventiconsvisibility.store(map_id,[])
    end
  end
end
class Scene_Map
  alias initialize_event_icons initialize unless $@
  def initialize
    initialize_event_icons
    $game_temp.eventicons = []
  end
  alias update_transfer_player_event_icons update_transfer_player unless $@
  def update_transfer_player
    $game_temp.eventicons = [] unless $game_player.transfer? == false
    update_transfer_player_event_icons
  end
end
class Sprite_Character
  alias initialize_icon initialize unless $@
  def initialize(viewport, character = nil)  
    initialize_icon(viewport, character) 
    if character.class == Game_Event
      if character.name.include?("CtI")
        data = character.name.split
        id = data[data.index("CtI")+2].to_i
        @icon = Eventicon.new(id,character,viewport,character.screen_x - 32 + 4 + 12,character.screen_y - 32 + 4)
        $game_temp.eventicons.push(@icon)
        if $game_system.eventiconsvisibility[$game_map.map_id].size < $game_temp.eventicons.size
          $game_system.eventiconsvisibility[$game_map.map_id].push(false)
        else
          @icon.visible = $game_system.eventiconsvisibility[$game_map.map_id][$game_temp.eventicons.size - 1]
        end
      end
    end   
  end 
  alias dispose_icon dispose unless $@
  def dispose
    @icon.dispose if @icon != nil
    dispose_icon
  end
  alias update_icon update unless $@
  def update
    update_icon
    @icon.update if @icon != nil
  end
end
class Eventicon < Sprite
  attr_accessor :event
  def initialize(icon_index,event,viewport,x,y)
    super(viewport)
    @event = event
    self.visible = false
    self.x = x
    self.y = y
    self.bitmap = Bitmap.new(24,24)
    draw_icon(icon_index,0,0)
  end
  def draw_icon(icon_index, x, y, enabled = true)
    bitmap = Cache.system&#40;"Iconset"&#41;
    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
    self.bitmap.blt(x, y, bitmap, rect, enabled ? 255 : 128)
  end
  def update
    self.z = @event.screen_z
    self.x = @event.screen_x - 32 + 4 + 12
    self.y = @event.screen_y - 32 + 4
  end
end
class Game_Interpreter
  def global_icon_visibility(status)
    for i in $game_system.eventiconsvisibility
      for o in 0...$game_system.eventiconsvisibility[i[0]].size
        $game_system.eventiconsvisibility[i[0]][o] = status
      end
    end
    all_icon_visibility(status)
  end
  def all_icon_visibility(status)
    for i in $game_temp.eventicons
      i.visible = status
    end
    for i in 0...$game_system.eventiconsvisibility[$game_map.map_id].size
      $game_system.eventiconsvisibility[$game_map.map_id][i] = status
    end
  end
  def icon_visibility(id,status)
    for i in 0...$game_temp.eventicons.size
      if $game_temp.eventicons[i].event == $game_map.events[id]
        $game_temp.eventicons[i].visible = status
        $game_system.eventiconsvisibility[$game_map.map_id][i] = status
      end
    end
  end
end

 

Revise this Paste

Your Name: Code Language: