Project1

标题: 我想让NPC跟随我,要怎么弄呢 [打印本页]

作者: ejenyang    时间: 2008-3-9 08:20
标题: 我想让NPC跟随我,要怎么弄呢
{/pz}不是加为队友的那种,就是普通的NPC
比如要我保护他到一个地方之类的
这种NPC能弄成跟随着吗 [LINE]1,#dddddd[/LINE]版务信息:本贴由楼主自主结贴~
作者: 水迭澜    时间: 2008-3-9 08:22
可以的,让他加入队伍,但不参加战斗就可以
http://rpg.blue/web/htm/news854.htm
不过要想不在菜单里显示....orz我觉得改原版脚本MS更容易...等达人吧
实在不行你才用这方法凑合着
作者: Iselia雪    时间: 2008-3-9 08:31
提示: 作者被禁止或删除 内容自动屏蔽
作者: ejenyang    时间: 2008-3-9 09:10
{/pz}好象看不太懂。。。。。怎么让他加入队伍不参加战斗呢
作者: 劍之飛龍☆    时间: 2008-3-9 19:09
在战斗处理之前离开队伍……
作者: havealook    时间: 2008-3-9 19:50
首先,把下列脚本插入到main之前:
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================


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

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

  7. # 分开一段距离跟随
  8. # by 叶子
  9. #
  10. # Train_Actor
  11. #
  12. # [email protected]
  13. # http://www4.big.or.jp/~fukuyama/rgss/Train_Actor.txt
  14. #

  15. module Train_Actor




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




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


  23. # 跟随距离,例如0为紧贴,1为分开一个身位
  24. TRAIN_ACTOR_DISTANCE = 0



  25. # 定数
  26. #Input::DOWN = 2
  27. #Input::LEFT = 4
  28. #Input::RIGHT = 6
  29. #Input::UP = 6
  30. DOWN_LEFT = 1
  31. DOWN_RIGHT = 3
  32. UP_LEFT = 7
  33. UP_RIGHT = 9
  34. JUMP = 5

  35. # 叶子到此一游
  36. # 插入空角色,造成分开一段距离跟随的假象
  37. TRAIN_ACTOR_SIZE_MAX = TRAIN_ACTOR_SIZE_MAX * (TRAIN_ACTOR_DISTANCE+1) + 1
  38. class Game_Party_Actor < Game_Character
  39. def initialize
  40. super()
  41. @through = true
  42. end
  43. def setup(actor)
  44. # キャラクターのファイル名と色相を設定
  45. if actor != nil
  46. @character_name = actor.character_name
  47. @character_hue = actor.character_hue
  48. else
  49. @character_name = ""
  50. @character_hue = 0
  51. end
  52. # 不透明度と合成方法を初期化
  53. @opacity = 255
  54. @blend_type = 0
  55. end
  56. def screen_z(height = 0)
  57. if $game_player.x == @x and $game_player.y == @y
  58. return $game_player.screen_z(height) - 1
  59. end
  60. super(height)
  61. end
  62. #--------------------------------------------------------------------------
  63. # ● 下に移動
  64. # turn_enabled : その場での向き変更を許可するフラグ
  65. #--------------------------------------------------------------------------
  66. def move_down(turn_enabled = true)
  67. # 下を向く
  68. if turn_enabled
  69. turn_down
  70. end
  71. # 通行可能な場合
  72. if passable?(@x, @y, Input::DOWN)
  73. # 下を向く
  74. turn_down
  75. # 座標を更新
  76. @y += 1
  77. end
  78. end
  79. #--------------------------------------------------------------------------
  80. # ● 左に移動
  81. # turn_enabled : その場での向き変更を許可するフラグ
  82. #--------------------------------------------------------------------------
  83. def move_left(turn_enabled = true)
  84. # 左を向く
  85. if turn_enabled
  86. turn_left
  87. end
  88. # 通行可能な場合
  89. if passable?(@x, @y, Input::LEFT)
  90. # 左を向く
  91. turn_left
  92. # 座標を更新
  93. @x -= 1
  94. end
  95. end
  96. #--------------------------------------------------------------------------
  97. # ● 右に移動
  98. # turn_enabled : その場での向き変更を許可するフラグ
  99. #--------------------------------------------------------------------------
  100. def move_right(turn_enabled = true)
  101. # 右を向く
  102. if turn_enabled
  103. turn_right
  104. end
  105. # 通行可能な場合
  106. if passable?(@x, @y, Input::RIGHT)
  107. # 右を向く
  108. turn_right
  109. # 座標を更新
  110. @x += 1
  111. end
  112. end
  113. #--------------------------------------------------------------------------
  114. # ● 上に移動
  115. # turn_enabled : その場での向き変更を許可するフラグ
  116. #--------------------------------------------------------------------------
  117. def move_up(turn_enabled = true)
  118. # 上を向く
  119. if turn_enabled
  120. turn_up
  121. end
  122. # 通行可能な場合
  123. if passable?(@x, @y, Input::UP)
  124. # 上を向く
  125. turn_up
  126. # 座標を更新
  127. @y -= 1
  128. end
  129. end
  130. #--------------------------------------------------------------------------
  131. # ● 左下に移動
  132. #--------------------------------------------------------------------------
  133. def move_lower_left
  134. # 向き固定でない場合
  135. unless @direction_fix
  136. # 右向きだった場合は左を、上向きだった場合は下を向く
  137. @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::UP ? Input::DOWN : @direction)
  138. end
  139. # 下→左、左→下 のどちらかのコースが通行可能な場合
  140. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
  141. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
  142. # 座標を更新
  143. @x -= 1
  144. @y += 1
  145. end
  146. end
  147. #--------------------------------------------------------------------------
  148. # ● 右下に移動
  149. #--------------------------------------------------------------------------
  150. def move_lower_right
  151. # 向き固定でない場合
  152. unless @direction_fix
  153. # 左向きだった場合は右を、上向きだった場合は下を向く
  154. @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
  155. end
  156. # 下→右、右→下 のどちらかのコースが通行可能な場合
  157. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
  158. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
  159. # 座標を更新
  160. @x += 1
  161. @y += 1
  162. end
  163. end
  164. #--------------------------------------------------------------------------
  165. # ● 左上に移動
  166. #--------------------------------------------------------------------------
  167. def move_upper_left
  168. # 向き固定でない場合
  169. unless @direction_fix
  170. # 右向きだった場合は左を、下向きだった場合は上を向く
  171. @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
  172. end
  173. # 上→左、左→上 のどちらかのコースが通行可能な場合
  174. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
  175. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
  176. # 座標を更新
  177. @x -= 1
  178. @y -= 1
  179. end
  180. end
  181. #--------------------------------------------------------------------------
  182. # ● 右上に移動
  183. #--------------------------------------------------------------------------
  184. def move_upper_right
  185. # 向き固定でない場合
  186. unless @direction_fix
  187. # 左向きだった場合は右を、下向きだった場合は上を向く
  188. @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
  189. end
  190. # 上→右、右→上 のどちらかのコースが通行可能な場合
  191. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
  192. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
  193. # 座標を更新
  194. @x += 1
  195. @y -= 1
  196. end
  197. end
  198. attr_writer :move_speed
  199. attr_writer :step_anime
  200. end
  201. module Spriteset_Map_Module
  202. def setup_actor_character_sprites?
  203. return @setup_actor_character_sprites_flag != nil
  204. end
  205. def setup_actor_character_sprites(characters)
  206. if !setup_actor_character_sprites?
  207. index_game_player = 0
  208. @character_sprites.each_index do |i|
  209. if @character_sprites[i].character.instance_of?(Game_Player)
  210. index_game_player = i
  211. break
  212. end
  213. end
  214. for character in characters.reverse
  215. @character_sprites.unshift(
  216. Sprite_Character.new(@viewport1, character)
  217. )
  218. end
  219. @setup_actor_character_sprites_flag = true
  220. end
  221. end
  222. end
  223. module Scene_Map_Module
  224. def setup_actor_character_sprites(characters)
  225. @spriteset.setup_actor_character_sprites(characters)
  226. end
  227. end
  228. module Game_Party_Module
  229. def set_transparent_actors(transparent)
  230. @transparent = transparent
  231. end
  232. def setup_actor_character_sprites
  233. if @characters == nil
  234. # 叶子到此一游
  235. @characters = []
  236. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  237. @characters.push(Game_Party_Actor.new)
  238. end
  239. end
  240. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  241. # 叶子到此一游
  242. if i % (TRAIN_ACTOR_DISTANCE+1) == 0
  243. @characters[i-1].setup(actors[i/(TRAIN_ACTOR_DISTANCE+1)])
  244. end
  245. end
  246. if $scene.class.method_defined?('setup_actor_character_sprites')
  247. $scene.setup_actor_character_sprites(@characters)
  248. end
  249. end
  250. def update_party_actors
  251. setup_actor_character_sprites
  252. transparent = $game_player.transparent
  253. if transparent == false
  254. if TRANSPARENT_SWITCH
  255. transparent = $game_switches[TRANSPARENT_SWITCHES_INDEX]
  256. end
  257. end
  258. for character in @characters
  259. character.transparent = transparent
  260. character.move_speed = $game_player.move_speed
  261. character.step_anime = $game_player.step_anime
  262. character.update
  263. end
  264. end
  265. def moveto_party_actors( x, y )
  266. setup_actor_character_sprites
  267. for character in @characters
  268. character.moveto( x, y )
  269. end
  270. if @move_list == nil
  271. @move_list = []
  272. end
  273. move_list_setup
  274. end
  275. def move_party_actors
  276. if @move_list == nil
  277. @move_list = []
  278. move_list_setup
  279. end
  280. @move_list.each_index do |i|
  281. if @characters[i] != nil
  282. case @move_list[i].type
  283. when Input::DOWN
  284. @characters[i].move_down(@move_list[i].args[0])
  285. when Input::LEFT
  286. @characters[i].move_left(@move_list[i].args[0])
  287. when Input::RIGHT
  288. @characters[i].move_right(@move_list[i].args[0])
  289. when Input::UP
  290. @characters[i].move_up(@move_list[i].args[0])
  291. when DOWN_LEFT
  292. @characters[i].move_lower_left
  293. when DOWN_RIGHT
  294. @characters[i].move_lower_right
  295. when UP_LEFT
  296. @characters[i].move_upper_left
  297. when UP_RIGHT
  298. @characters[i].move_upper_right
  299. when JUMP
  300. @characters[i].jump(@move_list[i].args[0],@move_list[i].args[1])
  301. end
  302. end
  303. end
  304. end
  305. class Move_List_Element
  306. def initialize(type,args)
  307. @type = type
  308. @args = args
  309. end
  310. def type() return @type end
  311. def args() return @args end
  312. end
  313. def move_list_setup
  314. for i in 0 .. TRAIN_ACTOR_SIZE_MAX
  315. @move_list[i] = nil
  316. end
  317. end
  318. def add_move_list(type,*args)
  319. @move_list.unshift(Move_List_Element.new(type,args)).pop
  320. end
  321. def move_down_party_actors(turn_enabled = true)
  322. move_party_actors
  323. add_move_list(Input::DOWN,turn_enabled)
  324. end
  325. def move_left_party_actors(turn_enabled = true)
  326. move_party_actors
  327. add_move_list(Input::LEFT,turn_enabled)
  328. end
  329. def move_right_party_actors(turn_enabled = true)
  330. move_party_actors
  331. add_move_list(Input::RIGHT,turn_enabled)
  332. end
  333. def move_up_party_actors(turn_enabled = true)
  334. move_party_actors
  335. add_move_list(Input::UP,turn_enabled)
  336. end
  337. def move_lower_left_party_actors
  338. move_party_actors
  339. add_move_list(DOWN_LEFT)
  340. end
  341. def move_lower_right_party_actors
  342. move_party_actors
  343. add_move_list(DOWN_RIGHT)
  344. end
  345. def move_upper_left_party_actors
  346. move_party_actors
  347. add_move_list(UP_LEFT)
  348. end
  349. def move_upper_right_party_actors
  350. move_party_actors
  351. add_move_list(UP_RIGHT)
  352. end
  353. def jump_party_actors(x_plus, y_plus)
  354. move_party_actors
  355. add_move_list(JUMP,x_plus, y_plus)
  356. end
  357. end
  358. module Game_Player_Module
  359. def update
  360. $game_party.update_party_actors
  361. super
  362. end
  363. def moveto( x, y )
  364. $game_party.moveto_party_actors( x, y )
  365. super( x, y )
  366. end
  367. def move_down(turn_enabled = true)
  368. if passable?(@x, @y, Input::DOWN)
  369. $game_party.move_down_party_actors(turn_enabled)
  370. end
  371. super(turn_enabled)
  372. end
  373. def move_left(turn_enabled = true)
  374. if passable?(@x, @y, Input::LEFT)
  375. $game_party.move_left_party_actors(turn_enabled)
  376. end
  377. super(turn_enabled)
  378. end
  379. def move_right(turn_enabled = true)
  380. if passable?(@x, @y, Input::RIGHT)
  381. $game_party.move_right_party_actors(turn_enabled)
  382. end
  383. super(turn_enabled)
  384. end
  385. def move_up(turn_enabled = true)
  386. if passable?(@x, @y, Input::UP)
  387. $game_party.move_up_party_actors(turn_enabled)
  388. end
  389. super(turn_enabled)
  390. end
  391. def move_lower_left
  392. # 下→左、左→下 のどちらかのコースが通行可能な場合
  393. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
  394. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
  395. $game_party.move_lower_left_party_actors
  396. end
  397. super
  398. end
  399. def move_lower_right
  400. # 下→右、右→下 のどちらかのコースが通行可能な場合
  401. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
  402. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
  403. $game_party.move_lower_right_party_actors
  404. end
  405. super
  406. end
  407. def move_upper_left
  408. # 上→左、左→上 のどちらかのコースが通行可能な場合
  409. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
  410. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
  411. $game_party.move_upper_left_party_actors
  412. end
  413. super
  414. end
  415. def move_upper_right
  416. # 上→右、右→上 のどちらかのコースが通行可能な場合
  417. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
  418. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
  419. $game_party.move_upper_right_party_actors
  420. end
  421. super
  422. end
  423. def jump(x_plus, y_plus)
  424. # 新しい座標を計算
  425. new_x = @x + x_plus
  426. new_y = @y + y_plus
  427. # 加算値が (0,0) の場合か、ジャンプ先が通行可能な場合
  428. if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
  429. $game_party.jump_party_actors(x_plus, y_plus)
  430. end
  431. super(x_plus, y_plus)
  432. end
  433. attr_reader :move_speed
  434. attr_reader :step_anime
  435. end
  436. end # module Train_Actor
  437. class Game_Party
  438. include Train_Actor::Game_Party_Module
  439. end
  440. class Game_Player
  441. include Train_Actor::Game_Player_Module
  442. end
  443. class Spriteset_Map
  444. include Train_Actor::Spriteset_Map_Module
  445. end
  446. class Scene_Map
  447. include Train_Actor::Scene_Map_Module
  448. end

  449. #==============================================================================
  450. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  451. #==============================================================================
