# Require Galv Map Position Script
# https://galvs-scripts.com/2012/11/07/map-positions/
# This script is an edit on certain method of Galv Map Position script. It
# enable the use of custom graphic for each event instead a common one for all
# event like the original does.
# To use the aforementioned feature, set EVENT_LOCATION_MARKERS value as 0 in
# Galv Map Position script. Put this
# <map_icon pic_name>
# on comment command on the event that going to use a custom picture, where
# pic_name is the name of the picture located on the Pictures folder. Make sure
# that the comment is not the first command on the event or it will appear as
# the name of the event on the galv's map.
class Scene_ViewMap < Scene_MenuBase
def create_event_blips
return if $game_map.markers[$game_map.map_id].nil?
m = $game_map.markers[$game_map.map_id]
event_count = m.count; @event_blip = {}; @event_text = {}
if Galv_Map::EVENT_LOCATION_MARKERS == 1
event_count.times { |i|
if !$game_map.events[m[i]].nil?
@tile_id = $game_map.events[m[i]].tile_id
@event_text_color = Galv_Map::EVENT_TEXT_COLOR
@event_blip[i+1] = Sprite.new
if @tile_id > 0
sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
sy = @tile_id % 256 / 8 % 16 * 32;
@event_blip[i+1].bitmap = tileset_bitmap(@tile_id)
@event_blip[i+1].src_rect.set(sx, sy, 32, 32)
cw = @event_blip[i+1].src_rect.width
ch = @event_blip[i+1].src_rect.height
else
@event_blip[i+1].bitmap = Cache.character($game_map.events[m[i]].character_name)
sign = $game_map.events[m[i]].character_name[/^[\!\$]./]
if sign && sign.include?('$')
cw = @event_blip[i+1].bitmap.width / 3
ch = @event_blip[i+1].bitmap.height / 4
else
cw = @event_blip[i+1].bitmap.width / 12
ch = @event_blip[i+1].bitmap.height / 8
end
n = $game_map.events[m[i]].character_index
case $game_map.events[m[i]].direction
when 2; dir = 0; when 4; dir = ch; when 6; dir = ch * 2; when 8; dir = ch * 3; end
pat = $game_map.events[m[i]].pattern; pat = 1 if pat > 2
@event_blip[i+1].src_rect = Rect.new((n%4*3 + pat)*cw, (n/4*4)*ch + dir, cw, ch)
end
@event_blip[i+1].x = (($game_map.events[m[i]].x / @scale_x.to_f).to_f * 32) + @map.x.to_f - (cw.to_f / 2).to_f + 4
@event_blip[i+1].y = (($game_map.events[m[i]].y / @scale_y.to_f).to_f * 32) + @map.y.to_f - (ch.to_f / 2).to_f + 4
@event_blip[i+1].bitmap.blt(0 - cw / 2, 0 - ch, @event_blip[i+1].bitmap, @event_blip[i+1].src_rect)
if $game_map.events[m[i]].list[0].code == 108
@show_text = $game_map.events[m[i]].list[0].parameters[0]
@show_text = convert_escape_characters(@show_text)
@event_text[i+1] = Sprite.new
@event_text[i+1].bitmap = Bitmap.new(150, Galv_Map::EVENT_TEXT_SIZE)
@event_text[i+1].bitmap.font.size = Galv_Map::EVENT_TEXT_SIZE
@event_text[i+1].bitmap.font.color.set(text_color(@event_text_color))
@event_text[i+1].bitmap.draw_text(@event_text[i+1].bitmap.rect, @show_text, 1)
@event_text[i+1].x = (($game_map.events[m[i]].x / @scale_x.to_f).to_f * 32) + @map.x.to_f - (@event_text[i+1].bitmap.width.to_f / 2).to_f + 5
@event_text[i+1].y = (($game_map.events[m[i]].y / @scale_y.to_f).to_f * 32) + @map.y.to_f - (@event_text[i+1].bitmap.height.to_f / 2).to_f + (ch / 1.5).to_f
end
end
}
else
event_count.times { |i|
@event_text_color = Galv_Map::EVENT_TEXT_COLOR
if !$game_map.events[m[i]].nil?
@event_blip[i+1] = Sprite.new
a = Galv_Map::EVENT_IMAGE
$game_map.events[m[i]].list.each do |command|
a = $1 if command.code == 108 && command.parameters[0] =~ /<map_icon (.+)>/
end
@event_blip[i+1].bitmap = Cache.picture(a)
@event_blip[i+1].x = (($game_map.events[m[i]].x / @scale_x.to_f).to_f * 32) + @map.x.to_f - (@event_blip[i+1].bitmap.width / 2).to_f + 4
@event_blip[i+1].y = (($game_map.events[m[i]].y / @scale_y.to_f).to_f * 32) + @map.y.to_f - (@event_blip[i+1].bitmap.height / 2).to_f + 4
if $game_map.events[m[i]].list[0].code == 108
@show_text = $game_map.events[m[i]].list[0].parameters[0]
@show_text = convert_escape_characters(@show_text)
@event_text[i+1] = Sprite.new
@event_text[i+1].bitmap = Bitmap.new(150, Galv_Map::EVENT_TEXT_SIZE)
@event_text[i+1].bitmap.font.size = Galv_Map::EVENT_TEXT_SIZE
@event_text[i+1].bitmap.font.color.set(text_color(@event_text_color))
@event_text[i+1].bitmap.draw_text(@event_text[i+1].bitmap.rect, @show_text, 1)
@event_text[i+1].x = (($game_map.events[m[i]].x / @scale_x.to_f).to_f * 32) + @map.x.to_f - (@event_text[i+1].bitmap.width.to_f / 2).to_f + 5
@event_text[i+1].y = (($game_map.events[m[i]].y / @scale_y.to_f).to_f * 32) + @map.y.to_f + (@event_blip[i+1].bitmap.height / 2)
end
end
}
end
end
end
Comments
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