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

Project1

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

[已经过期] 用了两条CP之后,强制敌人行动不起作用了

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1237
在线时间
163 小时
注册时间
2019-10-4
帖子
217
跳转到指定楼层
1
发表于 2023-3-8 22:30:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 契约师Vi 于 2023-3-8 22:30 编辑

两个CP条 倒是显示的好好的,但是设置的,敌人强制行动,不起作用了。删除一条CP脚本就正常了

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


RUBY 代码复制
  1. # ▼▲▼ XRXS65A. CP制御ターンシステム「シンセ・ゲージ」 ▼▲▼ built201202
  2. # by 桜雅 在土
  3.  
  4. #==============================================================================
  5. # □ カスタマイズポイント
  6. #==============================================================================
  7. class XRXS65A
  8.   #--------------------------------------------------------------------------
  9.   # 「アイコン設定」
  10.   #--------------------------------------------------------------------------
  11.   DEFAULT = "怪物1" # ディフォルトアイコン
  12.   # アイコンハッシュ  記述方式 : アクターID=>アイコン名
  13.   ICONS = {
  14.     1=>"1",
  15.     2=>"2",
  16.     3=>"3",
  17.     4=>"4",
  18.     5=>"5",
  19.     6=>"6",
  20.     7=>"8",
  21.     9=>"9",
  22.     10=>"10",
  23.     11=>"11",
  24.   }
  25.   # アイコンハッシュE  記述方式 : エネミーID=>アイコン名
  26.   ICONE = {
  27.     1=>"怪物1",
  28.     2=>"怪物2",
  29.     3=>"怪物3",
  30.     4=>"怪物4",
  31.     5=>"怪物5",
  32.     6=>"怪物6",
  33.     7=>"怪物7",
  34.     8=>"怪物8",
  35.  
  36.   }
  37.   #--------------------------------------------------------------------------
  38.   # 「シンセ・ゲージ」
  39.   #--------------------------------------------------------------------------
  40.   SKIN = "123"  # スキン
  41.   X    =  100         # X 座標
  42.   Y    =  18      # Y 座標
  43. end
  44. #==============================================================================
  45. # --- CP メーターをまとめて管理するクラス、表示関係はすべてココ --- [再定義]
  46. #==============================================================================
  47. class CP_Meters
  48.   #--------------------------------------------------------------------------
  49.   # ○ オブジェクト初期化
  50.   #--------------------------------------------------------------------------
  51.   def initialize
  52.     # シンセゲージの生成
  53.     @base = Sprite.new
  54.     @base.bitmap = RPG::Cache.windowskin(XRXS65A::SKIN).dup
  55.     @base.x = XRXS65A::X
  56.     @base.y = XRXS65A::Y
  57.     @base.z = XRXS65A::X
  58.     @width  = @base.bitmap.width
  59.     @height = @base.bitmap.height
  60.     @icon_set = []
  61.     refresh
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # ○ リフレッシュ
  65.   #--------------------------------------------------------------------------
  66.   def refresh
  67.     # 生成すべきバトラーの取得
  68.     need_initializes = []
  69.     for battler in $game_party.actors + $game_troop.enemies
  70.       exist = false
  71.       for set in @icon_set
  72.         exist |= (set[1] == battler)
  73.       end
  74.       need_initializes.push(battler) unless exist
  75.     end
  76.     for battler in need_initializes
  77.       iconname = nil
  78.       if battler.is_a?(Game_Actor)
  79.         iconname = XRXS65A::ICONS[battler.id]
  80.       else
  81.         iconname = XRXS65A::ICONE[battler.id]
  82.       end
  83.       if iconname == nil
  84.         iconname = XRXS65A::DEFAULT
  85.       end
  86.       sprite = Sprite.new
  87.       sprite.bitmap = RPG::Cache.icon(iconname).dup
  88.       sprite.y = XRXS65A::Y + @height / 2 - 12
  89.       @icon_set.push([sprite, battler])
  90.     end
  91.     # 更新
  92.     for set in @icon_set
  93.       set[0].x = XRXS65A::X + @width * set[1].cp / set[1].max_cp - 12
  94.       set[0].z = set[0].x
  95.       set[0].visible = false if set[1].dead? or !set[1].exist?
  96.     end
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ○ 可視状態
  100.   #--------------------------------------------------------------------------
  101.   def visible=(b)
  102.     @base.visible = b
  103.     @icon_set.each{|set| set[0].visible = b }
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # ○ 解放
  107.   #--------------------------------------------------------------------------
  108.   def dispose
  109.     @base.dispose
  110.     @icon_set.each{|set| set[0].dispose }
  111.   end
  112. end


RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4.  
  5. # ————————————————————————————————————
  6.  
  7. # ▼▲▼ XRXS_BP 1. CP制導入 ver..23 ▼▲▼
  8. # by 桜雅 在土, 和希
  9.  
  10. #==============================================================================
  11. # □ カスタマイズポイント
  12. #==============================================================================
  13. module XRXS_BP1
  14. #
  15. # 对齐方式。0:左 1:中央 2:右
  16. #
  17. ALIGN =0
  18. #
  19. # 人数
  20. #
  21. MAX = 4
  22. end
  23. class Scene_Battle_CP
  24. #
  25. # 战斗速度
  26. #
  27. BATTLE_SPEED = 2.0
  28. #
  29. # 战斗开始的时候气槽百分比
  30. #
  31. START_CP_PERCENT = 100
  32. end
  33.  
  34. class Scene_Battle
  35.  
  36. # 效果音效,可以自己添加
  37. DATA_SYSTEM_COMMAND_UP_SE = ""
  38.  
  39. # 各项数值功能消耗的CP值
  40. CP_COST_BASIC_ACTIONS = 0 # 基础共同
  41. CP_COST_SKILL_ACTION = 65535 # 技能
  42. CP_COST_ITEM_ACTION = 65535 # 物品
  43. CP_COST_BASIC_ATTACK = 65535 # 攻撃
  44. CP_COST_BASIC_GUARD = 65535-25535 # 防御-32768
  45. CP_COST_BASIC_NOTHING = 65535 # 不做任何事情
  46. CP_COST_BASIC_ESCAPE = 65535 # 逃跑
  47. end
  48.  
  49. #==============================================================================
  50. # --- XRXS.コマンドウィンドウ?コマンド追加機構 ---
  51. #------------------------------------------------------------------------------
  52. # Window_Commandクラスに add_command メソッドを追加します。
  53. #==============================================================================
  54. module XRXS_Window_Command_Add_Command
  55. #--------------------------------------------------------------------------
  56. # ○ コマンドを追加
  57. #--------------------------------------------------------------------------
  58. def add_command(command)
  59. # 初期化されていない場合、無効化判別用の配列 @disabled の初期化
  60. #
  61. if @disabled == nil
  62. @disabled = []
  63. end
  64. if @commands.size != @disabled.size
  65. for i in 0...@commands.size
  66. @disabled[i] = false
  67. end
  68. end
  69. #
  70. # 追加
  71. #
  72. @commands.push(command)
  73. @disabled.push(false)
  74. @item_max = @commands.size
  75. self.y -= 32
  76. self.height += 32
  77. self.contents.dispose
  78. self.contents = nil
  79. self.contents = Bitmap.new(self.width - 32, @item_max * 32)
  80. refresh
  81. for i in 0...@commands.size
  82. if @disabled[i]
  83. disable_item(i)
  84. end
  85. end
  86. end
  87. #--------------------------------------------------------------------------
  88. # ○ 項目の無効化
  89. # index : 項目番号
  90. #--------------------------------------------------------------------------
  91. def disable_item(index)
  92. if @disabled == nil
  93. @disabled = []
  94. end
  95. @disabled[index] = true
  96. draw_item(index, disabled_color)
  97. end
  98. end
  99. class Window_Command < Window_Selectable
  100. #--------------------------------------------------------------------------
  101. # ○ インクルード
  102. #--------------------------------------------------------------------------
  103. include XRXS_Window_Command_Add_Command
  104. #--------------------------------------------------------------------------
  105. # ● 項目の無効化
  106. # index : 項目番号
  107. #--------------------------------------------------------------------------
  108. def disable_item(index)
  109. super
  110. end
  111. end
  112. #==============================================================================
  113. # □ Scene_Battle_CP
  114. #==============================================================================
  115. class Scene_Battle_CP
  116. #--------------------------------------------------------------------------
  117. # ○ 公開インスタンス変数
  118. #--------------------------------------------------------------------------
  119. attr_accessor :stop # CP加算ストップ
  120. #----------------------------------------------------------------------------
  121. # ○ オブジェクトの初期化
  122. #----------------------------------------------------------------------------
  123. def initialize
  124. @battlers = []
  125. @cancel = false
  126. @stop = false
  127. @agi_total = 0
  128. # 配列 count_battlers を初期化
  129. count_battlers = []
  130. # エネミーを配列 count_battlers に追加
  131. for enemy in $game_troop.enemies
  132. count_battlers.push(enemy)
  133. end
  134. # アクターを配列 count_battlers に追加
  135. for actor in $game_party.actors
  136. count_battlers.push(actor)
  137. end
  138. for battler in count_battlers
  139. @agi_total += battler.agi
  140. end
  141. for battler in count_battlers
  142. battler.cp = [[65535 * START_CP_PERCENT * (rand(15) + 85) * 4 * battler.agi / @agi_total / 10000, 0].max, 65535].min
  143. end
  144. end
  145. #----------------------------------------------------------------------------
  146. # ○ CPカウントアップ
  147. #----------------------------------------------------------------------------
  148. def update
  149. # ストップされているならリターン
  150. return if @stop
  151. #
  152. for battler in $game_party.actors + $game_troop.enemies
  153. # 行動出来なければ無視
  154. if battler.dead? == true
  155. battler.cp = 0
  156. next
  157. end
  158. battler.cp = [[battler.cp + BATTLE_SPEED * 4096 * battler.agi / @agi_total, 0].max, 65535].min
  159. end
  160. end
  161. #----------------------------------------------------------------------------
  162. # ○ CPカウントの開始
  163. #----------------------------------------------------------------------------
  164. def stop
  165. @cancel = true
  166. if @cp_thread != nil then
  167. @cp_thread.join
  168. @cp_thread = nil
  169. end
  170. end
  171. end
  172.  
  173. #==============================================================================
  174. # ■ Game_Battler
  175. #==============================================================================
  176. class Game_Battler
  177. attr_accessor :now_guarding # 現在防御中フラグ
  178. attr_accessor :cp # 現在CP
  179. attr_accessor :slip_state_update_ban # スリップ?ステート自動処理の禁止
  180. #--------------------------------------------------------------------------
  181. # ○ CP の変更
  182. #--------------------------------------------------------------------------
  183. def cp=(p)
  184. @cp = [[p, 0].max, 65535].min
  185. end
  186. #--------------------------------------------------------------------------
  187. # ● 防御中判定 [ 再定義 ]
  188. #--------------------------------------------------------------------------
  189. def guarding?
  190. return @now_guarding
  191. end
  192. #--------------------------------------------------------------------------
  193. # ● コマンド入力可能判定
  194. #--------------------------------------------------------------------------
  195. alias xrxs_bp1_inputable? inputable?
  196. def inputable?
  197. bool = xrxs_bp1_inputable?
  198. return (bool and (@cp >= 65535))
  199. end
  200. #--------------------------------------------------------------------------
  201. # ● ステート [スリップダメージ] 判定
  202. #--------------------------------------------------------------------------
  203. alias xrxs_bp1_slip_damage? slip_damage?
  204. def slip_damage?
  205. return false if @slip_state_update_ban
  206. return xrxs_bp1_slip_damage?
  207. end
  208. #--------------------------------------------------------------------------
  209. # ● ステート自然解除 (ターンごとに呼び出し)
  210. #--------------------------------------------------------------------------
  211. alias xrxs_bp1_remove_states_auto remove_states_auto
  212. def remove_states_auto
  213. return if @slip_state_update_ban
  214. xrxs_bp1_remove_states_auto
  215. end
  216. end
  217. #==============================================================================
  218. # ■ Game_Actor
  219. #==============================================================================
  220. class Game_Actor < Game_Battler
  221. #--------------------------------------------------------------------------
  222. # ● セットアップ
  223. #--------------------------------------------------------------------------
  224. alias xrxs_bp1_setup setup
  225. def setup(actor_id)
  226. xrxs_bp1_setup(actor_id)
  227. @cp = 0
  228. @now_guarding = false
  229. @slip_state_update_ban = false
  230. end
  231. end
  232. #==============================================================================
  233. # ■ Game_Enemy
  234. #==============================================================================
  235. class Game_Enemy < Game_Battler
  236. #--------------------------------------------------------------------------
  237. # ● オブジェクト初期化
  238. #--------------------------------------------------------------------------
  239. alias xrxs_bp1_initialize initialize
  240. def initialize(troop_id, member_index)
  241. xrxs_bp1_initialize(troop_id, member_index)
  242. @cp = 0
  243. @now_guarding = false
  244. @slip_state_update_ban = false
  245. end
  246. end
  247. #==============================================================================
  248. # ■ Window_BattleStatus CP绘制
  249. #==============================================================================
  250. class Window_BattleStatus < Window_Base
  251. #--------------------------------------------------------------------------
  252. # ○ 公開インスタンス変数
  253. #--------------------------------------------------------------------------
  254. attr_accessor :update_cp_only # CPメーターのみの更新
  255. #--------------------------------------------------------------------------
  256. # ● オブジェクト初期化
  257. #--------------------------------------------------------------------------
  258. alias xrxs_bp1_initialize initialize
  259. def initialize
  260. @update_cp_only = false
  261. xrxs_bp1_initialize
  262. end
  263. #--------------------------------------------------------------------------
  264. # ● リフレッシュ
  265. #--------------------------------------------------------------------------
  266. alias xrxs_bp1_refresh refresh
  267. def refresh
  268. unless @update_cp_only
  269. xrxs_bp1_refresh
  270. end
  271. refresh_cp
  272. end
  273. #--------------------------------------------------------------------------
  274. # ○ リフレッシュ(CPのみ)
  275. #--------------------------------------------------------------------------
  276. def refresh_cp
  277. for i in 0...$game_party.actors.size
  278. actor = $game_party.actors[i]
  279. width = [self.width*3/4 / XRXS_BP1::MAX, 100].max
  280. space = self.width / XRXS_BP1::MAX
  281. case XRXS_BP1::ALIGN
  282. when 0
  283. actor_x = i * space + 4
  284. when 1
  285. actor_x = (space * ((XRXS_BP1::MAX - $game_party.actors.size)/3.0 + i)).floor
  286. when 2
  287. actor_x = (i + XRXS_BP1::MAX - $game_party.actors.size) * space + 4
  288. end
  289. actor_x += self.x
  290. draw_actor_cp_meter(actor, actor_x, 90, width, 0)
  291. end
  292. end
  293. #--------------------------------------------------------------------------
  294. # ○ CPメーター の描画
  295. #--------------------------------------------------------------------------
  296. def draw_actor_cp_meter(actor, x, y, width = 200, type = 0)
  297. self.contents.font.color = system_color
  298. self.contents.fill_rect(x-1, y+27, width+10,9, Color.new(0, 0, 0, 150))
  299. if actor.cp == nil
  300. actor.cp = 0
  301. end
  302. w = width * [actor.cp,65535].min / 65535
  303. self.contents.fill_rect(x+1, y+28, w+4,3, Color.new(0, 0, 0, 250))
  304. self.contents.fill_rect(x+1, y+29, w+4,3, Color.new(255, 255, 0, 250))
  305. self.contents.fill_rect(x+1, y+30, w+4,3, Color.new(200, 200, 0, 250))
  306. self.contents.fill_rect(x+1, y+31, w+4,3, Color.new(128, 128, 0, 250))
  307. end
  308. end
  309. #==============================================================================
  310. # ■ Scene_Battle
  311. #==============================================================================
  312. class Scene_Battle
  313. #--------------------------------------------------------------------------
  314. # ● フレーム更新
  315. #--------------------------------------------------------------------------
  316. alias xrxs_bp1_update update
  317. def update
  318. xrxs_bp1_update
  319. # CP更新
  320. @cp_thread.update
  321. end
  322. #--------------------------------------------------------------------------
  323. # ● バトル終了
  324. # result : 結果 (0:勝利 1:敗北 2:逃走)
  325. #--------------------------------------------------------------------------
  326. alias xrxs_bp1_battle_end battle_end
  327. def battle_end(result)
  328. # CPカウントを停止する
  329. @cp_thread.stop
  330. # 呼び戻す
  331. xrxs_bp1_battle_end(result)
  332. end
  333. #--------------------------------------------------------------------------
  334. # ●战斗阶段開始
  335. #--------------------------------------------------------------------------
  336. alias xrxs_bp1_start_phase1 start_phase1
  337. def start_phase1
  338. @agi_total = 0
  339. # CP加算を開始する
  340. @cp_thread = Scene_Battle_CP.new
  341. # 引索设定計算
  342. @cp_escape_actor_command_index = @actor_command_window.height/32 - 1
  343. # 返回命令窗口的追加
  344. # @actor_command_window.add_command("逃跑")
  345. if !$game_temp.battle_can_escape
  346. # @actor_command_window.disable_item(@cp_escape_actor_command_index)
  347. end
  348. # 返回
  349. xrxs_bp1_start_phase1
  350. end
  351. #--------------------------------------------------------------------------
  352. # ● パーティコマンドフェーズ開始
  353. #--------------------------------------------------------------------------
  354. alias xrxs_bp1_start_phase2 start_phase2
  355. def start_phase2
  356. xrxs_bp1_start_phase2
  357. @party_command_window.active = false
  358. @party_command_window.visible = false
  359. # CP加算を再開する
  360. @cp_thread.stop = false
  361. # 次へ
  362. start_phase3
  363. end
  364. #--------------------------------------------------------------------------
  365. # ● アクターコマンドウィンドウのセットアップ
  366. #--------------------------------------------------------------------------
  367. alias xrxs_bp1_phase3_setup_command_window phase3_setup_command_window
  368. def phase3_setup_command_window
  369. # CPスレッドを一時停止する
  370. @cp_thread.stop = true
  371. # ウィンドウのCP更新
  372. @status_window.refresh_cp
  373. # @active_battlerの防御を解除
  374. @active_battler.now_guarding = false
  375. # 効果音の再生
  376. Audio.se_play(DATA_SYSTEM_COMMAND_UP_SE) if DATA_SYSTEM_COMMAND_UP_SE != ""
  377. # 呼び戻す
  378. xrxs_bp1_phase3_setup_command_window
  379. end
  380. #--------------------------------------------------------------------------
  381. # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  382. #--------------------------------------------------------------------------
  383. alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  384. def update_phase3_basic_command
  385. # C ボタンが押された場合
  386. if Input.trigger?(Input::C)
  387. # アクターコマンドウィンドウのカーソル位置で分岐
  388. case @actor_command_window.index
  389. when @cp_escape_actor_command_index # 逃げる
  390. if $game_temp.battle_can_escape
  391. # 決定 SE を演奏
  392. $game_system.se_play($data_system.decision_se)
  393. # アクションを設定
  394. @active_battler.current_action.kind = 0
  395. @active_battler.current_action.basic = 4
  396. # 次のアクターのコマンド入力へ
  397. phase3_next_actor
  398. else
  399. # ブザー SE を演奏
  400. $game_system.se_play($data_system.buzzer_se)
  401. end
  402. return
  403. end
  404. end
  405. xrxs_bsp1_update_phase3_basic_command
  406. end
  407. #--------------------------------------------------------------------------
  408. # ● メインフェーズ開始
  409. #--------------------------------------------------------------------------
  410. alias xrxs_bp1_start_phase4 start_phase4
  411. def start_phase4
  412. # 呼び戻す
  413. xrxs_bp1_start_phase4
  414. # CPスレッドを一時停止する
  415. unless @action_battlers.empty?
  416. @cp_thread.stop = true
  417. end
  418. end
  419. #--------------------------------------------------------------------------
  420. # ● 行動順序作成
  421. #--------------------------------------------------------------------------
  422. alias xrxs_bp1_make_action_orders make_action_orders
  423. def make_action_orders
  424. xrxs_bp1_make_action_orders
  425. # 全員のCPを確認
  426. exclude_battler = []
  427. for battler in @action_battlers
  428. # CPが不足している場合は @action_battlers から除外する
  429. if battler.cp < 65535
  430. exclude_battler.push(battler)
  431. end
  432. end
  433. @action_battlers -= exclude_battler
  434. end
  435. #--------------------------------------------------------------------------
  436. # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  437. #--------------------------------------------------------------------------
  438. alias xrxs_bp1_update_phase4_step1 update_phase4_step1
  439. def update_phase4_step1
  440. # 初期化
  441. @phase4_act_continuation = 0
  442. # 勝敗判定
  443. if judge
  444. @cp_thread.stop
  445. # 勝利または敗北の場合 : メソッド終了
  446. return
  447. end
  448. # 未行動バトラー配列の先頭から取得
  449. @active_battler = @action_battlers[0]
  450. # ステータス更新をCPだけに限定。
  451. @status_window.update_cp_only = true
  452. # ステート更新を禁止。
  453. @active_battler.slip_state_update_ban = true if @active_battler != nil
  454. # 戻す
  455. xrxs_bp1_update_phase4_step1
  456. # @status_windowがリフレッシュされなかった場合は手動でリフレッシュ(CPのみ)
  457. if @phase4_step != 2
  458. # リフレッシュ
  459. @status_window.refresh
  460. # 軽量化:たったコレだけΣ(?w?
  461. Graphics.frame_reset
  462. end
  463. # 禁止を解除
  464. @status_window.update_cp_only = false
  465. @active_battler.slip_state_update_ban = false if @active_battler != nil
  466. end
  467. #--------------------------------------------------------------------------
  468. # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  469. #--------------------------------------------------------------------------
  470. alias xrxs_bp1_update_phase4_step2 update_phase4_step2
  471. def update_phase4_step2
  472. # 強制アクションでなければ
  473. unless @active_battler.current_action.forcing
  474. # 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
  475. if @active_battler.restriction == 2 or @active_battler.restriction == 3
  476. # アクションに攻撃を設定
  477. @active_battler.current_action.kind = 0
  478. @active_battler.current_action.basic = 0
  479. end
  480. # 制約が [行動できない] の場合
  481. if @active_battler.restriction == 4
  482. # アクション強制対象のバトラーをクリア
  483. $game_temp.forcing_battler = nil
  484. if @phase4_act_continuation == 0 and @active_battler.cp >= 65535
  485. # ステート自然解除
  486. @active_battler.remove_states_auto
  487. # CP消費
  488. @active_battler.cp -= 65535
  489. # ステータスウィンドウをリフレッシュ
  490. @status_window.refresh
  491. end
  492. # ステップ 1 に移行
  493. @phase4_step = 1
  494. return
  495. end
  496. end
  497. # アクションの種別で分岐
  498. case @active_battler.current_action.kind
  499. when 0
  500. # 攻撃?防御?逃げる?何もしない時の共通消費CP
  501. @active_battler.cp -= CP_COST_BASIC_ACTIONS if @phase4_act_continuation == 0
  502. when 1
  503. # スキル使用時の消費CP
  504. @active_battler.cp -= CP_COST_SKILL_ACTION if @phase4_act_continuation == 0
  505. when 2
  506. # アイテム使用時の消費CP
  507. @active_battler.cp -= CP_COST_ITEM_ACTION if @phase4_act_continuation == 0
  508. end
  509. # ステート自然解除
  510. @active_battler.remove_states_auto
  511. # 呼び戻す
  512. xrxs_bp1_update_phase4_step2
  513. end
  514. #--------------------------------------------------------------------------
  515. # ● 基本アクション 結果作成
  516. #--------------------------------------------------------------------------
  517. alias xrxs_bp1_make_basic_action_result make_basic_action_result
  518. def make_basic_action_result
  519. # 攻撃の場合
  520. if @active_battler.current_action.basic == 0 and @phase4_act_continuation == 0
  521. @active_battler.cp -= CP_COST_BASIC_ATTACK # 攻撃時のCP消費
  522. end
  523. # 防御の場合
  524. if @active_battler.current_action.basic == 1 and @phase4_act_continuation == 0
  525. @active_battler.cp -= CP_COST_BASIC_GUARD # 防御時のCP消費
  526. # @active_battlerの防御をON
  527. @active_battler.now_guarding = true
  528. end
  529. # 敵の逃げるの場合
  530. if @active_battler.is_a?(Game_Enemy) and
  531. @active_battler.current_action.basic == 2 and @phase4_act_continuation == 0
  532. @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
  533. end
  534. # 何もしないの場合
  535. if @active_battler.current_action.basic == 3 and @phase4_act_continuation == 0
  536. @active_battler.cp -= CP_COST_BASIC_NOTHING # 何もしない時のCP消費
  537. end
  538. # 逃げるの場合
  539. if @active_battler.current_action.basic == 4 and @phase4_act_continuation == 0
  540. @active_battler.cp -= CP_COST_BASIC_ESCAPE # 逃走時のCP消費
  541. # 逃走可能ではない場合
  542. if $game_temp.battle_can_escape == false
  543. # ブザー SE を演奏
  544. $game_system.se_play($data_system.buzzer_se)
  545. return
  546. end
  547. # 逃走処理
  548. update_phase2_escape
  549. return
  550. end
  551. # 呼び戻す
  552. xrxs_bp1_make_basic_action_result
  553. end
  554. #--------------------------------------------------------------------------
  555. # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  556. #--------------------------------------------------------------------------
  557. alias xrxs_bp1_update_phase4_step6 update_phase4_step6
  558. def update_phase4_step6
  559. # スリップダメージ
  560. if @active_battler.hp > 0 and @active_battler.slip_damage?
  561. @active_battler.slip_damage_effect
  562. @active_battler.damage_pop = true
  563. # ステータスウィンドウをリフレッシュ
  564. @status_window.refresh
  565. end
  566. # 呼び戻す
  567. xrxs_bp1_update_phase4_step6
  568. end
  569. end
  570.  
  571. #==============================================================================
  572. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  573. #==============================================================================

