赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 540 |
最后登录 | 2018-9-22 |
在线时间 | 0 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 55
- 在线时间
- 0 小时
- 注册时间
- 2007-12-16
- 帖子
- 77
|
if $game_switches[1] == true #开关1打开时 执行这个脚本,这是我加的
class Game_Event
attr_accessor :flag
end
class Game_Map
#--------------------------------------------------------------------------
# ● 检查鼠标处是否有自定义的事件并返回类型
#--------------------------------------------------------------------------
def check_event_custom(mouse_x, mouse_y)
for event in $game_map.events.values #循环所有事件检查
event_width = RPG::Cache.character(event.character_name,event.character_hue).width / 4
event_height = RPG::Cache.character(event.character_name,event.character_hue).height / 4
if mouse_x > event.screen_x - event_width / 2 and mouse_x < event.screen_x + event_width / 2 and mouse_y + 32 > event.screen_y + 32 - event_height and mouse_y + 32 < event.screen_y + 32
for i in 0...event.list.size
if event.list.parameters[0] == "Item" #类型判断
event.flag = 1
elsif event.list.parameters[0] == "Npc" #类型判断
event.flag = 2
else
event.flag = 0 if $game_player.get_mouse_sta != 2 #无标志
end
return event.flag #返回事件类型标志
end
end
end
return 0 if $game_player.get_mouse_sta != 2 #如果不是在跟随鼠标状态,则返回无标志
return $mouse_icon_id #使鼠标图不变化
end
#--------------------------------------------------------------------------
# ● 检查鼠标处是否有事件可以开启
#--------------------------------------------------------------------------
def check_event_custom_start(mouse_x, mouse_y)
for event in $game_map.events.values #循环所有事件检查
#事件角色图片宽度、高度
event_width = RPG::Cache.character(event.character_name,event.character_hue).width/4
event_height = RPG::Cache.character(event.character_name,event.character_hue).height/4
#判断是否鼠标在事件上
if mouse_x > event.screen_x - event_width / 2 and mouse_x < event.screen_x + event_width / 2 and mouse_y + 32 > event.screen_y + 32 - event_height and mouse_y + 32 < event.screen_y + 32
way_x = $game_player.x - event.x
way_y = $game_player.y - event.y
if ([1, -1].include?($game_player.x-event.x) and $game_player.y-event.y == 0) or ([1, -1].include?($game_player.y-event.y) and $game_player.x-event.x == 0)
for i in 0...event.list.size
if ["Item","Npc"].include?(event.list.parameters[0]) #当事件属于自定义事件
#判断主角朝向
if way_x == -1
p_direction = 6 if way_y == 0
elsif way_x == 0
p_direction = 2 if way_y == -1
p_direction = 8 if way_y == 1
else
p_direction = 4 if way_y == 0
end
event.start #开启事件
return 1, p_direction #返回即将开启事件以及角色朝向
end
end
end
end
end
return 0, 5 #返回不会开启事件以及角色朝向不变
end
else
end
我这样加后.....提示 第一行错误 |
|