设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2233|回复: 4
打印 上一主题 下一主题

[已经过期] 请各位超级脚本高手解决我以下几个问题!

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7718
在线时间
944 小时
注册时间
2015-2-10
帖子
248
跳转到指定楼层
1
发表于 2015-6-16 09:53:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
我正在制作一款游戏,不过我想实现几个功能,行不?
①行动方式转变功能:地图上有一些敌人NPC,主角碰到后开始战斗,不过这些敌人在地图上一开始是随机移动,等主角来到一定范围内时,敌人NPC会播放一次“惊讶”特效,然后立即变为跟随主角的行动,等主角逃离敌人视线后,敌人又会变为随机移动。(已有脚本可以实现,不过不会显示“惊讶”的特效)
②装备特效:装备一些特殊的装备后,会获得技能。
③新的数值:在HP和SP值下面还有一个叫CP的值,这个值最大上限是200,普通攻击敌人或遭到敌人攻击会上升(最好还可以显示色条),在使用一些技能时会消耗CP。(已有脚本可以实现,不过没有实现遭到攻击时或攻击时会上升的效果)
④特殊开头:开头会有一段动画(可以用特效代替),然后动画完了就会出现开始游戏的按钮选项,不过只有这一个选项,其它的继续游戏和退出游戏选项消失。(已有脚本可以实现,不过这原来的两个脚本,有冲突,希望可以合并一下)
⑤多队员系统:会有4个以上的队员,在战斗中可以更换队员,且使用物品和装备时可以显示全部队员。(已有脚本可以实现,不过以前的那个脚本在使用物品或装备时只能显示4个人)
⑥更改战斗渐变:可以使用某个脚本的命令,随时变更游戏中战斗开始时的渐变。
其实总体来说不难实现,其实前5个脚本以前都有可以实现的,不过还是缺了几个我要的功能,请各位高手帮忙!(当然了,这几个脚本不能冲突)

Lv3.寻梦者

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
帖子
1516
2
发表于 2015-6-16 10:57:31 | 只看该作者
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7718
在线时间
944 小时
注册时间
2015-2-10
帖子
248
3
 楼主| 发表于 2015-6-16 16:05:23 | 只看该作者
汪汪 发表于 2015-6-16 10:57
1. https://rpg.blue/forum.php?mod=viewthread&tid=238914
2. https://rpg.blue/forum.php?mod=view ...


