class Game_Event
Player_Event_Range_Loop_Animation_Show = true
Player_Event_Range_Loop_Animation_ID = 98
attr_accessor :player_event_range_loop_animation_show
attr_accessor :player_event_range_loop_animation_id
alias_method :seph_playereventrangeloopanimation_gmevt_refresh, :refresh
def refresh
seph_playereventrangeloopanimation_gmevt_refresh
@player_event_range_loop_animation_show = Player_Event_Range_Loop_Animation_Show
@player_event_range_loop_animation_id = Player_Event_Range_Loop_Animation_ID
if @erased
@player_event_range_loop_animation_show = false
return
end
return if @list.nil?
for event_command in @list
next unless [108, 408].include?(event_command.code)
if event_command.parameters[0].upcase.include?('DONT SHOW EVENT RANGE LOOP ANIMATIONS')
@player_event_range_loop_animation_show = false
@player_event_range_loop_animation_id = 0
return
end
next unless event_command.parameters[0].upcase.include?('PLAYER EVENT RANGE LOOP ANIMATION')
event_command.parameters[0].dup.gsub!(/\((.+?)\)/) do
@player_event_range_loop_animation_id = $1.to_i
break
end
end
end
end
class Game_Player
alias_method :seph_playereventrangeloopanimation_gmplyr_update, :update
def update
seph_playereventrangeloopanimation_gmplyr_update
if @x != @last_playereventrangeloopanimation_x ||
@y != @last_playereventrangeloopanimation_y
@last_playereventrangeloopanimation_x = @x
@last_playereventrangeloopanimation_y = @y
update_player_event_range_loop_animation
end
end
def update_player_event_range_loop_animation
for event in $game_map.events.values
if VR.in_range?(self, event, 1)
unless @seph_playereventrangeloopanimation_refresh ||
event.player_event_range_loop_animation_id == 0
@seph_playereventrangeloopanimation_refresh = true
@seph_playereventrangeloopanimation_restore = @loop_animation_id
@loop_animation_id = event.player_event_range_loop_animation_id
end
return
end
end
if @seph_playereventrangeloopanimation_refresh
@loop_animation_id = @seph_playereventrangeloopanimation_restore
@seph_playereventrangeloopanimation_refresh = false
end
end
end