| 赞 | 58 |
| VIP | |
| 好人卡 | |
| 积分 | 12 |
| 经验 | |
| 最后登录 | 2023-5-29 |
| 在线时间 | 1017 小时 |
- 梦石
- 0
- 星屑
- 1232
- 在线时间
- 1017 小时
- 注册时间
- 2011-4-30
- 回帖
- 1464
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 汪汪 于 2015-4-18 16:51 编辑
额,看起来好像没有这种功能的脚本。。。
然后又被设置事件的开关弄迷糊了。所以有了这个。
如果本脚本涉嫌侵权啊,抄袭啊,或者有bug啊,请告知。{:8_459:}
额,不要在意奇特的变量名,不要在意奇特的方法名。请随便更改成更好的命名
[pre lang="ruby"]class Game_Event < Game_Character
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :trigger # 目标
attr_reader :list # 执行内容
attr_reader :starting # 启动中标志
attr_accessor :pagenum #事件页的编号
attr_accessor :startpage #要转到的事件页编号
#--------------------------------------------------------------------------
# ● 初始化对像
# 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)
@pagenum = nil
@startpage = 0
refresh
end
#--------------------------------------------------------------------------
# ● 启动事件
#--------------------------------------------------------------------------
# 启动事件的某事件页
def start(num = nil)
@startpage = num if num != nil
refresh if num != nil
# 执行内容不为空的情况下
if @list != nil and @list.size > 1
@starting = true
end
end
# 变成事件的某事件页
def stpage(num = nil)
@startpage = num if num != nil
refresh if num != nil
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
# 初始化本地变量 new_page
new_page = nil
# 无法暂时消失的情况下
unless @erased
# 从编号大的事件页按顺序调查
@pagenum = @event.pages.size + 1
for page in @event.pages.reverse
@pagenum -= 1
new_page = page if @startpage == @pagenum
break if @startpage == @pagenum
next if @startpage != 0
# 可以参考事件条件 c
c = page.condition
# 确认开关条件 1
if c.switch1_valid
if $game_switches[c.switch1_id] == false
next
end
end
# 确认开关条件 2
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
new_page = page
# 跳出循环
break
end
end
# 与上次同一事件页的情况下
if new_page == @page
# 过程结束
return
end
# @page 设置为现在的事件页
@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[/pre]
新人求关照。
{:8_457:} |
-
-
例子.zip
202.42 KB, 下载次数: 114
例子
|