这个就是⑤的脚本,请高手根据要求修改一下。
RUBY 代码复制
  1. module LimBattlePlug
  2.  
  3. # 队伍最大人数
  4. MaxPartySize = 12 #自己修改最大人数
  5.  
  6. # 出战人数
  7. MaxBattlerSize = 4
  8.  
  9. # 换人语句
  10. WordChangeBattler = "切换人物"
  11.  
  12. # 换人时播放的动画
  13. AnimationChangeBattler = 153
  14.  
  15. end
  16.  
  17. class Game_BattleAction
  18. attr_accessor :change_to_battler
  19. # 初始化
  20. alias lbp_initialize initialize
  21. def initialize
  22. lbp_initialize
  23. @change_to_battler = 0
  24. end
  25. # 欲更换角色编号
  26. def set_change_battler
  27. @kind = 3
  28. end
  29. # 判断行动是否为更换角色
  30. def is_change_battler?
  31. return (@kind == 3)
  32. end
  33. end
  34.  
  35. class Game_Party
  36. include LimBattlePlug
  37. attr_reader :actors2
  38. alias lpb_initialize initialize
  39. def initialize
  40. lpb_initialize
  41. @actors2 = []
  42. end
  43. # 角色加入
  44. def add_actor(actor_id)
  45. actor = $game_actors[actor_id]
  46. if @actors.size < MaxPartySize and not @actors.include?(actor)
  47. @actors.push(actor)
  48. $game_player.refresh
  49. end
  50. end
  51. # 设置战斗的角色
  52. def set_actor_to_battle
  53. @actors2 = []
  54. @actors.each do |actor|
  55. @actors2.push(actor)
  56. end
  57. @actors = []
  58. @actors2.each do |actor|
  59. @actors.push(actor)
  60. break if @actors.size == MaxBattlerSize
  61. end
  62. end
  63. # 还原战斗的角色
  64. def set_actor_to_normal
  65. @actors = []
  66. @actors2.each do |actor|
  67. @actors.push(actor)
  68. end
  69. end
  70. # 获取角色id数组
  71. def get_actors_id
  72. id = []
  73. @actors.each{|actor|id.push(actor.id)}
  74. return id
  75. end
  76. # 获取角色id数组
  77. def get_actors2_id
  78. id = []
  79. @actors2.each{|actor|id.push(actor.id)}
  80. return id
  81. end
  82. # 兑换角色
  83. def change_actor(index,id)
  84. @actors[index] = $game_actors[id]
  85. end
  86. # 全灭判定
  87. def all_dead?
  88. # 同伴人数为 0 的情况下
  89. if $game_party.actors.size == 0
  90. return false
  91. end
  92. # 同伴中无人 HP 在 0 以上
  93. for actor in @actors2
  94. if actor.hp > 0
  95. return false
  96. end
  97. end
  98. for actor in @actors
  99. if actor.hp > 0
  100. return false
  101. end
  102. end
  103. # 全灭
  104. return true
  105. end
  106. # 其他角色
  107. def other_actors
  108. actors = []
  109. @actors2.each{|actor|actors.push(actor) if !@actors.include?(actor)}
  110. return actors
  111. end
  112. # 角色位置互换
  113. def change_actor_pos(id1,id2)
  114. actor_id = []
  115. @actors.each do |actor|
  116. actor_id.push(actor.id)
  117. end
  118. return if !actor_id.include?(id1) and !actor_id.include?(id2)
  119. id1_index = id2_index = -1
  120. (0...actor_id.size).each do |i|
  121. if actor_id[i] == id1
  122. id1_index = i
  123. elsif actor_id[i] == id2
  124. id2_index = i
  125. end
  126. end
  127. temp_actor = @actors[id1_index]
  128. @actors[id1_index] = @actors[id2_index]
  129. @actors[id2_index] = temp_actor
  130. end
  131. end
  132.  
  133. class Window_Actor < Window_Selectable
  134. # 初始化
  135. def initialize
  136. super(0,64,640,256)
  137. self.back_opacity = 160
  138. refresh
  139. self.index = -1
  140. self.active = false
  141. end
  142. # 刷新
  143. def refresh
  144. @item_max = $game_party.actors2.size
  145. @data = []
  146. $game_party.actors.each do |actor|
  147. @data.push(actor)
  148. end
  149. $game_party.actors2.each do |actor|
  150. @data.push(actor) if !@data.include?(actor)
  151. end
  152. if self.contents != nil
  153. self.contents.clear
  154. self.contents = nil
  155. end
  156. self.contents = Bitmap.new(608,@data.size*32)
  157. x = 4
  158. y = 0
  159. @data.each do |actor|
  160. bitmap = RPG::Cache.character(actor.character_name,actor.character_hue)
  161. rect = Rect.new(0,0,bitmap.width/4,31)
  162. self.contents.blt(x+16-bitmap.width/8,y,bitmap,rect)
  163. draw_actor_name(actor,x+36,y)
  164. draw_actor_state(actor,156,y)
  165. draw_actor_hp(actor,x+256,y,96)
  166. draw_actor_sp(actor,x+376,y,96)
  167. if $game_party.actors.include?(actor)
  168. self.contents.font.color = text_color(1)
  169. cword = "出战"
  170. else
  171. self.contents.font.color = text_color(0)
  172. cword = "待战"
  173. end
  174. self.contents.draw_text(x+496,y,60,32,cword)
  175. y += 32
  176. end
  177. end
  178. # 获取当前角色编号
  179. def actor_id
  180. return @data[self.index].id
  181. end
  182. # 刷新帮助
  183. def update_help
  184. @help_window.set_text(@data[self.index] == nil ?\
  185. "" : @data[self.index].name)
  186. end
  187. end
  188.  
  189. class Scene_Battle
  190. include LimBattlePlug
  191. # 初始化
  192. def initialize
  193. $game_party.set_actor_to_battle
  194. end
  195. # 主处理
  196. def main
  197. # 初始化战斗用的各种暂时数据
  198. $game_temp.in_battle = true
  199. $game_temp.battle_turn = 0
  200. $game_temp.battle_event_flags.clear
  201. $game_temp.battle_abort = false
  202. $game_temp.battle_main_phase = false
  203. $game_temp.battleback_name = $game_map.battleback_name
  204. $game_temp.forcing_battler = nil
  205. # 初始化战斗用事件解释器
  206. $game_system.battle_interpreter.setup(nil, 0)
  207. # 准备队伍
  208. @troop_id = $game_temp.battle_troop_id
  209. $game_troop.setup(@troop_id)
  210. # 生成角色命令窗口
  211. s1 = $data_system.words.attack
  212. s2 = $data_system.words.skill
  213. s3 = $data_system.words.guard
  214. s4 = $data_system.words.item
  215. s5 = WordChangeBattler
  216. @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,s5])
  217. @actor_command_window.y = 128
  218. @actor_command_window.back_opacity = 160
  219. @actor_command_window.active = false
  220. @actor_command_window.visible = false
  221. # 生成其它窗口
  222. @party_command_window = Window_PartyCommand.new
  223. @help_window = Window_Help.new
  224. @help_window.back_opacity = 160
  225. @help_window.visible = false
  226. @status_window = Window_BattleStatus.new
  227. @message_window = Window_Message.new
  228. # 生成活动块
  229. @spriteset = Spriteset_Battle.new
  230. # 初始化等待计数
  231. @wait_count = 0
  232. # 执行过渡
  233. if $data_system.battle_transition == ""
  234. Graphics.transition(20)
  235. else
  236. Graphics.transition(40, "Graphics/Transitions/" +
  237. $data_system.battle_transition)
  238. end
  239. # 开始自由战斗回合
  240. start_phase1
  241. # 主循环
  242. loop do
  243. # 刷新游戏画面
  244. Graphics.update
  245. # 刷新输入信息
  246. Input.update
  247. # 刷新画面
  248. update
  249. # 如果画面切换的话就中断循环
  250. if $scene != self
  251. break
  252. end
  253. end
  254. # 刷新地图
  255. $game_map.refresh
  256. # 准备过渡
  257. Graphics.freeze
  258. # 释放窗口
  259. @actor_command_window.dispose
  260. @party_command_window.dispose
  261. @help_window.dispose
  262. @status_window.dispose
  263. @message_window.dispose
  264. if @skill_window != nil
  265. @skill_window.dispose
  266. end
  267. if @item_window != nil
  268. @item_window.dispose
  269. end
  270. if @actor_window != nil
  271. @actor_window.dispose
  272. end
  273. if @result_window != nil
  274. @result_window.dispose
  275. end
  276. # 释放活动块
  277. @spriteset.dispose
  278. # 标题画面切换中的情况
  279. if $scene.is_a?(Scene_Title)
  280. # 淡入淡出画面
  281. Graphics.transition
  282. Graphics.freeze
  283. end
  284. # 战斗测试或者游戏结束以外的画面切换中的情况
  285. if $BTEST and not $scene.is_a?(Scene_Gameover)
  286. $scene = nil
  287. end
  288. end
  289. # 战斗结束
  290. alias lpb_battle_end battle_end
  291. def battle_end(n)
  292. lpb_battle_end(n)
  293. $game_party.set_actor_to_normal
  294. end
  295. # 开始回合3
  296. alias lbp_start_phase3 start_phase3
  297. def start_phase3
  298. @changed_battler_id = []
  299. lbp_start_phase3
  300. end
  301. # 刷新角色命令回合画面
  302. def update_phase3
  303. # 敌人光标有效的情况下
  304. if @enemy_arrow != nil
  305. update_phase3_enemy_select
  306. # 角色光标有效的情况下
  307. elsif @actor_arrow != nil
  308. update_phase3_actor_select
  309. # 特技窗口有效的情况下
  310. elsif @skill_window != nil
  311. update_phase3_skill_select
  312. # 物品窗口有效的情况下
  313. elsif @item_window != nil
  314. update_phase3_item_select
  315. elsif @actor_window != nil
  316. update_phase3_battler_select
  317. # 角色指令窗口有效的情况下
  318. elsif @actor_command_window.active
  319. update_phase3_basic_command
  320. end
  321. end
  322. # 角色基本命令
  323. def update_phase3_basic_command
  324. # 按下 B 键的情况下
  325. if Input.trigger?(Input::B)
  326. # 演奏取消 SE
  327. $game_system.se_play($data_system.cancel_se)
  328. # 转向前一个角色的指令输入
  329. phase3_prior_actor
  330. return
  331. end
  332. # 按下 C 键的情况下
  333. if Input.trigger?(Input::C)
  334. # 角色指令窗口光标位置分之
  335. case @actor_command_window.index
  336. when 0 # 攻击
  337. # 演奏确定 SE
  338. $game_system.se_play($data_system.decision_se)
  339. # 设置行动
  340. @active_battler.current_action.kind = 0
  341. @active_battler.current_action.basic = 0
  342. # 开始选择敌人
  343. start_enemy_select
  344. when 1 # 特技
  345. # 演奏确定 SE
  346. $game_system.se_play($data_system.decision_se)
  347. # 设置行动
  348. @active_battler.current_action.kind = 1
  349. # 开始选择特技
  350. start_skill_select
  351. when 2 # 防御
  352. # 演奏确定 SE
  353. $game_system.se_play($data_system.decision_se)
  354. # 设置行动
  355. @active_battler.current_action.kind = 0
  356. @active_battler.current_action.basic = 1
  357. # 转向下一位角色的指令输入
  358. phase3_next_actor
  359. when 3 # 物品
  360. # 演奏确定 SE
  361. $game_system.se_play($data_system.decision_se)
  362. # 设置行动
  363. @active_battler.current_action.kind = 2
  364. # 开始选择物品
  365. start_item_select
  366. when 4 # 换人
  367. $game_system.se_play($data_system.decision_se)
  368. @active_battler.current_action.set_change_battler
  369. start_battler_select
  370. end
  371. return
  372. end
  373. end
  374. # 开始角色选择
  375. def start_battler_select
  376. @actor_window = Window_Actor.new
  377. @actor_window.active = true
  378. @actor_window.index = 0
  379. @actor_window.help_window = @help_window
  380. @actor_command_window.active = false
  381. @actor_command_window.visible = false
  382. end
  383. # 结束角色选择
  384. def end_battler_select
  385. @actor_window.dispose
  386. @actor_window = nil
  387. @help_window.visible = false
  388. @actor_command_window.active = true
  389. @actor_command_window.visible = true
  390. end
  391. # 刷新角色选择
  392. def update_phase3_battler_select
  393. @actor_window.visible = true
  394. @actor_window.update
  395. if Input.trigger?(Input::B)
  396. $game_system.se_play($data_system.cancel_se)
  397. end_battler_select
  398. return
  399. end
  400. if Input.trigger?(Input::C)
  401. actor_id = @actor_window.actor_id
  402. if $game_party.get_actors_id.include?(actor_id) or
  403. $game_actors[actor_id].dead? or
  404. @changed_battler_id.include?(actor_id)
  405. $game_system.se_play($data_system.buzzer_se)
  406. return
  407. end
  408. $game_system.se_play($data_system.decision_se)
  409. @active_battler.current_action.change_to_battler = actor_id
  410. @changed_battler_id.push(actor_id)
  411. end_battler_select
  412. phase3_next_actor
  413. return
  414. end
  415. end
  416. # 行动方动画
  417. def update_phase4_step3
  418. if @active_battler.current_action.is_change_battler?
  419. @animation1_id = AnimationChangeBattler
  420. @target_battlers = []
  421. end
  422. # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  423. if @animation1_id == 0
  424. @active_battler.white_flash = true
  425. else
  426. @active_battler.animation_id = @animation1_id
  427. @active_battler.animation_hit = true
  428. end
  429. # 移至步骤 4
  430. @phase4_step = 4
  431. end
  432. # 对象方动画
  433. def update_phase4_step4
  434. if @active_battler.current_action.is_change_battler?
  435. actor1_id = @active_battler.current_action.change_to_battler
  436. actor2_id = @active_battler.id
  437. (0...$game_party.actors.size).each do |i|
  438. if $game_party.actors[i].id == actor2_id
  439. $game_party.change_actor(i,actor1_id)
  440. @active_battler = $game_actors[actor1_id]
  441. @status_window.refresh
  442. end
  443. end
  444. end
  445. # 对像方动画
  446. for target in @target_battlers
  447. target.animation_id = @animation2_id
  448. target.animation_hit = (target.damage != "Miss")
  449. end
  450. # 限制动画长度、最低 8 帧
  451. @wait_count = 8
  452. # 移至步骤 5
  453. @phase4_step = 5
  454. end
  455. # 公共事件
  456. def update_phase4_step6
  457. @target_battlers.each do |target|
  458. if target.is_a?(Game_Actor) and target.dead? and
  459. !$game_party.other_actors.all?{|actor|actor.dead?}
  460. @actor_window = Window_Actor.new
  461. @actor_window.index = 0
  462. @actor_window.active = true
  463. @actor_window.help_window = @help_window
  464. actor_id = -1
  465. loop do
  466. Graphics.update
  467. Input.update
  468. @actor_window.update
  469. if Input.trigger?(Input::C)
  470. actor = $game_actors[@actor_window.actor_id]
  471. if actor.dead? or
  472. (@changed_battler_id.include?(actor.id) and
  473. target.current_action.change_to_battler != actor.id) or
  474. $game_party.actors.include?(actor)
  475. $game_system.se_play($data_system.buzzer_se)
  476. else
  477. actor_id = actor.id
  478. end
  479. end
  480. break if actor_id >= 0
  481. end
  482. @actor_window.visible = false
  483. @actor_window.dispose
  484. @actor_window = nil
  485. @help_window.visible = false
  486. (0...$game_party.actors.size).each do |i|
  487. if $game_party.actors[i].id == target.id
  488. $game_party.change_actor(i,actor_id)
  489. @status_window.refresh
  490. end
  491. end
  492. end
  493. end
  494. # 清除强制行动对像的战斗者
  495. $game_temp.forcing_battler = nil
  496. # 公共事件 ID 有效的情况下
  497. if @common_event_id > 0
  498. # 设置事件
  499. common_event = $data_common_events[@common_event_id]
  500. $game_system.battle_interpreter.setup(common_event.list, 0)
  501. end
  502. # 移至步骤 1
  503. @phase4_step = 1
  504. end
  505. end
  506.  
  507. class Window_MenuStatus
  508. def refresh
  509. self.contents.clear
  510. @item_max = $game_party.actors.size
  511. for i in 0...$game_party.actors.size
  512. x = 4
  513. y = i * 32
  514. actor = $game_party.actors[i]
  515. bitmap = RPG::Cache.character(actor.character_name,actor.character_hue)
  516. rect = Rect.new(0,0,bitmap.width/4,31)
  517. self.contents.blt(x+16-bitmap.width/8,y,bitmap,rect)
  518. draw_actor_name(actor, x+36, y)
  519. draw_actor_state(actor, x + 136,y)
  520. draw_actor_hp(actor, x + 236, y,96)
  521. draw_actor_sp(actor, x + 336, y,96)
  522. end
  523. end
  524. def update_cursor_rect
  525. super
  526. end
  527. end

