module Fux2
D = {2=>[0,1],4=>[-1,0],6=>[1,0],8=>[0,-1]}
end
class Scene_Item
include Fux2
alias uu update_item
def update_item
if Input.trigger?(Input::C)
xa = Fux2::D[$game_player.direction][0]
ya = Fux2::D[$game_player.direction][1]
@item = @item_window.item
if @item && @item.hit == 0
$game_map.events.values.each do |event|
if $game_player.x == event.x && $game_player.y == event.y
event.event.pages.each do |page|
if page.graphic.character_name == "" && page.through == true && page.list[0].code == 111 && page.list[0].parameters[1] == @item.id
$game_system.map_interpreter.setup(page.list,event.id)
$scene = Scene_Map.new
return
end
end
elsif $game_player.x+xa == event.x && $game_player.y+ya == event.y
event.event.pages.each do |page|
if page.graphic.character_name == "" && page.through == true && page.list[0].code == 111 && page.list[0].parameters[1] == @item.id
$game_system.map_interpreter.setup(page.list,event.id)
$scene = Scene_Map.new
return
end
end
end
end
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$scene = Scene_Map.new
return
end
return
end
end
uu
end
end
class Game_System
attr_accessor:map_interpreter
end
class Game_Event < Game_Character
def parameters
return @parameters
end
def event
return @event
end
def code
return @code
end
def trigger
return @trigger
end
end
class Game_Event < Game_Character
def refresh
new_page = nil
unless @erased
for page in @event.pages.reverse
c = page.condition
if page.graphic.character_name == "" && page.through == true
next
end
if c.switch1_valid
if $game_switches[c.switch1_id] == false
next
end
end
if c.switch2_valid
if $game_switches[c.switch2_id] == false
next
end
end
if c.variable_valid
if $game_variables[c.variable_id] < c.variable_value
next
end
end
if c.self_switch_valid
key = [@map_id, @event.id, c.self_switch_ch]
if $game_self_switches[key] != true
next
end
end
new_page = page
break
end
end
if new_page == @page
return
end
@page = new_page
clear_starting
if @page == nil
@tile_id = 0
@character_name = ""
@character_hue = 0
@move_type = 0
@through = true
@trigger = nil
@list = nil
@interpreter = nil
return
end
@tile_id = @page.graphic.tile_id
@character_name = @page.graphic.character_name
@character_hue = @page.graphic.character_hue
if @original_direction != @page.graphic.direction
@direction = @page.graphic.direction
@original_direction = @direction
@prelock_direction = 0
end
if @original_pattern != @page.graphic.pattern
@pattern = @page.graphic.pattern
@original_pattern = @pattern
end
@opacity = @page.graphic.opacity
@blend_type = @page.graphic.blend_type
@move_type = @page.move_type
@move_speed = @page.move_speed
@move_frequency = @page.move_frequency
@move_route = @page.move_route
@move_route_index = 0
@move_route_forcing = false
@walk_anime = @page.walk_anime
@step_anime = @page.step_anime
@direction_fix = @page.direction_fix
@through = @page.through
@always_on_top = @page.always_on_top
@trigger = @page.trigger
@list = @page.list
@interpreter = nil
if @trigger == 4
@interpreter = Interpreter.new
end
check_event_trigger_auto
end
end