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

Project1

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

[已经解决] 图标战斗BUG求教

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
62 小时
注册时间
2011-10-2
帖子
25
跳转到指定楼层
1
发表于 2014-6-20 21:49:45 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

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

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

x
最近刚开始学完C
然后就开始研究Ruby  不过刚入坑还不是很清楚
然后用了这个图标战斗脚本
  1. #==========================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==========================================================================

  4. module Momo_IconCommand
  5.   # 图标名称设定
  6.   ATTACK_ICON_NAME = "hud1" # 攻撃
  7.   SKILL_ICON_NAME = "hud2"   # 特技
  8.   GUARD_ICON_NAME = "hud3"  # 防御
  9.   ITEM_ICON_NAME = "hud4"     # 物品
  10.   ESCAPE_ICON_NAME = "hud5"  
  11.   # X坐标修正
  12.   X_PLUS = -48
  13.   # Y坐标修正
  14.   Y_PLUS = -85
  15.   # 选择时图标的动作
  16.   # 0:静止 1:放大
  17.   SELECT_TYPE = 1
  18.   # 闪烁时光芒的颜色
  19.   FLASH_COLOR = Color.new(255, 255, 255, 128)
  20.   # 闪烁时间
  21.   FLASH_DURATION = 10
  22.   # 闪烁间隔
  23.   FLASH_INTERVAL = 20
  24.   # 是否写出文字的名称
  25.   COM_NAME_DROW = true
  26.   # 文字名称是否移动
  27.   COM_NAME_MOVE = true
  28.   # 文字内容
  29.   ATTACK_NAME = "攻击"    # 攻击
  30.   SKILL_NAME = "特技"   # 特技
  31.   GUARD_NAME = "休息"     # 防御
  32.   ITEM_NAME = "物品"  # 物品
  33.   ESCAPE_NAME = "逃跑"
  34.   # 文字颜色
  35.   COM_NAME_COLOR = Color.new(255, 255, 255, 255)
  36.   # 文字坐标修正
  37.   COM_NAME_X_PLUS = 0
  38.   COM_NAME_Y_PLUS = 0
  39. end

  40. class Window_CommandIcon < Window_Selectable
  41.   attr_accessor :last_index
  42.   #------------------------------------------------------------------------
  43.   # ● オブジェクト初期化
  44.   #------------------------------------------------------------------------
  45.   def initialize(x, y, commands)
  46.     super(x, y, 32, 32)
  47.     # ウィンドウスキンに空文字列を指定してウィンドウを描画しないようにする
  48.     self.windowskin = RPG::Cache.windowskin("")
  49.     @item_max = commands.size
  50.     @commands = commands
  51.     @column_max = commands.size
  52.     @index = 0
  53.     @last_index = nil
  54.     @name_sprite = nil
  55.     @sprite = []
  56.     refresh
  57.   end
  58.   def dispose
  59.     super
  60.     for sprite in @sprite
  61.       sprite.dispose unless sprite.nil?
  62.     end
  63.     @name_sprite.dispose unless @name_sprite.nil?
  64.   end
  65.   #------------------------------------------------------------------------
  66.   # ● リフレッシュ
  67.   #------------------------------------------------------------------------
  68.   def refresh
  69.     @name_sprite.dispose unless @name_sprite.nil?
  70.     for sprite in @sprite
  71.       sprite.dispose unless sprite.nil?
  72.     end
  73.     @name_sprite = nil
  74.     draw_com_name if Momo_IconCommand::COM_NAME_DROW
  75.     @sprite = []
  76.     for i in 0...@item_max
  77.       draw_item(i)
  78.     end
  79.   end
  80.   #------------------------------------------------------------------------
  81.   # ● 項目の描画
  82.   #------------------------------------------------------------------------
  83.   def draw_item(index)
  84.     @sprite[index] = Sprite_Icon.new(nil, @commands[index])
  85.     @sprite[index].z = self.z + 1
  86.   end
  87.   def draw_com_name
  88.     @name_sprite = Sprite_Comm_Name.new(nil, get_com_name)
  89.    
  90.   end
  91.   
  92.   # 更新
  93.   def update
  94.     super
  95.     icon_update
  96.     com_name_update if Momo_IconCommand::COM_NAME_DROW
  97.     if move_index?
  98.       @last_index = self.index
  99.     end
  100.   end
  101.   # アイコンの更新
  102.   def icon_update
  103.     for i in [email protected]
  104.       @sprite[i].active = (self.index == i)
  105.       @sprite[i].x = self.x + i * 24
  106.       @sprite[i].y = self.y + 0
  107.       @sprite[i].z = (self.index == i) ? self.z + 2 : self.z + 1
  108.       @sprite[i].visible = self.visible
  109.       @sprite[i].update
  110.     end
  111.   end
  112.   # コマンドネームの更新
  113.   def com_name_update
  114.     if move_index?
  115.       @name_sprite.name = get_com_name
  116.     end
  117.     @name_sprite.x = self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS
  118.     @name_sprite.y = self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS
  119.     @name_sprite.z = self.z + 1
  120.     @name_sprite.active = self.active
  121.     @name_sprite.visible = self.visible
  122.     @name_sprite.update
  123.   end
  124.   def get_com_name
  125.     make_name_set if @name_set.nil?
  126.     name = @name_set[self.index]
  127.     name = "" if name.nil?
  128.     return name
  129.   end
  130.   def make_name_set
  131.     @name_set = []
  132.     @name_set[0] = Momo_IconCommand::ATTACK_NAME
  133.     @name_set[1] = Momo_IconCommand::SKILL_NAME
  134.     @name_set[2] = Momo_IconCommand::GUARD_NAME
  135.     @name_set[3] = Momo_IconCommand::ITEM_NAME
  136.     @name_set[4] = Momo_IconCommand::ESCAPE_NAME
  137.   end
  138.   def move_index?
  139.     return self.index != @last_index
  140.   end
  141.   def need_reset
  142.     @name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROW
  143.   end
  144. end

  145. # アイコン用スプライト
  146. class Sprite_Icon < Sprite
  147.   attr_accessor :active
  148.   attr_accessor :icon_name
  149.   #------------------------------------------------------------------------
  150.   # ● オブジェクト初期化
  151.   #------------------------------------------------------------------------
  152.   def initialize(viewport, icon_name)
  153.     super(viewport)
  154.     @icon_name = icon_name
  155.     @last_icon = @icon_name
  156.     @count = 0
  157.     self.bitmap = RPG::Cache.icon(@icon_name)
  158.     self.ox = self.bitmap.width / 2
  159.     self.oy = self.bitmap.height / 2
  160.     @active = false
  161.   end
  162.   #------------------------------------------------------------------------
  163.   # ● 解放
  164.   #------------------------------------------------------------------------
  165.   def dispose
  166.     if self.bitmap != nil
  167.       self.bitmap.dispose
  168.     end
  169.     super
  170.   end
  171.   #------------------------------------------------------------------------
  172.   # ● フレーム更新
  173.   #------------------------------------------------------------------------
  174.   def update
  175.     super
  176.     if @icon_name != @last_icon
  177.       @last_icon = @icon_name
  178.       self.bitmap = RPG::Cache.icon(@icon_name)
  179.     end
  180.     if @active
  181.       @count += 1
  182.       case Momo_IconCommand::SELECT_TYPE
  183.       when 0
  184.         icon_flash
  185.       when 1
  186.         icon_zoom
  187.       end
  188.       @count = 0 if @count == 30
  189.     else
  190.       icon_reset
  191.     end
  192.   end
  193.   def icon_flash
  194.     if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 1
  195.       self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION)
  196.     end
  197.   end
  198.   def icon_zoom
  199.     case @count
  200.     when 1..15
  201.       zoom = 1.0 + @count / 30.0
  202.     when 16..30
  203.       zoom = 1.5 - (@count - 15) / 30.0
  204.     end
  205.     self.zoom_x = zoom
  206.     self.zoom_y = zoom
  207.   end
  208.   def icon_reset
  209.     @count = 0
  210.     self.zoom_x = 1.0
  211.     self.zoom_y = 1.0
  212.   end
  213. end

  214. # コマンドネーム用スプライト
  215. class Sprite_Comm_Name < Sprite
  216.   attr_accessor :active
  217.   attr_accessor :name
  218.   attr_accessor :need_reset
  219.   #------------------------------------------------------------------------
  220.   # ● オブジェクト初期化
  221.   #------------------------------------------------------------------------
  222.   def initialize(viewport, name)
  223.     super(viewport)
  224.     @name = name
  225.     @last_name = nil
  226.     @count = 0
  227.     @x_plus = 0
  228.     @opa_plus = 0
  229.     @need_reset = false
  230.     @active = false
  231.     self.bitmap = Bitmap.new(160, 32)
  232.   end
  233.   #------------------------------------------------------------------------
  234.   # ● 解放
  235.   #------------------------------------------------------------------------
  236.   def dispose
  237.     if self.bitmap != nil
  238.       self.bitmap.dispose
  239.     end
  240.     super
  241.   end
  242.   #------------------------------------------------------------------------
  243.   # ● フレーム更新
  244.   #------------------------------------------------------------------------
  245.   def update
  246.     super
  247.     if @active
  248.       if need_reset?
  249.         @need_reset = false
  250.         @last_name = @name
  251.         text_reset
  252.       end
  253.       move_text if Momo_IconCommand::COM_NAME_MOVE
  254.     end
  255.   end
  256.   def move_text
  257.     @count += 1
  258.     @x_plus = [@count * 8, 80].min
  259.     self.x = self.x - 80 + @x_plus
  260.     self.opacity = @count * 25
  261.   end
  262.   def text_reset
  263.     @count = 0
  264.     @x_plus = 0
  265.     self.bitmap.clear
  266.     self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR
  267.     self.bitmap.draw_text(0, 3, 160, 32, @name)
  268.   end
  269.   def need_reset?
  270.     return (@name != @last_name or @need_reset)
  271.   end
  272. end

  273. class Scene_Battle
  274.   #------------------------------------------------------------------------
  275.   # ● プレバトルフェーズ開始
  276.   #------------------------------------------------------------------------
  277.   alias scene_battle_icon_command_start_phase1 start_phase1
  278.   def start_phase1
  279.     com1 = Momo_IconCommand::ATTACK_ICON_NAME
  280.     com2 = Momo_IconCommand::SKILL_ICON_NAME
  281.     com3 = Momo_IconCommand::GUARD_ICON_NAME
  282.     com4 = Momo_IconCommand::ITEM_ICON_NAME
  283.     com5 = Momo_IconCommand::ESCAPE_ICON_NAME
  284.     @actor_command_window = Window_CommandIcon.new(0, 0, [com1, com2, com3, com4, com5])
  285.     @actor_command_window.y = 160
  286.     @actor_command_window.back_opacity = 160
  287.     @actor_command_window.active = false
  288.     @actor_command_window.visible = false
  289.     @actor_command_window.update
  290.     scene_battle_icon_command_start_phase1
  291.   end
  292.   #------------------------------------------------------------------------
  293.   # ● アクターコマンドウィンドウのセットアップ
  294.   #------------------------------------------------------------------------
  295.   alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_window
  296.   def phase3_setup_command_window
  297.     scene_battle_icon_command_phase3_setup_command_window
  298.     # アクターコマンドウィンドウの位置を設定
  299.     @actor_command_window.x = command_window_actor_x(@actor_index)
  300.     @actor_command_window.y = command_window_actor_y(@actor_index)
  301.     @actor_command_window.need_reset
  302.   end
  303.   def command_window_actor_x(index)
  304.     $game_party.actors[index].screen_x + Momo_IconCommand::X_PLUS
  305.   end
  306.   def command_window_actor_y(index)
  307.     $game_party.actors[index].screen_y + Momo_IconCommand::Y_PLUS
  308.   end
  309. end

  310. #==========================================================================
  311. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  312. #==========================================================================