Lv4.逐梦者

梦石
0
星屑
6286
在线时间
1103 小时
注册时间
2015-8-15
帖子
658
2
发表于 2023-3-9 09:17:05 | 只看该作者
本帖最后由 金芒芒 于 2023-3-9 09:21 编辑

CP条用一条 PS一下P成两条中间空白调一下我方图标和敌方图标坐标看起来像两条,你能放一个脚本,你要设一个追加CP给敌人

点评

我放了两个CP脚本,这两条CP是不一样的,一个是角色的CP,一个是整体的CP。我想知道冲突在了那里,导致强制行动不起作用。其他方面很正常  发表于 2023-3-9 09:31
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
6286
在线时间
1103 小时
注册时间
2015-8-15
帖子
658
3
发表于 2023-3-9 10:31:12 | 只看该作者
本帖最后由 金芒芒 于 2023-3-9 10:32 编辑

我给你一个事件CP,你这个是聚气CP     https://rpg.blue/thread-120760-1-1.html两个CP 就不会有冲突了不过这个是地图事件CP
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
6286
在线时间
1103 小时
注册时间
2015-8-15
帖子
658
4
发表于 2023-3-9 13:08:51 | 只看该作者
  1. # ▽△▽ XRXS. コマンドウィンドウ追加機構 ▽△▽
  2. # by 桜雅 在土

  3. #==============================================================================
  4. # --- XRXS.コマンドウィンドウ追加機構 ---
  5. #==============================================================================
  6. module XRXS_Window_Command
  7.   #--------------------------------------------------------------------------
  8.   # ○ コマンドを追加
  9.   #--------------------------------------------------------------------------
  10.   def add_command(command)
  11.     #
  12.     # 初期化されていない場合、無効化判別用の配列 @disabled の初期化
  13.     #
  14.     @disabled = [] if @disabled.nil?
  15.     if @commands.size != @disabled.size
  16.       for i in [email protected]
  17.         @disabled[i] = false
  18.       end
  19.     end
  20.     #
  21.     # 追加
  22.     #
  23.     @commands.push(command)
  24.     @disabled.push(false)
  25.     @item_max = @commands.size
  26.     self.y -= 32
  27.     self.height += 32
  28.     self.contents.dispose
  29.     self.contents = nil
  30.     self.contents = Bitmap.new(self.width - 32, @item_max * 32)
  31.     refresh
  32.     for i in [email protected]
  33.       if @disabled[i]
  34.         disable_item(i)
  35.       end
  36.     end
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ○ 項目の無効化
  40.   #     index : 項目番号
  41.   #--------------------------------------------------------------------------
  42.   def disable_item(index)
  43.     @disabled = [] if @disabled.nil?
  44.     @disabled[index] = true
  45.     draw_item(index, disabled_color)
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ○ 項目の有効化
  49.   #     index : 項目番号
  50.   #--------------------------------------------------------------------------
  51.   def enable_item(index)
  52.     @disabled = [] if @disabled.nil?
  53.     @disabled[index] = false
  54.     draw_item(index, normal_color)
  55.   end
  56. end
  57. class Window_Command < Window_Selectable
  58.   #--------------------------------------------------------------------------
  59.   # ○ インクルード
  60.   #--------------------------------------------------------------------------
  61.   include XRXS_Window_Command
  62.   #--------------------------------------------------------------------------
  63.   # ● 項目の無効化
  64.   #--------------------------------------------------------------------------
  65.   def disable_item(index)
  66.     super
  67.   end
  68. end

