赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 0 |
经验 | 0 |
最后登录 | 2009-8-25 |
在线时间 | 0 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 140
- 在线时间
- 0 小时
- 注册时间
- 2009-8-24
- 帖子
- 2
|
2楼
楼主 |
发表于 2009-8-28 15:36:00
|
只看该作者
脚本发生了NoMethodError
出错的是人物跟随的脚本。
之前测试没有出错,但是再次测试的时候系统提示脚本出错。(这个是朋友的游戏)
因为朋友使用的脚本和我的不同...所以请教一下大家~
————————————————
class Game_Character
attr_accessor :move_speed
end
class Game_Map
attr_accessor :oldroute
attr_accessor :oldeventsnums
attr_reader :map
alias initialize_old initialize
def initialize
initialize_old
@oldroute = []
@oldeventsnums = 0
end
end
class Game_Player < Game_Character
alias update_old update
def update
last_moving = moving?
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
case Input.dir4
when 2
if passable?(@x, @y, 2)
$game_map.oldroute.push([@x,@y,2])
if $game_map.oldroute.size == $game_party.actors.size
$game_map.oldroute.shift
end
end
move_down
when 4
if passable?(@x, @y, 4)
$game_map.oldroute.push([@x,@y,4])
if $game_map.oldroute.size == $game_party.actors.size
$game_map.oldroute.shift
end
end
move_left
when 6
if passable?(@x, @y, 6)
$game_map.oldroute.push([@x,@y,6])
if $game_map.oldroute.size == $game_party.actors.size
$game_map.oldroute.shift
end
end
move_right
when 8
if passable?(@x, @y, 8)
$game_map.oldroute.push([@x,@y,8])
if $game_map.oldroute.size == $game_party.actors.size
$game_map.oldroute.shift
end
end
move_up
end
end
update_old
end
end
class Interpreter
def command_129
actor = $game_actors[@parameters[0]]
if actor != nil
if @parameters[1] == 0
if @parameters[2] == 1
$game_actors[@parameters[0]].setup(@parameters[0])
end
$game_party.add_actor(@parameters[0])
$scene.del_follow
$scene.follow_system
else
$game_party.remove_actor(@parameters[0])
$scene.del_follow
$scene.follow_system
end
end
return true
end
end
class Scene_Map
alias main_old main
def main
@spriteset = Spriteset_Map.new
if $game_variables[1000] == 0
follow_system
$game_variables[1000] = 1
end
main_old
end
alias update_old update
def update
follow_system_update
update_old
end
alias transfer_player_old transfer_player
def transfer_player
$game_temp.player_transferring = false
if $game_map.map_id != $game_temp.player_new_map_id
del_follow
$game_map.setup($game_temp.player_new_map_id)
end
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
follow_system
transfer_player_old
end
def follow_system
$game_map.oldeventsnums = $game_map.events.size
if $game_party.actors.size>=2
for i in 2..$game_party.actors.size
# 为事件加上名字考虑做srpg用
name = "队伍,"+i.to_s
character_name = $game_party.actors[i-1].character_name
party_event($game_player.x,$game_player.y,name,character_name)
$game_map.oldroute.push([$game_player.x,$game_player.y,$game_player.direction])
end
end
end
def del_follow
$game_map.oldroute.clear
for i in 1..($game_map.events.size-$game_map.oldeventsnums)
$game_map.events.delete($game_map.oldeventsnums+i)
end
end
def party_event(x,y,name,character_name)
$game_map.events[$game_map.events.size+1] = Game_Event.new($game_map.map_id,produce_party_event(x,y,name,character_name))
$game_map.map.events[$game_map.events.size] = produce_party_event(x,y,name,character_name)
@spriteset.dispose
@spriteset = Spriteset_Map.new
end
def produce_party_event(x,y,name,character_name)
e = RPG::Event.new(x,y)
e.id = $game_map.events.size
e.name = name
e.pages = [RPG::Event::Page.new]
e.pages[0].graphic = RPG::Event::Page::Graphic.new
e.pages[0].graphic.character_name = character_name
e.pages[0].through = true
return e
end
def follow_system_update
num = $game_map.oldeventsnums
n = $game_player.move_speed
s=$game_map.oldroute.size-1
if s>=0
$game_map.events[num+1].move_speed = n
if $game_map.events[num+1].x>$game_map.oldroute[0]
$game_map.events[num+1].move_left
elsif $game_map.events[num+1].x<$game_map.oldroute[0]
$game_map.events[num+1].move_right
elsif $game_map.events[num+1].y>$game_map.oldroute[1]
$game_map.events[num+1].move_up
elsif $game_map.events[num+1].y<$game_map.oldroute[1]
$game_map.events[num+1].move_down
end
end
if s>=1
$game_map.events[num+2].move_speed = n
if $game_map.events[num+2].x>$game_map.oldroute[s-1][0]
$game_map.events[num+2].move_left
elsif $game_map.events[num+2].x<$game_map.oldroute[s-1][0]
$game_map.events[num+2].move_right
elsif $game_map.events[num+2].y>$game_map.oldroute[s-1][1]
$game_map.events[num+2].move_up
elsif $game_map.events[num+2].y<$game_map.oldroute[s-1][1]
$game_map.events[num+2].move_down
end
end
if s>=2
$game_map.events[num+3].move_speed = n(显示出错的179行)
if $game_map.events[num+3].x>$game_map.oldroute[s-2][0]
$game_map.events[num+3].move_left
elsif $game_map.events[num+3].x<$game_map.oldroute[s-2][0]
$game_map.events[num+3].move_right
elsif $game_map.events[num+3].y>$game_map.oldroute[s-2][1]
$game_map.events[num+3].move_up
elsif $game_map.events[num+3].y<$game_map.oldroute[s-2][1]
$game_map.events[num+3].move_down
end
end
if s>=3
$game_map.events[num+4].move_speed = n
if $game_map.events[num+4].x>$game_map.oldroute[s-3][0]
$game_map.events[num+4].move_left
elsif $game_map.events[num+4].x<$game_map.oldroute[s-3][0]
$game_map.events[num+4].move_right
elsif $game_map.events[num+4].y>$game_map.oldroute[s-3][1]
$game_map.events[num+4].move_up
elsif $game_map.events[num+4].y<$game_map.oldroute[s-3][1]
$game_map.events[num+4].move_down
end
end
if s>=4
$game_map.events[num+5].move_speed = n
if $game_map.events[num+5].x>$game_map.oldroute[s-4][0]
$game_map.events[num+5].move_left
elsif $game_map.events[num+5].x<$game_map.oldroute[s-4][0]
$game_map.events[num+5].move_right
elsif $game_map.events[num+5].y>$game_map.oldroute[s-4][1]
$game_map.events[num+5].move_up
elsif $game_map.events[num+5].y<$game_map.oldroute[s-4][1]
$game_map.events[num+5].move_down
end
end
end
end |
|