本帖最后由 howhow1314 于 2015-3-31 12:11 编辑
class Game_Followers def initialize(leader) @visible = $data_system.opt_followers @gathering = false # 集合處理中的標志 @leader = leader @data = [] @mama = [] end def yooo_very_fresh $game_player.refresh SceneManager.scene.spriteset.refresh_characters end def jj(aid) @data == [] ? p = @leader : p = @data[-1] @data.push(Game_Follower.new(aid, p)) @mama[aid] = [] unless @mama[aid] @mama[aid].push(@data[-1]) msgbox @mama[aid].size @data[-1].moveto($game_player.x, $game_player.y) yooo_very_fresh end def cut_jj(aid) @data.delete(@mama[aid][0]) @mama[aid][0] = nil @mama[aid].compact! @data.each_with_index do |baby, i| i == 0 ? baby.preceding_character = @leader : baby.preceding_character = @data[i-1] end yooo_very_fresh end end class Game_Follower < Game_Character attr_writer :preceding_character def actor $game_actors[@member_index] end end class Scene_Map < Scene_Base attr_reader :spriteset end
class Game_Followers
def initialize(leader)
@visible = $data_system.opt_followers
@gathering = false # 集合處理中的標志
@leader = leader
@data = []
@mama = []
end
def yooo_very_fresh
$game_player.refresh
SceneManager.scene.spriteset.refresh_characters
end
def jj(aid)
@data == [] ? p = @leader : p = @data[-1]
@data.push(Game_Follower.new(aid, p))
@mama[aid] = [] unless @mama[aid]
@mama[aid].push(@data[-1])
msgbox @mama[aid].size
@data[-1].moveto($game_player.x, $game_player.y)
yooo_very_fresh
end
def cut_jj(aid)
@data.delete(@mama[aid][0])
@mama[aid][0] = nil
@mama[aid].compact!
@data.each_with_index do |baby, i|
i == 0 ? baby.preceding_character = @leader : baby.preceding_character = @data[i-1]
end
yooo_very_fresh
end
end
class Game_Follower < Game_Character
attr_writer :preceding_character
def actor
$game_actors[@member_index]
end
end
class Scene_Map < Scene_Base
attr_reader :spriteset
end
$game_player.followers.jj(角色id) #加入尾隨角色 $game_player.followers.cut_jj(角色id) #移除尾隨角色 (多於一個相同編號角色時移除先加入的)
$game_player.followers.jj(角色id) #加入尾隨角色
$game_player.followers.cut_jj(角色id) #移除尾隨角色 (多於一個相同編號角色時移除先加入的)
還有就是,隊伍成員會尾隨了~ |