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

Project1

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

[已经过期] 关于战斗显示脸图和CP制战斗的问题

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1971
在线时间
926 小时
注册时间
2015-10-26
帖子
356

开拓者

跳转到指定楼层
1
发表于 2015-11-4 01:11:11 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式

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

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

x
本帖最后由 踢腿水上飘 于 2015-11-4 09:23 编辑

我用的脸图脚本是https://rpg.blue/thread-223765-1-1.html,没有修改……因为没注释,不敢动
然后是CP脚本,https://rpg.blue/thread-237131-1-1.html,被我改成了如图的样子
现在还有2个问题想要解决- - 一个是如右边的图所示,选择攻击目标的时候,对话框吧CP条给遮住了,请教下上面那个对话框如何挪个位子或者放小点?改脚本的哪个地方,咋改- -
第二个是CP战斗条的问题,我想要一个被选中的攻击目标在CP条上有个指示,比方说加个小三角箭头,或者发光,或者变个色,好让我知道我攻击的目标在CP条上的位置
请脚本高手们不吝赐教呀

点评

“你使用”  发表于 2015-11-4 03:59
麻烦拷贝使用的RTAB脚本给我  发表于 2015-11-4 03:59

Lv3.寻梦者

梦石
0
星屑
1971
在线时间
926 小时
注册时间
2015-10-26
帖子
356

开拓者

2
 楼主| 发表于 2015-11-4 09:09:35 | 只看该作者
