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

Project1

 找回密码
 注册会员
搜索
查看: 962|回复: 0

[已经过期] RMXP游戏使用半即时制脚本CP槽敌人图标不显示。

[复制链接]

Lv1.梦旅人

梦石
0
星屑
75
在线时间
10 小时
注册时间
2019-12-2
帖子
1
发表于 2019-12-12 21:34:58 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 guoxiaomi 于 2019-12-22 02:57 编辑

如图,本人使用RMXP制作了一个游戏,采用了半即时制的脚本,但在战斗测试时发现,CP槽上敌人的图标没有显示,跟其他队伍战斗时,有点敌人图标又有显示了。是参数设置出了问题还是脚本出了问题?

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


360截图162906111099695.jpg
360截图1644080693103124.jpg
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-4-19 06:53

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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