复制代码
  1. # ▼▲▼ XRXS65A. CP制御ターンシステム「シンセ・ゲージ」 ▼▲▼ built201202
  2. # by 桜雅 在土    CP控制转弯系统“合成量规”

  3. #==============================================================================
  4. # □ カスタマイズポイント自定义点
  5. #==============================================================================
  6. class XRXS65A
  7.   #--------------------------------------------------------------------------
  8.   # 「アイコン設定」图标设置
  9.   #--------------------------------------------------------------------------
  10.   DEFAULT = "046-Skill03" # ディフォルトアイコン差分图标
  11.   # 图标散列描述方法:操作者ID=>图标名称
  12.   ICONS = {
  13.     1=>"001-Weapon01",
  14.     2=>"002-Weapon02",
  15.     7=>"007-Weapon07",
  16.     8=>"008-Weapon08"
  17.   }
  18.   # アイコンハッシュE  記述方式 : エネミーID=>アイコン名
  19.   # 图标散列E记述方式:能源ID=>图标名
  20.   ICONE = {
  21.     1=>"046-Skill03",
  22.     2=>"047-Skill04",
  23.   }
  24.   #--------------------------------------------------------------------------
  25.   # 「シンセ・ゲージ」
  26.   #--------------------------------------------------------------------------
  27.   SKIN = "123"  # スキン
  28.   X    =  16         # X 座標
  29.   Y    =  32         # Y 座標
  30. end
  31. #==============================================================================
  32. # --- CP メーターをまとめて管理するクラス、表示関係はすべてココ --- [再定義]
  33. #==============================================================================
  34. class CP_Meters
  35.   #--------------------------------------------------------------------------
  36.   # ○ オブジェクト初期化
  37.   #--------------------------------------------------------------------------
  38.   def initialize
  39.     # シンセゲージの生成
  40.     @base = Sprite.new
  41.     @base.bitmap = RPG::Cache.windowskin(XRXS65A::SKIN).dup
  42.     @base.x = XRXS65A::X
  43.     @base.y = XRXS65A::Y
  44.     @base.z = XRXS65A::X
  45.     @width  = @base.bitmap.width
  46.     @height = @base.bitmap.height
  47.     @icon_set = []
  48.     refresh
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # ○ リフレッシュ
  52.   #--------------------------------------------------------------------------
  53.   def refresh
  54.     # 生成すべきバトラーの取得
  55.     need_initializes = []
  56.     for battler in $game_party.actors + $game_troop.enemies
  57.       exist = false
  58.       for set in @icon_set
  59.         exist |= (set[1] == battler)
  60.       end
  61.       need_initializes.push(battler) unless exist
  62.     end
  63.     for battler in need_initializes
  64.       iconname = nil
  65.       if battler.is_a?(Game_Actor)
  66.         iconname = XRXS65A::ICONS[battler.id]
  67.       else
  68.         iconname = XRXS65A::ICONE[battler.id]
  69.       end
  70.       if iconname == nil
  71.         iconname = XRXS65A::DEFAULT
  72.       end
  73.       sprite = Sprite.new
  74.       sprite.bitmap = RPG::Cache.icon(iconname).dup
  75.       sprite.y = XRXS65A::Y + @height / 2 - 12
  76.       @icon_set.push([sprite, battler])
  77.     end
  78.     # 更新
  79.     for set in @icon_set
  80.       set[0].x = XRXS65A::X + @width * set[1].cp / set[1].max_cp - 12
  81.       set[0].z = set[0].x
  82.       set[0].visible = false if set[1].dead? or !set[1].exist?
  83.     end
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ○ 可視状態
  87.   #--------------------------------------------------------------------------
  88.   def visible=(b)
  89.     @base.visible = b
  90.     @icon_set.each{|set| set[0].visible = b }
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ○ 解放
  94.   #--------------------------------------------------------------------------
  95.   def dispose
  96.     @base.dispose
  97.     @icon_set.each{|set| set[0].dispose }
  98.   end
  99. end

复制代码
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1992
在线时间
1453 小时
注册时间
2009-2-6
帖子
214

开拓者

5
发表于 2023-3-9 22:23:07 | 只看该作者
猜测可能是两个脚本都对Scene_Battle进行修改产生了影响但不好测试,有没有个出错样例工程看看

点评

我是在数据库进行的战斗测试。打的是幽灵。  发表于 2023-3-10 08:16
好的,已经贴出样例工程  发表于 2023-3-10 08:14
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1237
在线时间
163 小时
注册时间
2019-10-4
帖子
217
6
 楼主| 发表于 2023-3-10 08:13:18 | 只看该作者
Project2.zip (636.8 KB, 下载次数: 9) 这是范例文件。基本和我源工程差不多、在执行强制行动,不起作用
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-28 02:55

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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