Project1
标题:
脚本简单问题
[打印本页]
作者:
黑舞嗜
时间:
2011-10-3 21:51
标题:
脚本简单问题
本帖最后由 黑舞嗜 于 2011-10-3 21:53 编辑
我有个脚本貌似有点冲突,然后我把Game_Event的41与43行(默认的脚本)删掉以后就不会冲突了
请问删掉这两段有什么影响么?
(下面是默认的脚本)
#==============================================================================
# ■ Game_Event
#------------------------------------------------------------------------------
# 处理事件的类。条件判断、事件页的切换、并行处理、执行事件功能
# 在 Game_Map 类的内部使用。
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :trigger # 触发条件
attr_reader :list # 执行内容
attr_reader :starting # 启动中标志
#--------------------------------------------------------------------------
# ● 初始化对像
# map_id : 地图 ID
# event : 事件 (RPG::Event)
#--------------------------------------------------------------------------
def initialize(map_id, event)
super()
@map_id = map_id
@event = event
@id = @event.id
@erased = false
@starting = false
@through = true
moveto(@event.x, @event.y) # 初期位置的移动
refresh
end
#--------------------------------------------------------------------------
# ● 清除启动中标志
#--------------------------------------------------------------------------
def clear_starting
@starting = false
end
#--------------------------------------------------------------------------
# ● 启动事件
#--------------------------------------------------------------------------
def start
return if @list.size <= 1 # 执行内容不为空的情况下
@starting = true
lock if @trigger < 3
unless $game_map.interpreter.running?
$game_map.interpreter.setup_starting_event
end
end
#--------------------------------------------------------------------------
# ● 暂时消失
#--------------------------------------------------------------------------
def erase
@erased = true
refresh
end
#--------------------------------------------------------------------------
# ● 判断事件页出现条件
#--------------------------------------------------------------------------
def conditions_met?(page)
c = page.condition
if c.switch1_valid # 开关1
return false if $game_switches[c.switch1_id] == false
end
if c.switch2_valid # 开关2
return false if $game_switches[c.switch2_id] == false
end
if c.variable_valid # 变量
return false if $game_variables[c.variable_id] < c.variable_value
end
if c.self_switch_valid # 独立开关
key = [@map_id, @event.id, c.self_switch_ch]
return false if $game_self_switches[key] != true
end
if c.item_valid # 物品
item = $data_items[c.item_id]
return false if $game_party.item_number(item) == 0
end
if c.actor_valid # 角色
actor = $game_actors[c.actor_id]
return false unless $game_party.members.include?(actor)
end
return true # 条件符合
end
#--------------------------------------------------------------------------
# ● 设置事件页
#--------------------------------------------------------------------------
def setup(new_page)
@page = new_page
if @page == nil
@tile_id = 0
@character_name = ""
@character_index = 0
@move_type = 0
@through = true
@trigger = nil
@list = nil
@interpreter = nil
else
@tile_id = @page.graphic.tile_id
@character_name = @page.graphic.character_name
@character_index = @page.graphic.character_index
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
@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
@priority_type = @page.priority_type
@trigger = @page.trigger
@list = @page.list
@interpreter = nil
if @trigger == 4 # 触发条件为「并行处理」
@interpreter = Game_Interpreter.new # 生成并行处理用解释器
end
end
update_bush_depth
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
new_page = nil
unless @erased # 非暂时消除的情况下
for page in @event.pages.reverse # 从编号大的事件页按顺序调查
next unless conditions_met?(page) # 判断开始条件只否符合
new_page = page
break
end
end
if new_page != @page # 与上次不同一事件页的情况下
clear_starting # 清除启动中标志
setup(new_page) # 设置新事件页
check_event_trigger_auto # 自动事件启动判定
end
end
#--------------------------------------------------------------------------
# ● 接触事件启动判定
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
return if $game_map.interpreter.running?
x += $game_map.width if $game_map.loop_horizontal? and x < 0
y += $game_map.height if $game_map.loop_vertical? and y < 0
if @trigger == 2 and $game_player.pos?(x, y)
start if not jumping? and @priority_type == 1
end
end
#--------------------------------------------------------------------------
# ● 自动事件启动判定
#--------------------------------------------------------------------------
def check_event_trigger_auto
start if @trigger == 3
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
check_event_trigger_auto # 自动事件启动判定
if @interpreter != nil # 并行处理的情况下
unless @interpreter.running? # 不在执行中的场合的情况下
@interpreter.setup(@list, @event.id) # 设置事件
end
@interpreter.update # 更新解释器
end
end
end
复制代码