设为首页收藏本站

仙剑之十里坡

 找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
查看: 3277|回复: 4
打印 上一主题 下一主题

传说中的角色跟随脚本

[复制链接]

160

主题

6

听众

1万

积分

超级版主

蜀山剑侠银行行长

超级版主

  • TA的每日心情
    开心
    昨天 21:35
  • 签到天数: 858 天

    [LV.10]以坛为家III

    精华
    3
    积分
    13202
    历练
    7
    声望
    24
    人气
    2361

    金融巨子 润泽万物 坚若磐石

    单身中……
    帮我摆脱单身吧
    跳转到指定楼层
    1
    发表于 2010-5-23 11:03:26 |只看该作者 |倒序浏览
    1. #==============================================================================
    2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
    3. #==============================================================================


    4. # ————————————————————————————————————

    5. # ▼▲▼ XRXS13. パーティ列車移動 ver.1.02 ▼▲▼
    6. # by fukuyama

    7. #
    8. # Train_Actor
    9. #
    10. # fukuyama@alles.or.jp
    11. # http://www4.big.or.jp/~fukuyama/rgss/Train_Actor.txt
    12. #

    13. module Train_Actor




    14. #是否使用停止跟随的方法,也就是说,这里false改为true的时候,如果TRANSPARENT_SWITCHES_INDEX
    15. #开关打开,跟随的人物就消失了(其实只是变成透明而已)
    16. TRANSPARENT_SWITCH = true
    17. TRANSPARENT_SWITCHES_INDEX = 21
    18. #举例:第一个为true,第二个为21,则打开21号开关,后面的人都没了。





    19. #跟随人数的最大数目,可以更改为2、3什么的。
    20. TRAIN_ACTOR_SIZE_MAX = 4





    21. # 定数
    22. #Input::DOWN = 2
    23. #Input::LEFT = 4
    24. #Input::RIGHT = 6
    25. #Input::UP = 6
    26. DOWN_LEFT = 1
    27. DOWN_RIGHT = 3
    28. UP_LEFT = 7
    29. UP_RIGHT = 9
    30. JUMP = 5

    31. class Game_Party_Actor < Game_Character
    32. def initialize
    33. super()
    34. @through = true
    35. end
    36. def setup(actor)
    37. # キャラクターのファイル名と色相を設定
    38. if actor != nil
    39. @character_name = actor.character_name
    40. @character_hue = actor.character_hue
    41. else
    42. @character_name = ""
    43. @character_hue = 0
    44. end
    45. # 不透明度と合成方法を初期化
    46. @opacity = 255
    47. @blend_type = 0
    48. end
    49. def screen_z(height = 0)
    50. if $game_player.x == @x and $game_player.y == @y
    51. return $game_player.screen_z(height) - 1
    52. end
    53. super(height)
    54. end
    55. #--------------------------------------------------------------------------
    56. # ● 下に移動
    57. # turn_enabled : その場での向き変更を許可するフラグ
    58. #--------------------------------------------------------------------------
    59. def move_down(turn_enabled = true)
    60. # 下を向く
    61. if turn_enabled
    62. turn_down
    63. end
    64. # 通行可能な場合
    65. if passable?(@x, @y, Input::DOWN)
    66. # 下を向く
    67. turn_down
    68. # 座標を更新
    69. @y += 1
    70. end
    71. end
    72. #--------------------------------------------------------------------------
    73. # ● 左に移動
    74. # turn_enabled : その場での向き変更を許可するフラグ
    75. #--------------------------------------------------------------------------
    76. def move_left(turn_enabled = true)
    77. # 左を向く
    78. if turn_enabled
    79. turn_left
    80. end
    81. # 通行可能な場合
    82. if passable?(@x, @y, Input::LEFT)
    83. # 左を向く
    84. turn_left
    85. # 座標を更新
    86. @x -= 1
    87. end
    88. end
    89. #--------------------------------------------------------------------------
    90. # ● 右に移動
    91. # turn_enabled : その場での向き変更を許可するフラグ
    92. #--------------------------------------------------------------------------
    93. def move_right(turn_enabled = true)
    94. # 右を向く
    95. if turn_enabled
    96. turn_right
    97. end
    98. # 通行可能な場合
    99. if passable?(@x, @y, Input::RIGHT)
    100. # 右を向く
    101. turn_right
    102. # 座標を更新
    103. @x += 1
    104. end
    105. end
    106. #--------------------------------------------------------------------------
    107. # ● 上に移動
    108. # turn_enabled : その場での向き変更を許可するフラグ
    109. #--------------------------------------------------------------------------
    110. def move_up(turn_enabled = true)
    111. # 上を向く
    112. if turn_enabled
    113. turn_up
    114. end
    115. # 通行可能な場合
    116. if passable?(@x, @y, Input::UP)
    117. # 上を向く
    118. turn_up
    119. # 座標を更新
    120. @y -= 1
    121. end
    122. end
    123. #--------------------------------------------------------------------------
    124. # ● 左下に移動
    125. #--------------------------------------------------------------------------
    126. def move_lower_left
    127. # 向き固定でない場合
    128. unless @direction_fix
    129. # 右向きだった場合は左を、上向きだった場合は下を向く
    130. @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::UP ? Input::DOWN : @direction)
    131. end
    132. # 下→左、左→下 のどちらかのコースが通行可能な場合
    133. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
    134. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
    135. # 座標を更新
    136. @x -= 1
    137. @y += 1
    138. end
    139. end
    140. #--------------------------------------------------------------------------
    141. # ● 右下に移動
    142. #--------------------------------------------------------------------------
    143. def move_lower_right
    144. # 向き固定でない場合
    145. unless @direction_fix
    146. # 左向きだった場合は右を、上向きだった場合は下を向く
    147. @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
    148. end
    149. # 下→右、右→下 のどちらかのコースが通行可能な場合
    150. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
    151. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
    152. # 座標を更新
    153. @x += 1
    154. @y += 1
    155. end
    156. end
    157. #--------------------------------------------------------------------------
    158. # ● 左上に移動
    159. #--------------------------------------------------------------------------
    160. def move_upper_left
    161. # 向き固定でない場合
    162. unless @direction_fix
    163. # 右向きだった場合は左を、下向きだった場合は上を向く
    164. @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
    165. end
    166. # 上→左、左→上 のどちらかのコースが通行可能な場合
    167. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
    168. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
    169. # 座標を更新
    170. @x -= 1
    171. @y -= 1
    172. end
    173. end
    174. #--------------------------------------------------------------------------
    175. # ● 右上に移動
    176. #--------------------------------------------------------------------------
    177. def move_upper_right
    178. # 向き固定でない場合
    179. unless @direction_fix
    180. # 左向きだった場合は右を、下向きだった場合は上を向く
    181. @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
    182. end
    183. # 上→右、右→上 のどちらかのコースが通行可能な場合
    184. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
    185. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
    186. # 座標を更新
    187. @x += 1
    188. @y -= 1
    189. end
    190. end
    191. attr_writer :move_speed
    192. attr_writer :step_anime
    193. end
    194. module Spriteset_Map_Module
    195. def setup_actor_character_sprites?
    196. return @setup_actor_character_sprites_flag != nil
    197. end
    198. def setup_actor_character_sprites(characters)
    199. if !setup_actor_character_sprites?
    200. index_game_player = 0
    201. @character_sprites.each_index do |i|
    202. if @character_sprites[i].character.instance_of?(Game_Player)
    203. index_game_player = i
    204. break
    205. end
    206. end
    207. for character in characters.reverse
    208. @character_sprites.unshift(
    209. Sprite_Character.new(@viewport1, character)
    210. )
    211. end
    212. @setup_actor_character_sprites_flag = true
    213. end
    214. end
    215. end
    216. module Scene_Map_Module
    217. def setup_actor_character_sprites(characters)
    218. @spriteset.setup_actor_character_sprites(characters)
    219. end
    220. end
    221. module Game_Party_Module
    222.   
    223.   def return_char(i)
    224.     return @characters[i]
    225.   end
    226.   
    227. def set_transparent_actors(transparent)
    228. @transparent = transparent
    229. end
    230. def setup_actor_character_sprites
    231. if @characters == nil
    232. @characters = []
    233. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
    234. @characters.push(Game_Party_Actor.new)
    235. end
    236. end
    237. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
    238. @characters[i - 1].setup(actors[i])
    239. end
    240. if $scene.class.method_defined?('setup_actor_character_sprites')
    241. $scene.setup_actor_character_sprites(@characters)
    复制代码
    分享到: QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    转播转播0 分享淘帖0 分享分享0 收藏收藏0

    160

    主题

    6

    听众

    1万

    积分

    超级版主

    蜀山剑侠银行行长

    超级版主

  • TA的每日心情
    开心
    昨天 21:35
  • 签到天数: 858 天

    [LV.10]以坛为家III

    精华
    3
    积分
    13202
    历练
    7
    声望
    24
    人气
    2361

    金融巨子 润泽万物 坚若磐石

    单身中……
    帮我摆脱单身吧
    2
    发表于 2010-5-23 11:03:49 |只看该作者
    1. end
    2. end
    3. def update_party_actors
    4. setup_actor_character_sprites
    5. transparent = $game_player.transparent
    6. if transparent == false
    7. if TRANSPARENT_SWITCH
    8. transparent = $game_switches[TRANSPARENT_SWITCHES_INDEX]
    9. end
    10. end
    11. for character in @characters
    12. character.transparent = transparent
    13. character.move_speed = $game_player.move_speed
    14. character.step_anime = $game_player.step_anime
    15. character.update
    16. end
    17. end
    18. def moveto_party_actors( x, y )
    19. setup_actor_character_sprites
    20. for character in @characters
    21. character.moveto( x, y )
    22. end
    23. if @move_list == nil
    24. @move_list = []
    25. end
    26. move_list_setup
    27. end
    28. def move_party_actors
    29. if @move_list == nil
    30. @move_list = []
    31. move_list_setup
    32. end
    33. @move_list.each_index do |i|
    34. if @characters[i] != nil
    35. case @move_list[i].type
    36. when Input::DOWN
    37. @characters[i].move_down(@move_list[i].args[0])
    38. when Input::LEFT
    39. @characters[i].move_left(@move_list[i].args[0])
    40. when Input::RIGHT
    41. @characters[i].move_right(@move_list[i].args[0])
    42. when Input::UP
    43. @characters[i].move_up(@move_list[i].args[0])
    44. when DOWN_LEFT
    45. @characters[i].move_lower_left
    46. when DOWN_RIGHT
    47. @characters[i].move_lower_right
    48. when UP_LEFT
    49. @characters[i].move_upper_left
    50. when UP_RIGHT
    51. @characters[i].move_upper_right
    52. when JUMP
    53. @characters[i].jump(@move_list[i].args[0],@move_list[i].args[1])
    54. end
    55. end
    56. end
    57. end
    58. class Move_List_Element
    59. def initialize(type,args)
    60. @type = type
    61. @args = args
    62. end
    63. def type() return @type end
    64. def args() return @args end
    65. end
    66. def move_list_setup
    67. for i in 0 .. TRAIN_ACTOR_SIZE_MAX
    68. @move_list[i] = nil
    69. end
    70. end
    71. def add_move_list(type,*args)
    72. @move_list.unshift(Move_List_Element.new(type,args)).pop
    73. end
    74. def move_down_party_actors(turn_enabled = true)
    75. move_party_actors
    76. add_move_list(Input::DOWN,turn_enabled)
    77. end
    78. def move_left_party_actors(turn_enabled = true)
    79. move_party_actors
    80. add_move_list(Input::LEFT,turn_enabled)
    81. end
    82. def move_right_party_actors(turn_enabled = true)
    83. move_party_actors
    84. add_move_list(Input::RIGHT,turn_enabled)
    85. end
    86. def move_up_party_actors(turn_enabled = true)
    87. move_party_actors
    88. add_move_list(Input::UP,turn_enabled)
    89. end
    90. def move_lower_left_party_actors
    91. move_party_actors
    92. add_move_list(DOWN_LEFT)
    93. end
    94. def move_lower_right_party_actors
    95. move_party_actors
    96. add_move_list(DOWN_RIGHT)
    97. end
    98. def move_upper_left_party_actors
    99. move_party_actors
    100. add_move_list(UP_LEFT)
    101. end
    102. def move_upper_right_party_actors
    103. move_party_actors
    104. add_move_list(UP_RIGHT)
    105. end
    106. def jump_party_actors(x_plus, y_plus)
    107. move_party_actors
    108. add_move_list(JUMP,x_plus, y_plus)
    109. end
    110. end
    111. module Game_Player_Module
    112. def update
    113. $game_party.update_party_actors
    114. super
    115. end
    116. def moveto( x, y )
    117. $game_party.moveto_party_actors( x, y )
    118. super( x, y )
    119. end
    120. def move_down(turn_enabled = true)
    121. if passable?(@x, @y, Input::DOWN)
    122. $game_party.move_down_party_actors(turn_enabled)
    123. end
    124. super(turn_enabled)
    125. end
    126. def move_left(turn_enabled = true)
    127. if passable?(@x, @y, Input::LEFT)
    128. $game_party.move_left_party_actors(turn_enabled)
    129. end
    130. super(turn_enabled)
    131. end
    132. def move_right(turn_enabled = true)
    133. if passable?(@x, @y, Input::RIGHT)
    134. $game_party.move_right_party_actors(turn_enabled)
    135. end
    136. super(turn_enabled)
    137. end
    138. def move_up(turn_enabled = true)
    139. if passable?(@x, @y, Input::UP)
    140. $game_party.move_up_party_actors(turn_enabled)
    141. end
    142. super(turn_enabled)
    143. end
    144. def move_lower_left
    145. # 下→左、左→下 のどちらかのコースが通行可能な場合
    146. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
    147. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
    148. $game_party.move_lower_left_party_actors
    149. end
    150. super
    151. end
    152. def move_lower_right
    153. # 下→右、右→下 のどちらかのコースが通行可能な場合
    154. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
    155. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
    156. $game_party.move_lower_right_party_actors
    157. end
    158. super
    159. end
    160. def move_upper_left
    161. # 上→左、左→上 のどちらかのコースが通行可能な場合
    162. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
    163. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
    164. $game_party.move_upper_left_party_actors
    165. end
    166. super
    167. end
    168. def move_upper_right
    169. # 上→右、右→上 のどちらかのコースが通行可能な場合
    170. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
    171. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
    172. $game_party.move_upper_right_party_actors
    173. end
    174. super
    175. end
    176. def jump(x_plus, y_plus)
    177. # 新しい座標を計算
    178. new_x = @x + x_plus
    179. new_y = @y + y_plus
    180. # 加算値が (0,0) の場合か、ジャンプ先が通行可能な場合
    181. if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
    182. $game_party.jump_party_actors(x_plus, y_plus)
    183. end
    184. super(x_plus, y_plus)
    185. end
    186. attr_reader :move_speed
    187. attr_reader :step_anime
    188. end
    189. end # module Train_Actor
    190. class Game_Party
    191. include Train_Actor::Game_Party_Module
    192. end
    193. class Game_Player
    194. include Train_Actor::Game_Player_Module
    195. end
    196. class Spriteset_Map
    197. include Train_Actor::Spriteset_Map_Module
    198. end
    199. class Scene_Map
    200. include Train_Actor::Scene_Map_Module
    201. end

    202. #==============================================================================
    203. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
    204. #==============================================================================
    复制代码
    于是饮酒乐甚,扣舷而歌之。歌曰:“桂棹兮兰桨,击空明兮溯流光。残阳阳兮是羊羊,吾乃最爱南宫煌。”
    回复

    使用道具 举报

    160

    主题

    6

    听众

    1万

    积分

    超级版主

    蜀山剑侠银行行长

    超级版主

  • TA的每日心情
    开心
    昨天 21:35
  • 签到天数: 858 天

    [LV.10]以坛为家III

    精华
    3
    积分
    13202
    历练
    7
    声望
    24
    人气
    2361

    金融巨子 润泽万物 坚若磐石

    单身中……
    帮我摆脱单身吧
    3
    发表于 2010-5-23 11:04:20 |只看该作者
    太长了,只好分两半。
    话说这个脚本可以让队友跟在猪脚后面走,打开21号开关可以暂时隐藏队友,话中这个脚本网上很多人在找,但是找到的总是不好用,我把好用的发在这里,大家拿去用吧。
    于是饮酒乐甚,扣舷而歌之。歌曰:“桂棹兮兰桨,击空明兮溯流光。残阳阳兮是羊羊,吾乃最爱南宫煌。”
    回复

    使用道具 举报

    32

    主题

    2

    听众

    3354

    积分

    威镇一方

    英俊潇洒、风流倜傥的无敌斑竹

    会员等级: 6

  • TA的每日心情
    无聊
    2013-2-27 21:53
  • 签到天数: 321 天

    [LV.8]以坛为家I

    精华
    1
    积分
    3354
    历练
    3
    声望
    45
    人气
    617

    黑色羽翼 神仙眷侣

    寻仙
    幸福:48℃
    4
    发表于 2010-5-23 20:52:08 |只看该作者
    这个脚本是我初学RM的时候就有的三个脚本之一.....
    不过还是辛苦了....
    回复

    使用道具 举报

    160

    主题

    6

    听众

    1万

    积分

    超级版主

    蜀山剑侠银行行长

    超级版主

  • TA的每日心情
    开心
    昨天 21:35
  • 签到天数: 858 天

    [LV.10]以坛为家III

    精华
    3
    积分
    13202
    历练
    7
    声望
    24
    人气
    2361

    金融巨子 润泽万物 坚若磐石

    单身中……
    帮我摆脱单身吧
    5
    发表于 2010-5-23 21:24:19 |只看该作者
    话说网上很多人找呢……
    于是饮酒乐甚,扣舷而歌之。歌曰:“桂棹兮兰桨,击空明兮溯流光。残阳阳兮是羊羊,吾乃最爱南宫煌。”
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 加入我们

    手机版|Archiver|仙剑之十里坡 ( 苏ICP备11022766号 )  

    GMT+8, 2024-4-29 20:10 , Processed in 0.571759 second(s), 40 queries .

    Powered by Discuz! X2.5

    © 2001-2012 Comsenz Inc.

    回顶部