复制代码
脚本的“攻击”按了就是逃跑
而“逃跑”完全没有作用
我还用了CP的脚本
猜的是跟这个有关
但是完全不会到该怎么改
求大大指教
  1. # ▼▲▼ XRXS65. CP制御ターンシステム ver.β ▼▲▼ built 201120
  2. # by 桜雅 在土

  3. #==============================================================================
  4. # □ カスタマイズポイント
  5. #==============================================================================
  6. module XRXS65
  7.   #
  8.   # 「バトルスピード」(数値が高いほど早い)
  9.   #
  10.   SPEED = 2.0
  11.   #
  12.   # 戦闘開始時 CP。 固定値と占有率
  13.   #
  14.   CP_PRESET_FIXNUM = 0
  15.   CP_PRESET_RATIO  = 2.0
  16.   #
  17.   # ターンコントローラ (nil  : カウント/ターンを有効。
  18.   #                     数値 : そのインデックスをもつエネミーが支配)
  19.   #
  20.   TC = 0
  21.   #
  22.   # カウント/ターン (TCが有効な場合は無視)
  23.   #
  24.   CPT = 40
  25.   #
  26.   # CP スキン
  27.   #
  28.   SKIN        = "CP.png"  # スキンファイル名(Graphics/Windowskinsフォルダ)
  29.   LINE_HEIGHT =  1        # スキンの"一行"の縦幅[単位:ピクセル]
  30.   #
  31.   # 表示位置セッティング
  32.   #
  33.   X_OFFSET = 144  # 横位置 #144
  34.   Y_OFFSET = 464   # 縦位置 #464
  35.   ALIGN    =   1    #「位置揃え」(CPメーターの位置。0:左寄せ 1:中央 2:右寄せ)
  36.   MAX      =   4    # 確保するサイズ[単位:~人分]
  37.   #
  38.   # アクターコマンドがポップしたときの効果音
  39.   #
  40.   COMMAND_UP_SE = "Audio/SE/046-Book01.ogg"
  41. end
  42. #==============================================================================
  43. # --- CP メーターの描画情報の取得 --- (Game_Battlerにインクルードされます)
  44. #==============================================================================
  45. module XRXS_CP
  46.   #--------------------------------------------------------------------------
  47.   # ○ スキンライン (スキンの何行目を使うか)
  48.   #--------------------------------------------------------------------------
  49.   def cp_linetype
  50.     # CP フルの場合はスキンの 2 行目を使う
  51.     return 2 if self.cp_full?
  52.     # 通常はスキンの 1 行目を使う
  53.     return 1
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ○ メーター量[単位:%]
  57.   #--------------------------------------------------------------------------
  58.   def cp_lineamount
  59.     # 戦闘不能の場合は 0 %として表示させる
  60.     return 0 if self.dead?
  61.     # CP値を%値に変換して返却する
  62.     return 100 * self.cp / self.max_cp
  63.   end
  64. end
  65. #
  66. # カスタマイズポイントここまで。
  67. #------------------------------------------------------------------------------



  68. #==============================================================================
  69. # --- XRXS. CP機構 ---
  70. #==============================================================================
  71. module XRXS_CP_SYSTEM
  72.   #----------------------------------------------------------------------------
  73.   # ○ 合計 AGI の取得
  74.   #----------------------------------------------------------------------------
  75.   def self.total_agi
  76.     total = 0
  77.     for battler in $game_party.actors + $game_troop.enemies
  78.       total += battler.agi
  79.     end
  80.     return total
  81.   end
  82. end
  83. #==============================================================================
  84. # --- バトラーにCP機能を追加 モジュール ---
  85. #==============================================================================
  86. module XRXS_CP
  87.   #--------------------------------------------------------------------------
  88.   # ○ 最大 CP の取得
  89.   #--------------------------------------------------------------------------
  90.   def max_cp
  91.     return 65535
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ○ CP の取得と設定
  95.   #--------------------------------------------------------------------------
  96.   def cp
  97.     return @cp == nil ? @cp = 0 : @cp
  98.   end
  99.   def cp=(n)
  100.     @cp = [[n.to_i, 0].max, self.max_cp].min
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ○ CP 初期設定
  104.   #--------------------------------------------------------------------------
  105.   def cp_preset
  106.     percent = self.max_cp * XRXS65::CP_PRESET_RATIO * (rand(16) + 16) * self.agi / XRXS_CP_SYSTEM.total_agi / 24
  107.     self.cp = XRXS65::CP_PRESET_FIXNUM + percent
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ○ CP カウントアップ
  111.   #--------------------------------------------------------------------------
  112.   def cp_update
  113.     self.cp += XRXS65::SPEED * 4096 * self.agi / XRXS_CP_SYSTEM.total_agi
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ○ CP 満タン?
  117.   #--------------------------------------------------------------------------
  118.   def cp_full?
  119.     return @cp == self.max_cp
  120.   end
  121. end
  122. class Game_Battler
  123.   include XRXS_CP
  124. end
  125. #==============================================================================
  126. # --- ガード機能 ---
  127. #==============================================================================
  128. class Game_Battler
  129.   #--------------------------------------------------------------------------
  130.   # ○ ガードフラグ
  131.   #--------------------------------------------------------------------------
  132.   def guarding=(n)
  133.     @guarding = n
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # ● 防御中判定 [再定義]
  137.   #--------------------------------------------------------------------------
  138.   def guarding?
  139.     return @guarding
  140.   end
  141. end
  142. #==============================================================================
  143. # --- アクター「コマンド入力可能判定」:CPがないとコマンドしない ---
  144. #==============================================================================
  145. module XRXS_CP_INPUTABLE
  146.   def inputable?
  147.     return (self.cp_full? and super)
  148.   end
  149. end
  150. class Game_Actor < Game_Battler
  151.   include XRXS_CP_INPUTABLE
  152. end
  153. #==============================================================================
  154. # --- エネミー「行動可能判定」:CPがないとコマンドしない ---
  155. #==============================================================================
  156. module XRXS_CP_MOVABLE
  157.   def movable?
  158.     return (self.cp_full? and super)
  159.   end
  160. end
  161. class Game_Enemy < Game_Battler
  162.   include XRXS_CP_MOVABLE
  163. end
  164. #==============================================================================
  165. # --- 戦闘時 CPカウント ---
  166. #==============================================================================
  167. module XRXS_CP_Battle
  168.   #--------------------------------------------------------------------------
  169.   # ○ パーティ全員の CP を初期設定
  170.   #--------------------------------------------------------------------------
  171.   def cp_preset_party
  172.     for actor in $game_party.actors
  173.       actor.cp_preset
  174.     end
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # ○ トループ全員の CP を初期設定
  178.   #--------------------------------------------------------------------------
  179.   def cp_preset_troop
  180.     for enemy in $game_troop.enemies
  181.       enemy.cp_preset
  182.     end
  183.   end
  184.   #--------------------------------------------------------------------------
  185.   # ○ バトラー全員の CP をカウントアップ
  186.   #--------------------------------------------------------------------------
  187.   def cp_update
  188.     for battler in $game_party.actors + $game_troop.enemies
  189.       battler.cp_update
  190.     end
  191.   end
  192. end
  193. class Scene_Battle
  194.   include XRXS_CP_Battle
  195. end
  196. #==============================================================================
  197. # ■ Scene_Battle
  198. #==============================================================================
  199. class Scene_Battle
  200.   #--------------------------------------------------------------------------
  201.   # ● メイン処理
  202.   #--------------------------------------------------------------------------
  203.   alias xrxs65_main main
  204.   def main
  205.     # エクストラスプライトの初期化
  206.     @extra_sprites = [] if @extra_sprites == nil
  207.     # CP の初期化
  208.     cp_preset_party
  209.     # CP メーターの作成
  210.     @cp_meters = CP_Meters.new
  211.     # CP メーターをエクストラスプライトへ登録
  212.     @extra_sprites.push(@cp_meters)
  213.     # 呼び戻す
  214.     xrxs65_main
  215.     # メーターの解放
  216.     @cp_meters.dispose
  217.   end
  218.   #--------------------------------------------------------------------------
  219.   # ● プレバトルフェーズ開始
  220.   #--------------------------------------------------------------------------
  221.   alias xrxs65_start_phase1 start_phase1
  222.   def start_phase1
  223.     # 呼び戻す
  224.     xrxs65_start_phase1
  225.     # CP の初期化
  226.     cp_preset_troop
  227.     # CP メーターの更新
  228.     @cp_meters.refresh
  229.     # インデックスを計算
  230.     @cp_escape_actor_command_index = @actor_command_window.height/32 - 1
  231.     # アクターコマンドウィンドウに追加
  232.     @actor_command_window.add_command("逃跑")
  233.     if !$game_temp.battle_can_escape
  234.       @actor_command_window.disable_item(@cp_escape_actor_command_index)
  235.     end
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ● パーティコマンドフェーズ開始
  239.   #--------------------------------------------------------------------------
  240.   alias xrxs65_start_phase2 start_phase2
  241.   def start_phase2
  242.     # 呼び戻す
  243.     xrxs65_start_phase2
  244.     # パーティコマンドウィンドウを無効化
  245.     @party_command_window.active  = false
  246.     @party_command_window.visible = false
  247.     # 強制的にフェイズ 2 を保持
  248.     @phase = 2
  249.     # ただし、既に行動可能者が存在する場合は 3 へ
  250.     start_phase3 if anybody_movable?
  251.   end
  252.   #--------------------------------------------------------------------------
  253.   # ○ CP制での ターンのカウント
  254.   #--------------------------------------------------------------------------
  255.   def cp_turn_count
  256.     $game_temp.battle_turn += 1
  257.     # バトルイベントの全ページを検索
  258.     for index in 0...$data_troops[@troop_id].pages.size
  259.       # このページのスパンが [ターン] の場合
  260.       if $data_troops[@troop_id].pages[index].span == 1
  261.         # 実行済みフラグをクリア
  262.         $game_temp.battle_event_flags[index] = false
  263.       end
  264.     end
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # ● フレーム更新 (パーティコマンドフェーズ)
  268.   #--------------------------------------------------------------------------
  269.   alias xrxs65_update_phase2 update_phase2
  270.   def update_phase2
  271.     # パーティコマンドウィンドウのインデックスを無効化
  272.     @party_command_window.index = -1
  273.     # 呼び戻す
  274.     xrxs65_update_phase2
  275.     # 例外補正
  276.     @turn_count_time = 1 if @turn_count_time == nil
  277.     # ターンのカウント
  278.     if @turn_count_time > 0
  279.       @turn_count_time -= 1
  280.       if @turn_count_time == 0
  281.         cp_turn_count
  282.         @turn_count_time = XRXS65::CPT if XRXS65::TC == nil
  283.       end
  284.     end
  285.     # CP のフレーム更新
  286.     cp_update
  287.     @cp_meters.refresh
  288.     # フル CP のバトラーが存在する場合、ターン開始
  289.     start_phase3 if anybody_movable?
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   # ○ フル CP バトラーが存在するか?
  293.   #--------------------------------------------------------------------------
  294.   def anybody_movable?
  295.     for battler in $game_party.actors + $game_troop.enemies
  296.       return true if battler.cp_full?
  297.     end
  298.     return false
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ● アクターコマンドウィンドウのセットアップ
  302.   #--------------------------------------------------------------------------
  303.   alias xrxs65_phase3_setup_command_window phase3_setup_command_window
  304.   def phase3_setup_command_window
  305.     # 効果音の再生
  306.     Audio.se_play(XRXS65::COMMAND_UP_SE) rescue nil
  307.     # 呼び戻す
  308.     xrxs65_phase3_setup_command_window
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  312.   #--------------------------------------------------------------------------
  313.   alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  314.   def update_phase3_basic_command
  315.     # C ボタンが押された場合
  316.     if Input.trigger?(Input::C)
  317.       # アクターコマンドウィンドウのカーソル位置で分岐
  318.       case @actor_command_window.index
  319.       when @cp_escape_actor_command_index # 逃げる
  320.         if $game_temp.battle_can_escape
  321.           # 決定 SE を演奏
  322.           $game_system.se_play($data_system.decision_se)
  323.           # アクションを設定
  324.           @active_battler.current_action.kind = 0
  325.           @active_battler.current_action.basic = 4
  326.           # 次のアクターのコマンド入力へ
  327.           phase3_next_actor
  328.         else
  329.           # ブザー SE を演奏
  330.           $game_system.se_play($data_system.buzzer_se)
  331.         end
  332.         return
  333.       end
  334.     end
  335.     # 呼び戻す
  336.     xrxs_bsp1_update_phase3_basic_command
  337.   end
  338.   #--------------------------------------------------------------------------
  339.   # ● メインフェーズ開始
  340.   #--------------------------------------------------------------------------
  341.   alias xrxs65_start_phase4 start_phase4
  342.   def start_phase4
  343.     # ターン数を引くことによって擬似的にカウントに変化を起こさせない
  344.     $game_temp.battle_turn -= 1
  345.     # フラグを退避
  346.     save_flags = $game_temp.battle_event_flags.dup
  347.     # 呼び戻す
  348.     xrxs65_start_phase4
  349.     # フラグを復旧
  350.     $game_temp.battle_event_flags = save_flags
  351.   end
  352.   #--------------------------------------------------------------------------
  353.   # ● 行動順序作成
  354.   #--------------------------------------------------------------------------
  355.   alias xrxs65_make_action_orders make_action_orders
  356.   def make_action_orders
  357.     # 呼び戻す
  358.     xrxs65_make_action_orders
  359.     # CPが不足している場合は @action_battlers から除外する
  360.     for battler in @action_battlers.dup
  361.       @action_battlers.delete(battler) unless battler.cp_full?
  362.     end
  363.   end
  364.   #--------------------------------------------------------------------------
  365.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  366.   #--------------------------------------------------------------------------
  367.   alias xrxs65_update_phase4_step2 update_phase4_step2
  368.   def update_phase4_step2
  369.     # ガードの解除
  370.     @active_battler.guarding = false
  371.     # CPの消費
  372.     @active_battler.cp = 0
  373.     # CP メーターの更新
  374.     @cp_meters.refresh
  375.     # 呼び戻す
  376.     xrxs65_update_phase4_step2
  377.     # 例外補正
  378.     return if @active_battler == nil
  379.     # ターンコントローラ
  380.     if @active_battler.is_a?(Game_Enemy) and @active_battler.index == XRXS65::TC
  381.       cp_turn_count
  382.     end
  383.   end
  384.   #--------------------------------------------------------------------------
  385.   # ● 基本アクション 結果作成
  386.   #--------------------------------------------------------------------------
  387.   alias xrxs65_make_basic_action_result make_basic_action_result
  388.   def make_basic_action_result
  389.     # 呼び戻す
  390.     xrxs65_make_basic_action_result
  391.     # 防御の場合
  392.     if @active_battler.current_action.basic == 1
  393.       @active_battler.guarding = true
  394.       return
  395.     end
  396.     # パーティの逃亡の場合
  397.     if @active_battler.current_action.basic == 4
  398.       # 逃走可能ではない場合
  399.       if $game_temp.battle_can_escape == false
  400.         # ブザー SE を演奏
  401.         $game_system.se_play($data_system.buzzer_se)
  402.         return
  403.       end
  404.       # パーティ全員の CP をクリア
  405.       for actor in $game_party.actors
  406.         actor.cp = 0
  407.       end
  408.       # CP メーターの更新
  409.       @cp_meters.refresh
  410.       # 逃走処理
  411.       update_phase2_escape
  412.       return
  413.     end
  414.   end
  415.   #--------------------------------------------------------------------------
  416.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  417.   #--------------------------------------------------------------------------
  418.   alias xrxs65_update_phase4_step5 update_phase4_step5
  419.   def update_phase4_step5
  420.     # 呼び戻す
  421.     xrxs65_update_phase4_step5
  422.     # CP メーターの更新
  423.     @cp_meters.refresh
  424.   end
  425. end
  426. #==============================================================================
  427. # --- CP メーターをまとめて管理するクラス、表示関係はすべてココ ---
  428. #==============================================================================
  429. class CP_Meters
  430.   #--------------------------------------------------------------------------
  431.   # ○ オブジェクト初期化
  432.   #--------------------------------------------------------------------------
  433.   def initialize
  434.     # メーター群の生成
  435.     @meters = []
  436.     for i in 0...$game_party.actors.size
  437.       make_meter(i)
  438.     end
  439.     refresh
  440.   end
  441.   #--------------------------------------------------------------------------
  442.   # ○ リフレッシュ
  443.   #--------------------------------------------------------------------------
  444.   def refresh
  445.     # 戦闘メンバー数の変更を判別
  446.     for i in @meters.size...$game_party.actors.size
  447.       make_meter(i)
  448.     end
  449.     for i in [email protected]
  450.       @meters[i].dispose
  451.       @meters[i] = nil
  452.     end
  453.     @meters.compact!
  454.     # 表示更新
  455.     for i in 0...$game_party.actors.size
  456.       actor = $game_party.actors[i]
  457.       @meters[i].line   = actor.cp_linetype
  458.       @meters[i].amount = actor.cp_lineamount
  459.     end
  460.   end
  461.   #--------------------------------------------------------------------------
  462.   # ○ メーターひとつの生成
  463.   #--------------------------------------------------------------------------
  464.   def make_meter(i)
  465.     # スキンの取得
  466.     skin = RPG::Cache.windowskin(XRXS65::SKIN)
  467.     #
  468.     space = 640 / XRXS65::MAX
  469.     case XRXS65::ALIGN
  470.     when 0
  471.       actor_x = i * space + 4
  472.     when 1
  473.       actor_x = (space * ((XRXS65::MAX - $game_party.actors.size)/2.0 + i)).floor
  474.     when 2
  475.       actor_x = (i + XRXS65::MAX - $game_party.actors.size) * space + 4
  476.     end
  477.     meter = MeterSprite.new(skin, XRXS65::LINE_HEIGHT)
  478.     meter.x = actor_x + XRXS65::X_OFFSET - skin.width
  479.     meter.y = XRXS65::Y_OFFSET
  480.     @meters[i] = meter
  481.   end
  482.   #--------------------------------------------------------------------------
  483.   # ○ 可視状態
  484.   #--------------------------------------------------------------------------
  485.   def visible=(b)
  486.     @meters.each{|sprite| sprite.visible = b }
  487.   end
  488.   #--------------------------------------------------------------------------
  489.   # ○ 解放
  490.   #--------------------------------------------------------------------------
  491.   def dispose
  492.     @meters.each{|sprite| sprite.dispose }
  493.   end
  494. end
  495. #==============================================================================
  496. # --- XRXS. レクタンギュラーメーター表示・極 ---
  497. #==============================================================================
  498. class MeterSprite < Sprite
  499.   #--------------------------------------------------------------------------
  500.   # ○ オブジェクト初期化
  501.   #--------------------------------------------------------------------------
  502.   def initialize(skin, line_height)
  503.     @skin   = skin
  504.     @width  = @skin.width
  505.     @height = line_height
  506.     @line   = 1
  507.     @amount = 0
  508.     @base_sprite = Sprite.new
  509.     @base_sprite.bitmap = @skin
  510.     @base_sprite.src_rect.set(0, 0, @width, @height)
  511.     @base_sprite.z = 601
  512.     super()
  513.     self.z = @base_sprite.z + 1
  514.     self.bitmap = @skin
  515.     self.line = 1
  516.   end
  517.   #--------------------------------------------------------------------------
  518.   # ○ 値の設定
  519.   #--------------------------------------------------------------------------
  520.   def line=(n)
  521.     @line = n
  522.     refresh
  523.   end
  524.   def amount=(n)
  525.     @amount = n
  526.     refresh
  527.   end
  528.   def refresh
  529.     self.src_rect.set(0, @line * @height, @width * @amount / 100, @height)
  530.   end
  531.   #--------------------------------------------------------------------------
  532.   # ○ 座標の設定
  533.   #--------------------------------------------------------------------------
  534.   def x=(n)
  535.     super
  536.     @base_sprite.x = n
  537.   end
  538.   def y=(n)
  539.     super
  540.     @base_sprite.y = n
  541.   end
  542.   #--------------------------------------------------------------------------
  543.   # ○ 解放
  544.   #--------------------------------------------------------------------------
  545.   def dispose
  546.     @base_sprite.dispose
  547.     super
  548.   end
  549. end