复制代码





接着在Scene_Battle 1中找到

def main



在这下方插入:
$game_party.remove_actor(10)

接着在Scene_Battle 1中找到


#切换到地图画面
$scene = Scene_Map.new

在这上面插入:
$game_party.add_actor(10)


再在数据库-角色第10号设置1个角色(跟随的NPC),在用事件增减第10号队员就行了



(其实括号里面的数字可以改成其它的,不过要对应在数据库里设置NPC的号数)
其实楼上都讲得很清楚了...我只是详细讲解

作者: ejenyang    时间: 2008-3-10 00:33
{/ll}不好意思,因为我做的是踩地雷的战斗模式,怎么能在遇敌前让他离开呢?
要在哪里设置
作者: 做游戏的新手    时间: 2008-3-10 01:03
一个字——麻烦
作者: 沉影不器    时间: 2008-3-10 01:05
提示: 作者被禁止或删除 内容自动屏蔽
作者: havealook    时间: 2008-3-10 02:21
我讲的不清楚吗?

那么说简单点,把下列2个脚本插入到Main之前
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================


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

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

  7. # 分开一段距离跟随
  8. # by 叶子
  9. #
  10. # Train_Actor
  11. #
  12. # [email protected]
  13. # http://www4.big.or.jp/~fukuyama/rgss/Train_Actor.txt
  14. #

  15. module Train_Actor




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




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


  23. # 跟随距离,例如0为紧贴,1为分开一个身位
  24. TRAIN_ACTOR_DISTANCE = 0



  25. # 定数
  26. #Input::DOWN = 2
  27. #Input::LEFT = 4
  28. #Input::RIGHT = 6
  29. #Input::UP = 6
  30. DOWN_LEFT = 1
  31. DOWN_RIGHT = 3
  32. UP_LEFT = 7
  33. UP_RIGHT = 9
  34. JUMP = 5

  35. # 叶子到此一游
  36. # 插入空角色,造成分开一段距离跟随的假象
  37. TRAIN_ACTOR_SIZE_MAX = TRAIN_ACTOR_SIZE_MAX * (TRAIN_ACTOR_DISTANCE+1) + 1
  38. class Game_Party_Actor < Game_Character
  39. def initialize
  40. super()
  41. @through = true
  42. end
  43. def setup(actor)
  44. # キャラクターのファイル名と色相を設定
  45. if actor != nil
  46. @character_name = actor.character_name
  47. @character_hue = actor.character_hue
  48. else
  49. @character_name = ""
  50. @character_hue = 0
  51. end
  52. # 不透明度と合成方法を初期化
  53. @opacity = 255
  54. @blend_type = 0
  55. end
  56. def screen_z(height = 0)
  57. if $game_player.x == @x and $game_player.y == @y
  58. return $game_player.screen_z(height) - 1
  59. end
  60. super(height)
  61. end
  62. #--------------------------------------------------------------------------
  63. # ● 下に移動
  64. # turn_enabled : その場での向き変更を許可するフラグ
  65. #--------------------------------------------------------------------------
  66. def move_down(turn_enabled = true)
  67. # 下を向く
  68. if turn_enabled
  69. turn_down
  70. end
  71. # 通行可能な場合
  72. if passable?(@x, @y, Input::DOWN)
  73. # 下を向く
  74. turn_down
  75. # 座標を更新
  76. @y += 1
  77. end
  78. end
  79. #--------------------------------------------------------------------------
  80. # ● 左に移動
  81. # turn_enabled : その場での向き変更を許可するフラグ
  82. #--------------------------------------------------------------------------
  83. def move_left(turn_enabled = true)
  84. # 左を向く
  85. if turn_enabled
  86. turn_left
  87. end
  88. # 通行可能な場合
  89. if passable?(@x, @y, Input::LEFT)
  90. # 左を向く
  91. turn_left
  92. # 座標を更新
  93. @x -= 1
  94. end
  95. end
  96. #--------------------------------------------------------------------------
  97. # ● 右に移動
  98. # turn_enabled : その場での向き変更を許可するフラグ
  99. #--------------------------------------------------------------------------
  100. def move_right(turn_enabled = true)
  101. # 右を向く
  102. if turn_enabled
  103. turn_right
  104. end
  105. # 通行可能な場合
  106. if passable?(@x, @y, Input::RIGHT)
  107. # 右を向く
  108. turn_right
  109. # 座標を更新
  110. @x += 1
  111. end
  112. end
  113. #--------------------------------------------------------------------------
  114. # ● 上に移動
  115. # turn_enabled : その場での向き変更を許可するフラグ
  116. #--------------------------------------------------------------------------
  117. def move_up(turn_enabled = true)
  118. # 上を向く
  119. if turn_enabled
  120. turn_up
  121. end
  122. # 通行可能な場合
  123. if passable?(@x, @y, Input::UP)
  124. # 上を向く
  125. turn_up
  126. # 座標を更新
  127. @y -= 1
  128. end
  129. end
  130. #--------------------------------------------------------------------------
  131. # ● 左下に移動
  132. #--------------------------------------------------------------------------
  133. def move_lower_left
  134. # 向き固定でない場合
  135. unless @direction_fix
  136. # 右向きだった場合は左を、上向きだった場合は下を向く
  137. @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::UP ? Input::DOWN : @direction)
  138. end
  139. # 下→左、左→下 のどちらかのコースが通行可能な場合
  140. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
  141. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
  142. # 座標を更新
  143. @x -= 1
  144. @y += 1
  145. end
  146. end
  147. #--------------------------------------------------------------------------
  148. # ● 右下に移動
  149. #--------------------------------------------------------------------------
  150. def move_lower_right
  151. # 向き固定でない場合
  152. unless @direction_fix
  153. # 左向きだった場合は右を、上向きだった場合は下を向く
  154. @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
  155. end
  156. # 下→右、右→下 のどちらかのコースが通行可能な場合
  157. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
  158. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
  159. # 座標を更新
  160. @x += 1
  161. @y += 1
  162. end
  163. end
  164. #--------------------------------------------------------------------------
  165. # ● 左上に移動
  166. #--------------------------------------------------------------------------
  167. def move_upper_left
  168. # 向き固定でない場合
  169. unless @direction_fix
  170. # 右向きだった場合は左を、下向きだった場合は上を向く
  171. @direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
  172. end
  173. # 上→左、左→上 のどちらかのコースが通行可能な場合
  174. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
  175. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
  176. # 座標を更新
  177. @x -= 1
  178. @y -= 1
  179. end
  180. end
  181. #--------------------------------------------------------------------------
  182. # ● 右上に移動
  183. #--------------------------------------------------------------------------
  184. def move_upper_right
  185. # 向き固定でない場合
  186. unless @direction_fix
  187. # 左向きだった場合は右を、下向きだった場合は上を向く
  188. @direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
  189. end
  190. # 上→右、右→上 のどちらかのコースが通行可能な場合
  191. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
  192. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
  193. # 座標を更新
  194. @x += 1
  195. @y -= 1
  196. end
  197. end
  198. attr_writer :move_speed
  199. attr_writer :step_anime
  200. end
  201. module Spriteset_Map_Module
  202. def setup_actor_character_sprites?
  203. return @setup_actor_character_sprites_flag != nil
  204. end
  205. def setup_actor_character_sprites(characters)
  206. if !setup_actor_character_sprites?
  207. index_game_player = 0
  208. @character_sprites.each_index do |i|
  209. if @character_sprites[i].character.instance_of?(Game_Player)
  210. index_game_player = i
  211. break
  212. end
  213. end
  214. for character in characters.reverse
  215. @character_sprites.unshift(
  216. Sprite_Character.new(@viewport1, character)
  217. )
  218. end
  219. @setup_actor_character_sprites_flag = true
  220. end
  221. end
  222. end
  223. module Scene_Map_Module
  224. def setup_actor_character_sprites(characters)
  225. @spriteset.setup_actor_character_sprites(characters)
  226. end
  227. end
  228. module Game_Party_Module
  229. def set_transparent_actors(transparent)
  230. @transparent = transparent
  231. end
  232. def setup_actor_character_sprites
  233. if @characters == nil
  234. # 叶子到此一游
  235. @characters = []
  236. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  237. @characters.push(Game_Party_Actor.new)
  238. end
  239. end
  240. for i in 1 ... TRAIN_ACTOR_SIZE_MAX
  241. # 叶子到此一游
  242. if i % (TRAIN_ACTOR_DISTANCE+1) == 0
  243. @characters[i-1].setup(actors[i/(TRAIN_ACTOR_DISTANCE+1)])
  244. end
  245. end
  246. if $scene.class.method_defined?('setup_actor_character_sprites')
  247. $scene.setup_actor_character_sprites(@characters)
  248. end
  249. end
  250. def update_party_actors
  251. setup_actor_character_sprites
  252. transparent = $game_player.transparent
  253. if transparent == false
  254. if TRANSPARENT_SWITCH
  255. transparent = $game_switches[TRANSPARENT_SWITCHES_INDEX]
  256. end
  257. end
  258. for character in @characters
  259. character.transparent = transparent
  260. character.move_speed = $game_player.move_speed
  261. character.step_anime = $game_player.step_anime
  262. character.update
  263. end
  264. end
  265. def moveto_party_actors( x, y )
  266. setup_actor_character_sprites
  267. for character in @characters
  268. character.moveto( x, y )
  269. end
  270. if @move_list == nil
  271. @move_list = []
  272. end
  273. move_list_setup
  274. end
  275. def move_party_actors
  276. if @move_list == nil
  277. @move_list = []
  278. move_list_setup
  279. end
  280. @move_list.each_index do |i|
  281. if @characters[i] != nil
  282. case @move_list[i].type
  283. when Input::DOWN
  284. @characters[i].move_down(@move_list[i].args[0])
  285. when Input::LEFT
  286. @characters[i].move_left(@move_list[i].args[0])
  287. when Input::RIGHT
  288. @characters[i].move_right(@move_list[i].args[0])
  289. when Input::UP
  290. @characters[i].move_up(@move_list[i].args[0])
  291. when DOWN_LEFT
  292. @characters[i].move_lower_left
  293. when DOWN_RIGHT
  294. @characters[i].move_lower_right
  295. when UP_LEFT
  296. @characters[i].move_upper_left
  297. when UP_RIGHT
  298. @characters[i].move_upper_right
  299. when JUMP
  300. @characters[i].jump(@move_list[i].args[0],@move_list[i].args[1])
  301. end
  302. end
  303. end
  304. end
  305. class Move_List_Element
  306. def initialize(type,args)
  307. @type = type
  308. @args = args
  309. end
  310. def type() return @type end
  311. def args() return @args end
  312. end
  313. def move_list_setup
  314. for i in 0 .. TRAIN_ACTOR_SIZE_MAX
  315. @move_list[i] = nil
  316. end
  317. end
  318. def add_move_list(type,*args)
  319. @move_list.unshift(Move_List_Element.new(type,args)).pop
  320. end
  321. def move_down_party_actors(turn_enabled = true)
  322. move_party_actors
  323. add_move_list(Input::DOWN,turn_enabled)
  324. end
  325. def move_left_party_actors(turn_enabled = true)
  326. move_party_actors
  327. add_move_list(Input::LEFT,turn_enabled)
  328. end
  329. def move_right_party_actors(turn_enabled = true)
  330. move_party_actors
  331. add_move_list(Input::RIGHT,turn_enabled)
  332. end
  333. def move_up_party_actors(turn_enabled = true)
  334. move_party_actors
  335. add_move_list(Input::UP,turn_enabled)
  336. end
  337. def move_lower_left_party_actors
  338. move_party_actors
  339. add_move_list(DOWN_LEFT)
  340. end
  341. def move_lower_right_party_actors
  342. move_party_actors
  343. add_move_list(DOWN_RIGHT)
  344. end
  345. def move_upper_left_party_actors
  346. move_party_actors
  347. add_move_list(UP_LEFT)
  348. end
  349. def move_upper_right_party_actors
  350. move_party_actors
  351. add_move_list(UP_RIGHT)
  352. end
  353. def jump_party_actors(x_plus, y_plus)
  354. move_party_actors
  355. add_move_list(JUMP,x_plus, y_plus)
  356. end
  357. end
  358. module Game_Player_Module
  359. def update
  360. $game_party.update_party_actors
  361. super
  362. end
  363. def moveto( x, y )
  364. $game_party.moveto_party_actors( x, y )
  365. super( x, y )
  366. end
  367. def move_down(turn_enabled = true)
  368. if passable?(@x, @y, Input::DOWN)
  369. $game_party.move_down_party_actors(turn_enabled)
  370. end
  371. super(turn_enabled)
  372. end
  373. def move_left(turn_enabled = true)
  374. if passable?(@x, @y, Input::LEFT)
  375. $game_party.move_left_party_actors(turn_enabled)
  376. end
  377. super(turn_enabled)
  378. end
  379. def move_right(turn_enabled = true)
  380. if passable?(@x, @y, Input::RIGHT)
  381. $game_party.move_right_party_actors(turn_enabled)
  382. end
  383. super(turn_enabled)
  384. end
  385. def move_up(turn_enabled = true)
  386. if passable?(@x, @y, Input::UP)
  387. $game_party.move_up_party_actors(turn_enabled)
  388. end
  389. super(turn_enabled)
  390. end
  391. def move_lower_left
  392. # 下→左、左→下 のどちらかのコースが通行可能な場合
  393. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
  394. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
  395. $game_party.move_lower_left_party_actors
  396. end
  397. super
  398. end
  399. def move_lower_right
  400. # 下→右、右→下 のどちらかのコースが通行可能な場合
  401. if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
  402. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
  403. $game_party.move_lower_right_party_actors
  404. end
  405. super
  406. end
  407. def move_upper_left
  408. # 上→左、左→上 のどちらかのコースが通行可能な場合
  409. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
  410. (passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
  411. $game_party.move_upper_left_party_actors
  412. end
  413. super
  414. end
  415. def move_upper_right
  416. # 上→右、右→上 のどちらかのコースが通行可能な場合
  417. if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
  418. (passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
  419. $game_party.move_upper_right_party_actors
  420. end
  421. super
  422. end
  423. def jump(x_plus, y_plus)
  424. # 新しい座標を計算
  425. new_x = @x + x_plus
  426. new_y = @y + y_plus
  427. # 加算値が (0,0) の場合か、ジャンプ先が通行可能な場合
  428. if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
  429. $game_party.jump_party_actors(x_plus, y_plus)
  430. end
  431. super(x_plus, y_plus)
  432. end
  433. attr_reader :move_speed
  434. attr_reader :step_anime
  435. end
  436. end # module Train_Actor
  437. class Game_Party
  438. include Train_Actor::Game_Party_Module
  439. end
  440. class Game_Player
  441. include Train_Actor::Game_Player_Module
  442. end
  443. class Spriteset_Map
  444. include Train_Actor::Spriteset_Map_Module
  445. end
  446. class Scene_Map
  447. include Train_Actor::Scene_Map_Module
  448. end

  449. #==============================================================================
  450. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  451. #==============================================================================

复制代码


  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 1)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================

  6. class Scene_Battle
  7.   #--------------------------------------------------------------------------
  8.   # ● 主处理
  9.   #--------------------------------------------------------------------------
  10.   def main
  11.    
  12. #########################################havealook#################################
  13.     $game_party.remove_actor(10)     #havealook添加
  14. #########################################havealook#################################
  15.     # 初始化战斗用的各种暂时数据
  16.     $game_temp.in_battle = true
  17.     $game_temp.battle_turn = 0
  18.     $game_temp.battle_event_flags.clear
  19.     $game_temp.battle_abort = false
  20.     $game_temp.battle_main_phase = false
  21.     $game_temp.battleback_name = $game_map.battleback_name
  22.     $game_temp.forcing_battler = nil
  23.     # 初始化战斗用事件解释器
  24.     $game_system.battle_interpreter.setup(nil, 0)
  25.     # 准备队伍
  26.     @troop_id = $game_temp.battle_troop_id
  27.     $game_troop.setup(@troop_id)
  28.     # 生成角色命令窗口
  29.     s1 = $data_system.words.attack
  30.     s2 = $data_system.words.skill
  31.     s3 = $data_system.words.guard
  32.     s4 = $data_system.words.item
  33.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
  34.     @actor_command_window.y = 160
  35.     @actor_command_window.back_opacity = 160
  36.     @actor_command_window.active = false
  37.     @actor_command_window.visible = false
  38.     # 生成其它窗口
  39.     @party_command_window = Window_PartyCommand.new
  40.     @help_window = Window_Help.new
  41.     @help_window.back_opacity = 160
  42.     @help_window.visible = false
  43.     @status_window = Window_BattleStatus.new
  44.     @message_window = Window_Message.new
  45.     # 生成活动块
  46.     @spriteset = Spriteset_Battle.new
  47.     # 初始化等待计数
  48.     @wait_count = 0
  49.     # 执行过渡
  50.     if $data_system.battle_transition == ""
  51.       Graphics.transition(20)
  52.     else
  53.       Graphics.transition(40, "Graphics/Transitions/" +
  54.         $data_system.battle_transition)
  55.     end
  56.     # 开始自由战斗回合
  57.     start_phase1
  58.     # 主循环
  59.     loop do
  60.       # 刷新游戏画面
  61.       Graphics.update
  62.       # 刷新输入信息
  63.       Input.update
  64.       # 刷新画面
  65.       update
  66.       # 如果画面切换的话就中断循环
  67.       if $scene != self
  68.         break
  69.       end
  70.     end
  71.     # 刷新地图
  72.     $game_map.refresh
  73.     # 准备过渡
  74.     Graphics.freeze
  75.     # 释放窗口
  76.     @actor_command_window.dispose
  77.     @party_command_window.dispose
  78.     @help_window.dispose
  79.     @status_window.dispose
  80.     @message_window.dispose
  81.     if @skill_window != nil
  82.       @skill_window.dispose
  83.     end
  84.     if @item_window != nil
  85.       @item_window.dispose
  86.     end
  87.     if @result_window != nil
  88.       @result_window.dispose
  89.     end
  90.     # 释放活动块
  91.     @spriteset.dispose
  92.     # 标题画面切换中的情况
  93.     if $scene.is_a?(Scene_Title)
  94.       # 淡入淡出画面
  95.       Graphics.transition
  96.       Graphics.freeze
  97.     end
  98.     # 战斗测试或者游戏结束以外的画面切换中的情况
  99.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  100.       $scene = nil
  101.     end
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● 胜负判定
  105.   #--------------------------------------------------------------------------
  106.   def judge
  107.     # 全灭判定是真、并且同伴人数为 0 的情况下
  108.     if $game_party.all_dead? or $game_party.actors.size == 0
  109.       # 允许失败的情况下
  110.       if $game_temp.battle_can_lose
  111.         # 还原为战斗开始前的 BGM
  112.         $game_system.bgm_play($game_temp.map_bgm)
  113.         # 战斗结束
  114.         battle_end(2)
  115.         # 返回 true
  116.         return true
  117.       end
  118.       # 设置游戏结束标志
  119.       $game_temp.gameover = true
  120.       # 返回 true
  121.       return true
  122.     end
  123.     # 如果存在任意 1 个敌人就返回 false
  124.     for enemy in $game_troop.enemies
  125.       if enemy.exist?
  126.         return false
  127.       end
  128.     end
  129.     # 开始结束战斗回合 (胜利)
  130.     start_phase5
  131.     # 返回 true
  132.     return true
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # ● 战斗结束
  136.   #     result : 結果 (0:胜利 1:失败 2:逃跑)
  137.   #--------------------------------------------------------------------------
  138.   def battle_end(result)
  139.     # 清除战斗中标志
  140.     $game_temp.in_battle = false
  141.     # 清除全体同伴的行动
  142.     $game_party.clear_actions
  143.     # 解除战斗用状态
  144.     for actor in $game_party.actors
  145.       actor.remove_states_battle
  146.     end
  147.     # 清除敌人
  148.     $game_troop.enemies.clear
  149.     # 调用战斗返回调用
  150.     if $game_temp.battle_proc != nil
  151.       $game_temp.battle_proc.call(result)
  152.       $game_temp.battle_proc = nil
  153.     end
  154.     # 切换到地图画面
  155.    
  156. #########################################havealook#################################
  157. if $game switches[50] == true
  158.     $game_party.add_actor(10)  #havealook添加
  159. end
  160.    
  161. #########################################havealook#################################
  162.     $scene = Scene_Map.new
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ● 设置战斗事件
  166.   #--------------------------------------------------------------------------
  167.   def setup_battle_event
  168.     # 正在执行战斗事件的情况下
  169.     if $game_system.battle_interpreter.running?
  170.       return
  171.     end
  172.     # 搜索全部页的战斗事件
  173.     for index in 0...$data_troops[@troop_id].pages.size
  174.       # 获取事件页
  175.       page = $data_troops[@troop_id].pages[index]
  176.       # 事件条件可以参考 c
  177.       c = page.condition
  178.       # 没有指定任何条件的情况下转到下一页
  179.       unless c.turn_valid or c.enemy_valid or
  180.              c.actor_valid or c.switch_valid
  181.         next
  182.       end
  183.       # 执行完毕的情况下转到下一页
  184.       if $game_temp.battle_event_flags[index]
  185.         next
  186.       end
  187.       # 确认回合条件
  188.       if c.turn_valid
  189.         n = $game_temp.battle_turn
  190.         a = c.turn_a
  191.         b = c.turn_b
  192.         if (b == 0 and n != a) or
  193.            (b > 0 and (n < 1 or n < a or n % b != a % b))
  194.           next
  195.         end
  196.       end
  197.       # 确认敌人条件
  198.       if c.enemy_valid
  199.         enemy = $game_troop.enemies[c.enemy_index]
  200.         if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
  201.           next
  202.         end
  203.       end
  204.       # 确认角色条件
  205.       if c.actor_valid
  206.         actor = $game_actors[c.actor_id]
  207.         if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
  208.           next
  209.         end
  210.       end
  211.       # 确认开关条件
  212.       if c.switch_valid
  213.         if $game_switches[c.switch_id] == false
  214.           next
  215.         end
  216.       end
  217.       # 设置事件
  218.       $game_system.battle_interpreter.setup(page.list, 0)
  219.       # 本页的范围是 [战斗] 或 [回合] 的情况下
  220.       if page.span <= 1
  221.         # 设置执行结束标志
  222.         $game_temp.battle_event_flags[index] = true
  223.       end
  224.       return
  225.     end
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ● 刷新画面
  229.   #--------------------------------------------------------------------------
  230.   def update
  231.     # 执行战斗事件中的情况下
  232.     if $game_system.battle_interpreter.running?
  233.       # 刷新解释器
  234.       $game_system.battle_interpreter.update
  235.       # 强制行动的战斗者不存在的情况下
  236.       if $game_temp.forcing_battler == nil
  237.         # 执行战斗事件结束的情况下
  238.         unless $game_system.battle_interpreter.running?
  239.           # 继续战斗的情况下、再执行战斗事件的设置
  240.           unless judge
  241.             setup_battle_event
  242.           end
  243.         end
  244.         # 如果不是结束战斗回合的情况下
  245.         if @phase != 5
  246.           # 刷新状态窗口
  247.           @status_window.refresh
  248.         end
  249.       end
  250.     end
  251.     # 系统 (计时器)、刷新画面
  252.     $game_system.update
  253.     $game_screen.update
  254.     # 计时器为 0 的情况下
  255.     if $game_system.timer_working and $game_system.timer == 0
  256.       # 中断战斗
  257.       $game_temp.battle_abort = true
  258.     end
  259.     # 刷新窗口
  260.     @help_window.update
  261.     @party_command_window.update
  262.     @actor_command_window.update
  263.     @status_window.update
  264.     @message_window.update
  265.     # 刷新活动块
  266.     @spriteset.update
  267.     # 处理过渡中的情况下
  268.     if $game_temp.transition_processing
  269.       # 清除处理过渡中标志
  270.       $game_temp.transition_processing = false
  271.       # 执行过渡
  272.       if $game_temp.transition_name == ""
  273.         Graphics.transition(20)
  274.       else
  275.         Graphics.transition(40, "Graphics/Transitions/" +
  276.           $game_temp.transition_name)
  277.       end
  278.     end
  279.     # 显示信息窗口中的情况下
  280.     if $game_temp.message_window_showing
  281.       return
  282.     end
  283.     # 显示效果中的情况下
  284.     if @spriteset.effect?
  285.       return
  286.     end
  287.     # 游戏结束的情况下
  288.     if $game_temp.gameover
  289.       # 切换到游戏结束画面
  290.       $scene = Scene_Gameover.new
  291.       return
  292.     end
  293.     # 返回标题画面的情况下
  294.     if $game_temp.to_title
  295.       # 切换到标题画面
  296.       $scene = Scene_Title.new
  297.       return
  298.     end
  299.     # 中断战斗的情况下
  300.     if $game_temp.battle_abort
  301.       # 还原为战斗前的 BGM
  302.       $game_system.bgm_play($game_temp.map_bgm)
  303.       # 战斗结束
  304.       battle_end(1)
  305.       return
  306.     end
  307.     # 等待中的情况下
  308.     if @wait_count > 0
  309.       # 减少等待计数
  310.       @wait_count -= 1
  311.       return
  312.     end
  313.     # 强制行动的角色存在、
  314.     # 并且战斗事件正在执行的情况下
  315.     if $game_temp.forcing_battler == nil and
  316.        $game_system.battle_interpreter.running?
  317.       return
  318.     end
  319.     # 回合分支
  320.     case @phase
  321.     when 1  # 自由战斗回合
  322.       update_phase1
  323.     when 2  # 同伴命令回合
  324.       update_phase2
  325.     when 3  # 角色命令回合
  326.       update_phase3
  327.     when 4  # 主回合
  328.       update_phase4
  329.     when 5  # 战斗结束回合
  330.       update_phase5
  331.     end
  332.   end
  333. end
复制代码




插入脚本到会吧||

在数据库-角色-10号设置其行走图为NPC的行走图
接着设置个NPC,对话后增减队员-10号角色,独立开关A打开,新建空白事件页,条件为独立开关A为ON,其它什么不要设置就行了
作者: ejenyang    时间: 2008-3-10 03:28
{/pz}我知道啊,问题是我设置的是踩地雷的啊,怎么设置个NPC对话啊
打1架和NPC说句话吗
作者: havealook    时间: 2008-3-10 03:55
你自己试试撒!!
我改了脚本,在战斗开始时让跟随的NPC离开队伍,在战斗结束后又加入队伍了
不管敌人是明雷还是暗雷应该都行的!!
作者: yanzheng868    时间: 2008-3-10 04:56
用战斗事件做
条件选择开关(自己设)
事件是XX离队
作者: 漫网de淘淘    时间: 2008-3-10 05:43
提示: 作者被禁止或删除 内容自动屏蔽
作者: 沉影不器    时间: 2008-3-10 05:49
提示: 作者被禁止或删除 内容自动屏蔽
作者: 漫网de淘淘    时间: 2008-3-10 05:57
提示: 作者被禁止或删除 内容自动屏蔽
作者: magickey    时间: 2008-3-10 08:13
提示: 作者被禁止或删除 内容自动屏蔽
作者: havealook    时间: 2008-3-11 03:14
你到底是什么思路?

先把我10楼的2个脚本插到Main之前
首先呢,你跟NPC对话,他让你保护他1段路,对吧?设置第10号角色加入,打开50号开关,打开独立开关A,新建个空白事件页,条件为独立开关A为ON时。那么对完话NPC就会加入了队伍是吧?而之前的NPC就会不见吧?由于我用了人物跟随的脚本,所以你会发现NPC跟在队伍的后面。由于我修改了脚本,所以战斗时NPC不会参战,但他会跟在队伍后面,对吧?到达目的地时,设置个事件,显示文章对话分别,让10号角色离开队伍,将开关50关掉,打开独立开关A,新建个空白事件页,条件为独立开关A为ON时。

还不懂!?

注意之前队伍人数最多是3个人,否则NPC不会显示在队伍末尾
作者: 漫网de淘淘    时间: 2008-3-11 03:29
提示: 作者被禁止或删除 内容自动屏蔽
作者: havealook    时间: 2008-3-11 03:44
我说的是最多3个人!汗
不能4个人
1。2。3个人都行,汗。。。
作者: ejenyang    时间: 2008-3-11 04:13
{/ll}大大们,不要吵架呀,这2天问题比较多,这个麻烦的我还没研究
我现在就要研究了{/ll}
作者: 西江月    时间: 2008-3-11 04:18
我有个办法,不过就是有点傻...
那就是把该NPC的类型(行走路线)改为接近主角.....
虽然不太完美而且效果很奇怪,但是除了这个办法之外我不知道其他办法了.....
不好意思啊~
作者: ejenyang    时间: 2008-3-11 04:27
我用havealook那个脚本插进去测试就提示错错了{/dk}{/dk}
作者: 西江月    时间: 2008-3-11 04:30
以下引用ejenyang于2008-3-10 20:27:57的发言:

我用havealook那个脚本插进去测试就提示错错了

难道是脚本冲突!!??你用了其他什么脚本吗?全部上报~
作者: ejenyang    时间: 2008-3-11 04:35
{/pz}双远景,66RPG的对话加强,还有近大远小,描绘敌人血槽
全动画战斗,显示地图名,武器决定技能,★简单物品分类
差不多就这些,我是脚本白痴,反正贴进去不冲突的我就用了{/gg}
作者: havealook    时间: 2008-3-11 04:36
不好意思,错了个标点符号。。
再次修改第2个脚本
  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 1)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================

  6. class Scene_Battle
  7.   #--------------------------------------------------------------------------
  8.   # ● 主处理
  9.   #--------------------------------------------------------------------------
  10.   def main
  11.    
  12. #########################################havealook#################################
  13.     $game_party.remove_actor(10)     #havealook添加
  14. #########################################havealook#################################
  15.     # 初始化战斗用的各种暂时数据
  16.     $game_temp.in_battle = true
  17.     $game_temp.battle_turn = 0
  18.     $game_temp.battle_event_flags.clear
  19.     $game_temp.battle_abort = false
  20.     $game_temp.battle_main_phase = false
  21.     $game_temp.battleback_name = $game_map.battleback_name
  22.     $game_temp.forcing_battler = nil
  23.     # 初始化战斗用事件解释器
  24.     $game_system.battle_interpreter.setup(nil, 0)
  25.     # 准备队伍
  26.     @troop_id = $game_temp.battle_troop_id
  27.     $game_troop.setup(@troop_id)
  28.     # 生成角色命令窗口
  29.     s1 = $data_system.words.attack
  30.     s2 = $data_system.words.skill
  31.     s3 = $data_system.words.guard
  32.     s4 = $data_system.words.item
  33.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
  34.     @actor_command_window.y = 160
  35.     @actor_command_window.back_opacity = 160
  36.     @actor_command_window.active = false
  37.     @actor_command_window.visible = false
  38.     # 生成其它窗口
  39.     @party_command_window = Window_PartyCommand.new
  40.     @help_window = Window_Help.new
  41.     @help_window.back_opacity = 160
  42.     @help_window.visible = false
  43.     @status_window = Window_BattleStatus.new
  44.     @message_window = Window_Message.new
  45.     # 生成活动块
  46.     @spriteset = Spriteset_Battle.new
  47.     # 初始化等待计数
  48.     @wait_count = 0
  49.     # 执行过渡
  50.     if $data_system.battle_transition == ""
  51.       Graphics.transition(20)
  52.     else
  53.       Graphics.transition(40, "Graphics/Transitions/" +
  54.         $data_system.battle_transition)
  55.     end
  56.     # 开始自由战斗回合
  57.     start_phase1
  58.     # 主循环
  59.     loop do
  60.       # 刷新游戏画面
  61.       Graphics.update
  62.       # 刷新输入信息
  63.       Input.update
  64.       # 刷新画面
  65.       update
  66.       # 如果画面切换的话就中断循环
  67.       if $scene != self
  68.         break
  69.       end
  70.     end
  71.     # 刷新地图
  72.     $game_map.refresh
  73.     # 准备过渡
  74.     Graphics.freeze
  75.     # 释放窗口
  76.     @actor_command_window.dispose
  77.     @party_command_window.dispose
  78.     @help_window.dispose
  79.     @status_window.dispose
  80.     @message_window.dispose
  81.     if @skill_window != nil
  82.       @skill_window.dispose
  83.     end
  84.     if @item_window != nil
  85.       @item_window.dispose
  86.     end
  87.     if @result_window != nil
  88.       @result_window.dispose
  89.     end
  90.     # 释放活动块
  91.     @spriteset.dispose
  92.     # 标题画面切换中的情况
  93.     if $scene.is_a?(Scene_Title)
  94.       # 淡入淡出画面
  95.       Graphics.transition
  96.       Graphics.freeze
  97.     end
  98.     # 战斗测试或者游戏结束以外的画面切换中的情况
  99.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  100.       $scene = nil
  101.     end
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● 胜负判定
  105.   #--------------------------------------------------------------------------
  106.   def judge
  107.     # 全灭判定是真、并且同伴人数为 0 的情况下
  108.     if $game_party.all_dead? or $game_party.actors.size == 0
  109.       # 允许失败的情况下
  110.       if $game_temp.battle_can_lose
  111.         # 还原为战斗开始前的 BGM
  112.         $game_system.bgm_play($game_temp.map_bgm)
  113.         # 战斗结束
  114.         battle_end(2)
  115.         # 返回 true
  116.         return true
  117.       end
  118.       # 设置游戏结束标志
  119.       $game_temp.gameover = true
  120.       # 返回 true
  121.       return true
  122.     end
  123.     # 如果存在任意 1 个敌人就返回 false
  124.     for enemy in $game_troop.enemies
  125.       if enemy.exist?
  126.         return false
  127.       end
  128.     end
  129.     # 开始结束战斗回合 (胜利)
  130.     start_phase5
  131.     # 返回 true
  132.     return true
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # ● 战斗结束
  136.   #     result : 結果 (0:胜利 1:失败 2:逃跑)
  137.   #--------------------------------------------------------------------------
  138.   def battle_end(result)
  139.     # 清除战斗中标志
  140.     $game_temp.in_battle = false
  141.     # 清除全体同伴的行动
  142.     $game_party.clear_actions
  143.     # 解除战斗用状态
  144.     for actor in $game_party.actors
  145.       actor.remove_states_battle
  146.     end
  147.     # 清除敌人
  148.     $game_troop.enemies.clear
  149.     # 调用战斗返回调用
  150.     if $game_temp.battle_proc != nil
  151.       $game_temp.battle_proc.call(result)
  152.       $game_temp.battle_proc = nil
  153.     end
  154.     # 切换到地图画面
  155.    
  156. #########################################havealook#################################
  157. if $game_switches[50] == true
  158.     $game_party.add_actor(10)  #havealook添加
  159. end
  160.    
  161. #########################################havealook#################################
  162.     $scene = Scene_Map.new
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ● 设置战斗事件
  166.   #--------------------------------------------------------------------------
  167.   def setup_battle_event
  168.     # 正在执行战斗事件的情况下
  169.     if $game_system.battle_interpreter.running?
  170.       return
  171.     end
  172.     # 搜索全部页的战斗事件
  173.     for index in 0...$data_troops[@troop_id].pages.size
  174.       # 获取事件页
  175.       page = $data_troops[@troop_id].pages[index]
  176.       # 事件条件可以参考 c
  177.       c = page.condition
  178.       # 没有指定任何条件的情况下转到下一页
  179.       unless c.turn_valid or c.enemy_valid or
  180.              c.actor_valid or c.switch_valid
  181.         next
  182.       end
  183.       # 执行完毕的情况下转到下一页
  184.       if $game_temp.battle_event_flags[index]
  185.         next
  186.       end
  187.       # 确认回合条件
  188.       if c.turn_valid
  189.         n = $game_temp.battle_turn
  190.         a = c.turn_a
  191.         b = c.turn_b
  192.         if (b == 0 and n != a) or
  193.            (b > 0 and (n < 1 or n < a or n % b != a % b))
  194.           next
  195.         end
  196.       end
  197.       # 确认敌人条件
  198.       if c.enemy_valid
  199.         enemy = $game_troop.enemies[c.enemy_index]
  200.         if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
  201.           next
  202.         end
  203.       end
  204.       # 确认角色条件
  205.       if c.actor_valid
  206.         actor = $game_actors[c.actor_id]
  207.         if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
  208.           next
  209.         end
  210.       end
  211.       # 确认开关条件
  212.       if c.switch_valid
  213.         if $game_switches[c.switch_id] == false
  214.           next
  215.         end
  216.       end
  217.       # 设置事件
  218.       $game_system.battle_interpreter.setup(page.list, 0)
  219.       # 本页的范围是 [战斗] 或 [回合] 的情况下
  220.       if page.span <= 1
  221.         # 设置执行结束标志
  222.         $game_temp.battle_event_flags[index] = true
  223.       end
  224.       return
  225.     end
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ● 刷新画面
  229.   #--------------------------------------------------------------------------
  230.   def update
  231.     # 执行战斗事件中的情况下
  232.     if $game_system.battle_interpreter.running?
  233.       # 刷新解释器
  234.       $game_system.battle_interpreter.update
  235.       # 强制行动的战斗者不存在的情况下
  236.       if $game_temp.forcing_battler == nil
  237.         # 执行战斗事件结束的情况下
  238.         unless $game_system.battle_interpreter.running?
  239.           # 继续战斗的情况下、再执行战斗事件的设置
  240.           unless judge
  241.             setup_battle_event
  242.           end
  243.         end
  244.         # 如果不是结束战斗回合的情况下
  245.         if @phase != 5
  246.           # 刷新状态窗口
  247.           @status_window.refresh
  248.         end
  249.       end
  250.     end
  251.     # 系统 (计时器)、刷新画面
  252.     $game_system.update
  253.     $game_screen.update
  254.     # 计时器为 0 的情况下
  255.     if $game_system.timer_working and $game_system.timer == 0
  256.       # 中断战斗
  257.       $game_temp.battle_abort = true
  258.     end
  259.     # 刷新窗口
  260.     @help_window.update
  261.     @party_command_window.update
  262.     @actor_command_window.update
  263.     @status_window.update
  264.     @message_window.update
  265.     # 刷新活动块
  266.     @spriteset.update
  267.     # 处理过渡中的情况下
  268.     if $game_temp.transition_processing
  269.       # 清除处理过渡中标志
  270.       $game_temp.transition_processing = false
  271.       # 执行过渡
  272.       if $game_temp.transition_name == ""
  273.         Graphics.transition(20)
  274.       else
  275.         Graphics.transition(40, "Graphics/Transitions/" +
  276.           $game_temp.transition_name)
  277.       end
  278.     end
  279.     # 显示信息窗口中的情况下
  280.     if $game_temp.message_window_showing
  281.       return
  282.     end
  283.     # 显示效果中的情况下
  284.     if @spriteset.effect?
  285.       return
  286.     end
  287.     # 游戏结束的情况下
  288.     if $game_temp.gameover
  289.       # 切换到游戏结束画面
  290.       $scene = Scene_Gameover.new
  291.       return
  292.     end
  293.     # 返回标题画面的情况下
  294.     if $game_temp.to_title
  295.       # 切换到标题画面
  296.       $scene = Scene_Title.new
  297.       return
  298.     end
  299.     # 中断战斗的情况下
  300.     if $game_temp.battle_abort
  301.       # 还原为战斗前的 BGM
  302.       $game_system.bgm_play($game_temp.map_bgm)
  303.       # 战斗结束
  304.       battle_end(1)
  305.       return
  306.     end
  307.     # 等待中的情况下
  308.     if @wait_count > 0
  309.       # 减少等待计数
  310.       @wait_count -= 1
  311.       return
  312.     end
  313.     # 强制行动的角色存在、
  314.     # 并且战斗事件正在执行的情况下
  315.     if $game_temp.forcing_battler == nil and
  316.        $game_system.battle_interpreter.running?
  317.       return
  318.     end
  319.     # 回合分支
  320.     case @phase
  321.     when 1  # 自由战斗回合
  322.       update_phase1
  323.     when 2  # 同伴命令回合
  324.       update_phase2
  325.     when 3  # 角色命令回合
  326.       update_phase3
  327.     when 4  # 主回合
  328.       update_phase4
  329.     when 5  # 战斗结束回合
  330.       update_phase5
  331.     end
  332.   end
  333. end
复制代码

作者: ejenyang    时间: 2008-3-11 04:48
{/pz}还是有错误{/fd}第1个脚本的第262行
大大再看看{/tp}{/tp}
作者: havealook    时间: 2008-3-11 04:50
那把第一个脚本换成:http://rpg.blue/web/htm/news190.htm里面的 [LINE]1,#dddddd[/LINE]系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
作者: ejenyang    时间: 2008-3-11 05:11
{/se}{/se}{/se}搞定了,谢谢{/cy}
把状态栏里的人物去了就更好了{/hx}{/hx}{/hx}{/hx}{/hx}{/hx}




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1