回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7718
在线时间
944 小时
注册时间
2015-2-10
帖子
248
4
 楼主| 发表于 2015-6-16 16:13:15 | 只看该作者
汪汪 发表于 2015-6-16 10:57
1. https://rpg.blue/forum.php?mod=viewthread&tid=238914
2. https://rpg.blue/forum.php?mod=view ...

其实③的问题你可以去解决如何普通攻击或被攻击就增加SP。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
76
在线时间
1379 小时
注册时间
2012-7-5
帖子
1698

开拓者

5
发表于 2015-6-16 16:44:51 | 只看该作者
fbeds 发表于 2015-6-16 16:05
这个就是⑤的脚本,请高手根据要求修改一下。
module LimBattlePlug
  1. class Window_Target < Window_Selectable
  2.   def refresh
  3.     self.contents.clear
  4.     for i in 0...$game_party.actors.size
  5.       x = 4
  6.       y = i * 32
  7.       actor = $game_party.actors[i]
  8.       draw_actor_name(actor, x, y)
  9.       draw_actor_hp(actor, x + 96, y, 96)
  10.       draw_actor_sp(actor, x + 196, y, 96)
  11.     end
  12.   end
  13.   def update_cursor_rect
  14.     # 光标位置 -1 为全选、-2 以下为单独选择 (使用者自身)
  15.     if @index <= -2
  16.       self.cursor_rect.set(0, (@index + 10) * 116, self.width - 32, 96)
  17.     elsif @index == -1
  18.       self.cursor_rect.set(0, 0, self.width - 32, @item_max * 32)
  19.     else
  20.       self.cursor_rect.set(0, @index * 32, self.width - 32, 32)
  21.     end
  22.   end
  23. end
复制代码
即插即用(不要删掉原来的⑤脚本)

  -fk: -azogi:
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-23 03:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表