赞 | 13 |
VIP | 320 |
好人卡 | 64 |
积分 | 3 |
经验 | 112963 |
最后登录 | 2022-8-25 |
在线时间 | 2355 小时 |
Lv2.观梦者 (暗夜天使)
- 梦石
- 0
- 星屑
- 266
- 在线时间
- 2355 小时
- 注册时间
- 2009-3-13
- 帖子
- 2309
|
喵呜喵5 发表于 2013-12-11 19:30
我又来定制脚本了......我希望做一个能和跟随在身后的角色对话的效果,具体如下:
1.当主角不朝向跟随角色 ...
class Game_Player def talk_to_follower? if @face_follower @followers[0].turn_toward_player $game_temp.reserve_common_event(1) #设置调用的公共事件 return true else return false end end # def passable?(x, y, d) x2 = $game_map.round_x_with_direction(x, d) y2 = $game_map.round_y_with_direction(y, d) return false unless $game_map.valid?(x2, y2) return true if @through || debug_through? return false if collide_with_follower?(x, y, d) return false unless map_passable?(x, y, d) return false unless map_passable?(x2, y2, reverse_dir(d)) return false if collide_with_characters?(x2, y2) return true end DirSym = [:DOWN, :LEFT, :RIGHT, :UP] def collide_with_follower?(x, y, d) if Input.trigger?(DirSym[d/2 - 1]) if @face_follower @face_follower = false return false else follower = @followers[0] x2 = $game_map.round_x_with_direction(@x, d) y2 = $game_map.round_y_with_direction(@y, d) @face_follower = (follower.visible? && follower.pos?(x2, y2)) return true end else return @face_follower end end def move_straight(d, turn_ok = true) @move_succeed = passable?(@x, @y, d) if @move_succeed @followers.move set_direction(d) @x = $game_map.round_x_with_direction(@x, d) @y = $game_map.round_y_with_direction(@y, d) @real_x = $game_map.x_with_direction(@x, reverse_dir(d)) @real_y = $game_map.y_with_direction(@y, reverse_dir(d)) increase_steps elsif turn_ok set_direction(d) check_event_trigger_touch_front end end # trigger def check_action_event return false if in_airship? check_event_trigger_here([0]) return true if $game_map.setup_starting_event check_event_trigger_there([0,1,2]) return true if $game_map.setup_starting_event return talk_to_follower? end end
class Game_Player
def talk_to_follower?
if @face_follower
@followers[0].turn_toward_player
$game_temp.reserve_common_event(1) #设置调用的公共事件
return true
else
return false
end
end
#
def passable?(x, y, d)
x2 = $game_map.round_x_with_direction(x, d)
y2 = $game_map.round_y_with_direction(y, d)
return false unless $game_map.valid?(x2, y2)
return true if @through || debug_through?
return false if collide_with_follower?(x, y, d)
return false unless map_passable?(x, y, d)
return false unless map_passable?(x2, y2, reverse_dir(d))
return false if collide_with_characters?(x2, y2)
return true
end
DirSym = [:DOWN, :LEFT, :RIGHT, :UP]
def collide_with_follower?(x, y, d)
if Input.trigger?(DirSym[d/2 - 1])
if @face_follower
@face_follower = false
return false
else
follower = @followers[0]
x2 = $game_map.round_x_with_direction(@x, d)
y2 = $game_map.round_y_with_direction(@y, d)
@face_follower = (follower.visible? && follower.pos?(x2, y2))
return true
end
else
return @face_follower
end
end
def move_straight(d, turn_ok = true)
@move_succeed = passable?(@x, @y, d)
if @move_succeed
@followers.move
set_direction(d)
@x = $game_map.round_x_with_direction(@x, d)
@y = $game_map.round_y_with_direction(@y, d)
@real_x = $game_map.x_with_direction(@x, reverse_dir(d))
@real_y = $game_map.y_with_direction(@y, reverse_dir(d))
increase_steps
elsif turn_ok
set_direction(d)
check_event_trigger_touch_front
end
end
# trigger
def check_action_event
return false if in_airship?
check_event_trigger_here([0])
return true if $game_map.setup_starting_event
check_event_trigger_there([0,1,2])
return true if $game_map.setup_starting_event
return talk_to_follower?
end
end
好奇怪的功能{:2_276:}
目前流畅的转身是不会撞到身后的队友,先试试手感吧,默认系统改起来太多蛋疼的地方。 |
评分
-
查看全部评分
|