复制代码
谢谢

Lv1.梦旅人

梦石
0
星屑
50
在线时间
62 小时
注册时间
2011-10-2
帖子
25
5
 楼主| 发表于 2014-6-20 23:14:26 | 只看该作者
斯塔萨菲雅 发表于 2014-6-20 23:06
很巧的是……这两个脚本我都有用在我自己的游戏里,而且当时也遇到了差不多的问题。。。= =

我记得在图 ...

成功了QAQ虽然现在是防御跟物品换了个位置 不过很好处理就是了
谢谢谢谢!

点评

黑猫点赞,这么可爱,一定是男孩纸。  发表于 2014-6-21 02:57
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
375 小时
注册时间
2013-10-1
帖子
77
4
发表于 2014-6-20 23:06:50 | 只看该作者
本帖最后由 斯塔萨菲雅 于 2014-6-20 23:11 编辑
Geass丨乐 发表于 2014-6-20 23:02
脚本的“攻击”按了就是逃跑
而“逃跑”完全没有作用
Orz按了攻击就逃跑了


很巧的是……这两个脚本我都有用在我自己的游戏里,而且当时也遇到了差不多的问题。。。= =

我记得在图标战斗的脚本的最前面添加了这一段之后好像就解决问题了。。。也就是重新定义一下每个指令是干啥的……
不过这个我改过了,Audio.se_play什么的换一下就是了。。