@赤炎
  1. #RTAB战斗系统 For RPG Maker VX Ace 编写者:SLICK

  2. #encoding:utf-8
  3. #==============================================================================
  4. # ■ Scene_Battle
  5. #------------------------------------------------------------------------------
  6. #  战斗画面
  7. #==============================================================================

  8. class Scene_Battle < Scene_Base
  9.   attr_accessor :cp_quota
  10.   attr_accessor :rtab_wait
  11.   attr_accessor :active_members
  12.   #--------------------------------------------------------------------------
  13.   # ● 开始处理
  14.   #--------------------------------------------------------------------------
  15.   def start
  16.     super
  17.     @cp_quota = 0
  18.     create_spriteset
  19.     create_all_windows
  20.     BattleManager.method_wait_for_message = method(:wait_for_message)
  21.   end
  22.   #--------------------------------------------------------------------------
  23.   # ● 战斗开始
  24.   #--------------------------------------------------------------------------
  25.   def battle_start
  26.     @rtab_wait = true
  27.     @active_members = []
  28.     BattleManager.battle_start
  29.     set_cp_quota
  30.     process_event
  31.     #start_party_command_selection
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● 获取敌我双方人物的平均行动速度并决定CP槽的Quota值
  35.   #--------------------------------------------------------------------------
  36.   def set_cp_quota
  37.     sss = 0.0
  38.     for iii in $game_party.members
  39.       sss += iii.param(6)
  40.     end
  41.     sss /= $game_party.members.size
  42.     @cp_quota = sss * 200
  43.     @spriteset.cp_quota = @cp_quota
  44.     for iii in $game_party.members + $game_troop.members
  45.       iii.cp_quota = @cp_quota
  46.     end
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 进行下一个指令输入
  50.   #--------------------------------------------------------------------------
  51.   def next_command
  52.     if BattleManager.next_command
  53.       start_actor_command_selection
  54.     else
  55.       turn_start(@active_members)
  56.     end
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● 返回上一个指令输入
  60.   #--------------------------------------------------------------------------
  61.   def prior_command
  62.     if BattleManager.prior_command
  63.       start_actor_command_selection
  64.     else
  65.       start_party_command_selection
  66.     end
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # ● 更新画面
  70.   #--------------------------------------------------------------------------
  71.   def update
  72.     super
  73.     if BattleManager.in_turn?
  74.       process_event
  75.       process_action
  76.     else
  77.       if @rtab_wait
  78.         for iii in $game_party.members + $game_troop.members
  79.           iii.in_turn = false
  80.           iii.rtab_cp += iii.param(6)
  81.           if iii.rtab_cp >= iii.cp_quota
  82.             @active_members.push(iii)
  83.             iii.in_turn = true
  84.           end
  85.         end
  86.         if @active_members.size > 0
  87.           @rtab_wait = false
  88.           start_party_command_selection
  89.         end
  90.       end
  91.     end
  92.     BattleManager.judge_win_loss
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ● 回合开始
  96.   #--------------------------------------------------------------------------
  97.   def turn_start(members)
  98.     @party_command_window.close
  99.     @actor_command_window.close
  100.     @status_window.unselect
  101.     @subject = nil
  102.     BattleManager.turn_start(members)
  103.     @log_window.wait
  104.     @log_window.clear
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 回合结束
  108.   #--------------------------------------------------------------------------
  109.   def turn_end
  110.     @active_members.each do |battler|
  111.       battler.on_turn_end
  112.       refresh_status
  113.       @log_window.display_auto_affected_status(battler)
  114.       @log_window.wait_and_clear
  115.     end
  116.     BattleManager.turn_end
  117.     process_event
  118.     @rtab_wait = true
  119.     @active_members = []
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # ● 处理战斗行动
  123.   #--------------------------------------------------------------------------
  124.   def process_action
  125.     return if scene_changing?
  126.     if !@subject || [email protected]_action
  127.       @subject = BattleManager.next_subject
  128.     end
  129.     return turn_end unless @subject
  130.     if @subject.current_action
  131.       @subject.current_action.prepare
  132.       if @subject.current_action.valid?
  133.         @status_window.open
  134.         execute_action
  135.       end
  136.       @subject.remove_current_action
  137.     end
  138.     process_action_end unless @subject.current_action
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● 开始队伍指令的选择
  142.   #--------------------------------------------------------------------------
  143.   def start_party_command_selection
  144.     unless scene_changing?
  145.       refresh_status
  146.       @status_window.unselect
  147.       @status_window.open
  148.       if BattleManager.input_start
  149.         BattleManager.clear_actor
  150.         BattleManager.next_command
  151.         @status_window.select(BattleManager.actor.index)
  152.         @actor_command_window.setup(BattleManager.actor)
  153.       else
  154.         @party_command_window.deactivate
  155.         @actor_command_window.close
  156.         turn_start(@active_members)
  157.       end
  158.     end
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ● 生成角色指令窗口
  162.   #--------------------------------------------------------------------------
  163.   def create_actor_command_window
  164.     @actor_command_window = Window_ActorCommand.new
  165.     @actor_command_window.viewport = @info_viewport
  166.     @actor_command_window.set_handler(:attack, method(:command_attack))
  167.     @actor_command_window.set_handler(:skill,  method(:command_skill))
  168.     @actor_command_window.set_handler(:guard,  method(:command_guard))
  169.     @actor_command_window.set_handler(:item,   method(:command_item))
  170.     @actor_command_window.set_handler(:cancel, method(:prior_command))
  171.     @actor_command_window.set_handler(:escape, method(:command_escape))
  172.     @actor_command_window.x = Graphics.width
  173.   end
  174.   #--------------------------------------------------------------------------
  175.   # ● 指令“撤退”
  176.   #--------------------------------------------------------------------------
  177.   def command_escape
  178.     unless BattleManager.process_escape
  179.       turn_start(@active_members)
  180.       for iii in @active_members
  181.         iii.rtab_cp = 0
  182.       end
  183.     end
  184.   end
  185. end

  186. #encoding:utf-8
  187. #==============================================================================
  188. # ■ Window_ActorCommand
  189. #------------------------------------------------------------------------------
  190. #  战斗画面中,选择角色行动的窗口。
  191. #==============================================================================

  192. class Window_ActorCommand < Window_Command
  193.   #--------------------------------------------------------------------------
  194.   # ● 生成指令列表
  195.   #--------------------------------------------------------------------------
  196.   def make_command_list
  197.     return unless @actor
  198.     add_attack_command
  199.     add_skill_commands
  200.     add_guard_command
  201.     add_item_command
  202.     add_escape_command
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ● 添加撤退指令
  206.   #--------------------------------------------------------------------------
  207.   def add_escape_command
  208.     add_command(Vocab::escape, :escape, BattleManager.can_escape?)
  209.   end
  210. end

  211. #encoding:utf-8
  212. #==============================================================================
  213. # ■ BattleManager
  214. #------------------------------------------------------------------------------
  215. #  战斗过程的管理器。
  216. #==============================================================================

  217. module BattleManager
  218.   #--------------------------------------------------------------------------
  219.   # ● 战斗开始
  220.   #--------------------------------------------------------------------------
  221.   def self.battle_start
  222.     $game_system.battle_count += 1
  223.     $game_party.on_battle_start
  224.     $game_troop.on_battle_start
  225.     $game_troop.enemy_names.each do |name|
  226.       $game_message.add(sprintf(Vocab::Emerge, name))
  227.     end
  228.     if @preemptive
  229.       $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
  230.     elsif @surprise
  231.       $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
  232.     end
  233.     wait_for_message
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # ● 遇敌时的处理
  237.   #--------------------------------------------------------------------------
  238.   def self.on_encounter
  239.     @preemptive = false
  240.     @surprise = false
  241.   end
  242.   #--------------------------------------------------------------------------
  243.   # ● 回合开始
  244.   #--------------------------------------------------------------------------
  245.   def self.turn_start(members)
  246.     @phase = :turn
  247.     clear_actor
  248.     $game_troop.increase_turn(members)
  249.     make_action_orders(members)
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # ● 生成行动顺序
  253.   #--------------------------------------------------------------------------
  254.   def self.make_action_orders(members)
  255.     @action_battlers = []
  256.     for iii in $game_party.members
  257.       if members.include?(iii)
  258.         @action_battlers.push(iii) unless @surprise
  259.       end
  260.     end
  261.     for iii in $game_troop.members
  262.       if members.include?(iii)
  263.         @action_battlers.push(iii) unless @preemptive
  264.       end
  265.     end
  266.     @action_battlers.each {|battler| battler.make_speed }
  267.     @action_battlers.sort! {|a,b| b.speed - a.speed }
  268.   end
  269. end

  270. #encoding:utf-8
  271. #==============================================================================
  272. # ■ Game_Battler
  273. #------------------------------------------------------------------------------
  274. #  处理战斗者的类。Game_Actor 和 Game_Enemy 类的父类。
  275. #==============================================================================

  276. class Game_Battler < Game_BattlerBase
  277.   attr_accessor :turn_count
  278.   attr_accessor :rtab_cp
  279.   attr_accessor :cp_quota
  280.   attr_accessor :in_turn
  281.   #--------------------------------------------------------------------------
  282.   # ● 初始化对象
  283.   #--------------------------------------------------------------------------
  284.   alias neoinitialize initialize
  285.   def initialize
  286.     @turn_count = 0
  287.     @rtab_cp = 0
  288.     @cp_quota = 100
  289.     @in_turn = false
  290.     neoinitialize
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # ● 战斗开始处理
  294.   #--------------------------------------------------------------------------
  295.   def on_battle_start
  296.     @turn_count = 0
  297.     @rtab_cp = 0
  298.     @cp_quota = 100
  299.     @in_turn = false
  300.     init_tp unless preserve_tp?
  301.   end
  302.   #--------------------------------------------------------------------------
  303.   # ● 处理伤害
  304.   #    调用前需要设置好
  305.   #    @result.hp_damage   @result.mp_damage
  306.   #    @result.hp_drain    @result.mp_drain
  307.   #--------------------------------------------------------------------------
  308.   def execute_damage(user)
  309.     on_damage(@result.hp_damage) if @result.hp_damage > 0
  310.     self.hp -= @result.hp_damage
  311.     self.mp -= @result.mp_damage
  312.     user.hp += @result.hp_drain
  313.     user.mp += @result.mp_drain
  314.     # 受伤后计算CP退后量
  315.     cpback = @result.hp_damage + @result.mp_damage
  316.     cpback = (cpback < 0 ? 0 : cpback)
  317.     pent = 100.0 * cpback / self.mhp
  318.     cppentback = ((5 + pent / 10) * self.cp_quota / 100).to_i
  319.     @rtab_cp -= cppentback
  320.     @rtab_cp = (@rtab_cp < 0 ? 0 : @rtab_cp)
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● 判定是否可以输入指令
  324.   #--------------------------------------------------------------------------
  325.   def inputable?
  326.     normal? && !auto_battle? && @in_turn
  327.   end
  328.   #--------------------------------------------------------------------------
  329.   # ● 回合结束处理
  330.   #--------------------------------------------------------------------------
  331.   def on_turn_end
  332.     @result.clear
  333.     regenerate_all
  334.     update_state_turns
  335.     update_buff_turns
  336.     remove_states_auto(2)
  337.     # 该角色的回合计数加1并清空CP
  338.     @turn_count += 1
  339.     @rtab_cp = 0
  340.   end
  341. end

  342. #encoding:utf-8
  343. #==============================================================================
  344. # ■ Game_Troop
  345. #------------------------------------------------------------------------------
  346. #  管理敌群和战斗相关资料的类,也可执行如战斗事件管理之类的功能。
  347. #   本类的实例请参考 $game_troop 。
  348. #==============================================================================

  349. class Game_Troop < Game_Unit
  350.   #--------------------------------------------------------------------------
  351.   # ● 增加回合
  352.   #--------------------------------------------------------------------------
  353.   def increase_turn(members)
  354.     troop.pages.each {|page| @event_flags= false if page.span == 1 }
  355.     turnmax = []
  356.     for iii in members
  357.       turnmax.push(iii.turn_count)
  358.     end
  359.     @turn_count = turnmax.max
  360.   end
  361. end

  362. #encoding:utf-8
  363. #==============================================================================
  364. # ■ Spriteset_Battle
  365. #------------------------------------------------------------------------------
  366. #  处理战斗画面的精灵的类。本类在 Scene_Battle 类的内部使用。
  367. #==============================================================================

  368. class Spriteset_Battle
  369.   attr_accessor :icons
  370.   attr_accessor :cp_quota
  371.   #--------------------------------------------------------------------------
  372.   # ● 初始化对象
  373.   #--------------------------------------------------------------------------
  374.   def initialize
  375.     @cp_quota = 100
  376.     create_viewports
  377.     create_battleback1
  378.     create_battleback2
  379.     create_enemies
  380.     create_actors
  381.     create_pictures
  382.     create_timer
  383.     create_rtabcp_gauge
  384.     update
  385.   end
  386.   #--------------------------------------------------------------------------
  387.   # ● 生成战斗CP条
  388.   #--------------------------------------------------------------------------
  389.   def create_rtabcp_gauge
  390.     @cpgauge_back = Sprite.new(@viewport3)
  391.     @cpgauge_back.bitmap = Bitmap.new("Graphics/System/CP.png")
  392.     @cpgauge_back.x = 105
  393.     @cpgauge_back.y = 16
  394.     # 为战斗中的各个角色生成其图标
  395.   @icons = {}  
  396.     for iii in $game_party.members
  397.       @icons[iii] = Sprite.new(@viewport3)
  398.       @icons[iii].bitmap = Bitmap.new("Graphics/Characters/"+iii.character_name)
  399.       @icons[iii].ox = 12
  400.       @icons[iii].oy = 12
  401.       @icons[iii].x = 16
  402.       @icons[iii].y = 20
  403.       index = iii.character_index * 3
  404.       indey = index > 9 ? 4 : 0
  405.       index = index - 12 if index > 9
  406.       if iii.character_name.include?(')
  407.         cw = @icons[iii].bitmap.width / 3
  408.         ch = @icons[iii].bitmap.height / 4
  409.         @icons[iii].src_rect.set(index % 3 * 32 + cw, index / 4 * 32, cw, ch)
  410.       else
  411.         cw = @icons[iii].bitmap.width / 12
  412.         ch = @icons[iii].bitmap.height / 8
  413.         @icons[iii].src_rect.set(index * 32 + cw, indey * 32, cw, ch)
  414.       end  
  415.     end
  416.     for iii in $game_troop.members
  417.       @icons[iii] = Sprite.new(@viewport3)
  418.       @icons[iii].bitmap = Bitmap.new("Graphics/System/bicon2.png")
  419.       @icons[iii].ox = 12  
  420.       @icons[iii].oy = 12
  421.       @icons[iii].x = 16
  422.       @icons[iii].y = 20
  423.     end
  424.   end
  425.   #--------------------------------------------------------------------------
  426.   # ● 释放
  427.   #--------------------------------------------------------------------------
  428.   def dispose
  429.     dispose_battleback1
  430.     dispose_battleback2
  431.     dispose_enemies
  432.     dispose_actors
  433.     dispose_pictures
  434.     dispose_timer
  435.     dispose_viewports
  436.     dispose_rtabcp_gauge
  437.   end
  438.   #--------------------------------------------------------------------------
  439.   # ● 消灭战斗CP条
  440.   #--------------------------------------------------------------------------
  441.   def dispose_rtabcp_gauge
  442.     @cpgauge_back.bitmap.dispose
  443.     @cpgauge_back.dispose
  444.     for iii in $game_party.members
  445.       @icons[iii].bitmap.dispose
  446.       @icons[iii].dispose
  447.     end
  448.     for iii in $game_troop.members
  449.       @icons[iii].bitmap.dispose
  450.       @icons[iii].dispose
  451.     end
  452.   end
  453.   #--------------------------------------------------------------------------
  454.   # ● 更新画面
  455.   #--------------------------------------------------------------------------
  456.   def update
  457.     update_battleback1
  458.     update_battleback2
  459.     update_enemies
  460.     update_actors
  461.     update_cp
  462.     update_pictures
  463.     update_timer
  464.     update_viewports
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # ● 更新CP条
  468.   #--------------------------------------------------------------------------
  469.   def update_cp
  470.     for iii in $game_party.members + $game_troop.members
  471.       @icons[iii].x = 105 + 400 * iii.rtab_cp / @cp_quota
  472.       @icons[iii].visible = iii.alive?
  473.     end
  474.   end
  475. end
复制代码
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-17 04:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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