RUBY 代码复制
  1. class Scene_Battle
  2.         def update_phase3_basic_command
  3.                 if Input.trigger?(Input::B)
  4.                         $game_system.se_play($data_system.cancel_se)
  5.                         phase3_prior_actor
  6.                         return
  7.                 end
  8.                 if Input.trigger?(Input::C)
  9.                         case @actor_command_window.index
  10.                         when 0
  11.         Audio.se_play("Audio/SE/097-Attack09",100)
  12.                                 @active_battler.current_action.kind = 0
  13.                                 @active_battler.current_action.basic = 0
  14.                                 start_enemy_select
  15.                         when 1  
  16.         Audio.se_play("Audio/SE/097-Attack09",100)
  17.                                 @active_battler.current_action.kind = 1
  18.                                 start_skill_select
  19.                         when 2  
  20.         Audio.se_play("Audio/SE/097-Attack09",100)
  21.                                 @active_battler.current_action.kind = 2
  22.                                 start_item_select
  23.                         when 3  
  24.                                 $game_system.se_play($data_system.decision_se)
  25.                                 @active_battler.current_action.kind = 0
  26.                                 @active_battler.current_action.basic = 1
  27.                                 phase3_next_actor
  28.                         when 4
  29.                                 if $game_temp.battle_can_escape == false
  30.                                         $game_system.se_play($data_system.buzzer_se)
  31.                                         return
  32.                                 end
  33.                                 $game_system.se_play($data_system.decision_se)
  34.                                 update_phase2_escape
  35.                         end
  36.                 end
  37.         end
  38. end

评分

参与人数 1星屑 +120 收起 理由
天地有正气 + 120 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
62 小时
注册时间
2011-10-2
帖子
25
3
 楼主| 发表于 2014-6-20 23:02:26 | 只看该作者
斯塔萨菲雅 发表于 2014-6-20 22:36
于是你遇到了什么问题……………………

脚本的“攻击”按了就是逃跑
而“逃跑”完全没有作用
Orz按了攻击就逃跑了
逃跑点了完全没有任何作用
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
375 小时
注册时间
2013-10-1
帖子
77
2
发表于 2014-6-20 22:36:20 | 只看该作者
于是你遇到了什么问题……………………
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-10-1 01:22

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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