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

Project1

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

[已经过期] XRXS65 CP制御脚本的修改。

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
375 小时
注册时间
2013-10-1
帖子
77
跳转到指定楼层
1
发表于 2014-6-18 23:31:53 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 斯塔萨菲雅 于 2014-6-19 15:13 编辑

我想修改这个脚本来实现类似仙剑3的仙术延迟发动。
具体的思路是:
脚本默认情况下是cp值走到最大值65536时开始行动,现在我改到50000时就行动,其余情况下都按照原有的来。

需要延迟的技能做成两个,一个是发动的,一个是本体。选择这个技能之后给自己附加一个状态,在此状态下CP值不清0并从50000开始继续增加,增加到65536时根据附加的状态ID发动对应的技能,并解除这个状态然后回到起点。如果状态被意外解除则也是回到0。



现在我只实现了第一行的部分,斜体的部分不会做……求指教,谢谢。

用到的脚本:
另外还需要在 Windowskins 里做一个长条图片,名为 123 ,作为时间闸背景。


RUBY 代码复制
  1. # ▼▲▼ XRXS65. CP制御ターンシステム ver.β ▼▲▼ built 201120
  2. # by 桜雅 在土
  3.  
  4. #==============================================================================
  5. # □ カスタマイズポイント
  6. #==============================================================================
  7. module XRXS65
  8.   #
  9.   # 「バトルスピード」(数値が高いほど早い)
  10.   #
  11.   SPEED = 1.4
  12.   #
  13.   # 戦闘開始時 CP。 固定値と占有率
  14.   #
  15.   CP_PRESET_FIXNUM = 0
  16.   CP_PRESET_RATIO  = 2.0
  17.   #
  18.   # ターンコントローラ (nil  : カウント/ターンを有効。
  19.   #                     数値 : そのインデックスをもつエネミーが支配)
  20.   #
  21.   TC = 0
  22.   #
  23.   # カウント/ターン (TCが有効な場合は無視)
  24.   #
  25.   CPT = 10
  26.   #
  27.   # CP スキン
  28.   #
  29.   SKIN        = "123"  # スキンファイル名(Graphics/Windowskinsフォルダ)
  30.   LINE_HEIGHT =  6        # スキンの"一行"の縦幅[単位:ピクセル]
  31.   #
  32.   # 表示位置セッティング
  33.   #
  34.   X_OFFSET = 2   # 横位置
  35.   Y_OFFSET = 464    # 縦位置
  36.   ALIGN    =   1    #「位置揃え」(CPメーターの位置。0:左寄せ 1:中央 2:右寄せ)
  37.   MAX      =   4    # 確保するサイズ[単位:~人分]
  38.   #
  39.   # アクターコマンドがポップしたときの効果音
  40.   #
  41. #  COMMAND_UP_SE = "026-Door03"
  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, 50000].min
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ○ CP 初期設定
  108.   #--------------------------------------------------------------------------
  109.   def cp_preset
  110.     percent = 50000 * 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 == 50000# 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 xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  318.   def update_phase3_basic_command
  319.     # C ボタンが押された場合
  320.     if Input.trigger?(Input::C)
  321.       # アクターコマンドウィンドウのカーソル位置で分岐
  322.       case @actor_command_window.index
  323.       when @cp_escape_actor_command_index # 逃げる
  324.         if $game_temp.battle_can_escape
  325.           # 決定 SE を演奏
  326.           $game_system.se_play($data_system.decision_se)
  327.           # アクションを設定
  328.           @active_battler.current_action.kind = 0
  329.           @active_battler.current_action.basic = 4
  330.           # 次のアクターのコマンド入力へ
  331.           phase3_next_actor
  332.         else
  333.           # ブザー SE を演奏
  334.           $game_system.se_play($data_system.buzzer_se)
  335.         end
  336.         return
  337.       end
  338.     end
  339.     # 呼び戻す
  340.     xrxs_bsp1_update_phase3_basic_command
  341.   end
  342.   #--------------------------------------------------------------------------
  343.   # ● メインフェーズ開始
  344.   #--------------------------------------------------------------------------
  345.   alias xrxs65_start_phase4 start_phase4
  346. def start_phase4
  347.     $game_temp.battle_turn -= 1
  348.     # フラグを退避
  349.     save_flags = $game_temp.battle_event_flags.dup
  350.     # 呼び戻す
  351.     xrxs65_start_phase4
  352.     # フラグを復旧
  353.     $game_temp.battle_event_flags = save_flags
  354.   end
  355.   #--------------------------------------------------------------------------
  356.   # ● 行動順序作成
  357.   #--------------------------------------------------------------------------
  358.   alias xrxs65_make_action_orders make_action_orders
  359.   def make_action_orders
  360.     # 呼び戻す
  361.     xrxs65_make_action_orders
  362.     # CPが不足している場合は @action_battlers から除外する
  363.     for battler in @action_battlers.dup
  364.       @action_battlers.delete(battler) unless battler.cp_full?
  365.     end
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  369.   #--------------------------------------------------------------------------
  370.   alias xrxs65_update_phase4_step2 update_phase4_step2
  371.   def update_phase4_step2
  372.     # ガードの解除
  373.     @active_battler.guarding = false
  374.     # CPの消費
  375.  
  376.     @active_battler.cp = 0
  377.  
  378.     # CP メーターの更新
  379.     @cp_meters.refresh
  380.     # 呼び戻す
  381.     xrxs65_update_phase4_step2
  382.     # 例外補正
  383.     return if @active_battler == nil
  384.     # ターンコントローラ
  385. if @active_battler.is_a?(Game_Enemy) and @active_battler.index == XRXS65::TC
  386.      cp_turn_count
  387.    end
  388.    end
  389.   #--------------------------------------------------------------------------
  390.   # ● 基本アクション 結果作成
  391.   #--------------------------------------------------------------------------
  392.   alias xrxs65_make_basic_action_result make_basic_action_result
  393.   def make_basic_action_result
  394.     # 呼び戻す
  395.     xrxs65_make_basic_action_result
  396.     # 防御の場合
  397. #    if @active_battler.current_action.basic == 1
  398. #      @active_battler.guarding = true
  399. #      return
  400. #    end
  401.     # パーティの逃亡の場合
  402. #    if @active_battler.current_action.basic == 3
  403.       # 逃走可能ではない場合
  404.  
  405.     #  if $game_temp.battle_can_escape == false
  406.         # ブザー SE を演奏
  407.     #    $game_system.se_play($data_system.buzzer_se)
  408.     #    return
  409.     #  end
  410.       # パーティ全員の CP をクリア
  411.     #  for actor in $game_party.actors
  412.     #    actor.cp = 0
  413.     #  end
  414.       # CP メーターの更新
  415.     #  @cp_meters.refresh
  416.       # 逃走処理
  417.     #$game_temp.battle_abort = true
  418.     #  return
  419. #    end
  420.   end
  421.   #--------------------------------------------------------------------------
  422.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  423.   #--------------------------------------------------------------------------
  424.   alias xrxs65_update_phase4_step5 update_phase4_step5
  425.   def update_phase4_step5
  426.     # 呼び戻す
  427.     xrxs65_update_phase4_step5
  428.     # CP メーターの更新
  429.     @cp_meters.refresh
  430.   end
  431. end
  432. #==============================================================================
  433. # --- CP メーターをまとめて管理するクラス、表示関係はすべてココ ---
  434. #==============================================================================
  435. class CP_Meters
  436.   #--------------------------------------------------------------------------
  437.   # ○ オブジェクト初期化
  438.   #--------------------------------------------------------------------------
  439.   def initialize
  440.     # メーター群の生成
  441.     @meters = []
  442.     for i in 0...$game_party.actors.size
  443.       make_meter(i)
  444.     end
  445.     refresh
  446.   end
  447.   #--------------------------------------------------------------------------
  448.   # ○ リフレッシュ
  449.   #--------------------------------------------------------------------------
  450.   def refresh
  451.     # 戦闘メンバー数の変更を判別
  452.     for i in @meters.size...$game_party.actors.size
  453.       make_meter(i)
  454.     end
  455.     for i in $[email]game_party.actors.size...@meters.size[/email]
  456.       @meters[i].dispose
  457.       @meters[i] = nil
  458.     end
  459.     @meters.compact!
  460.     # 表示更新
  461.     for i in 0...$game_party.actors.size
  462.       actor = $game_party.actors[i]
  463.       @meters[i].line   = actor.cp_linetype
  464.       @meters[i].amount = actor.cp_lineamount
  465.     end
  466.   end
  467.   #--------------------------------------------------------------------------
  468.   # ○ メーターひとつの生成
  469.   #--------------------------------------------------------------------------
  470.   def make_meter(i)
  471.     # スキンの取得
  472.     skin = RPG::Cache.windowskin(XRXS65::SKIN)
  473.     #
  474.     space = 640 / XRXS65::MAX
  475.     case XRXS65::ALIGN
  476.     when 0
  477.       actor_x = i * space + 4
  478.     when 1
  479.       actor_x = (space * ((XRXS65::MAX - $game_party.actors.size)/2.0 + i)).floor
  480.     when 2
  481.       actor_x = (i + XRXS65::MAX - $game_party.actors.size) * space + 4
  482.     end
  483.     meter = MeterSprite.new(skin, XRXS65::LINE_HEIGHT)
  484.     meter.x = actor_x + XRXS65::X_OFFSET - skin.width
  485.     meter.y = XRXS65::Y_OFFSET
  486.     @meters[i] = meter
  487.   end
  488.   #--------------------------------------------------------------------------
  489.   # ○ 可視状態
  490.   #--------------------------------------------------------------------------
  491.   def visible=(b)
  492.     @meters.each{|sprite| sprite.visible = b }
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # ○ 解放
  496.   #--------------------------------------------------------------------------
  497.   def dispose
  498.     @meters.each{|sprite| sprite.dispose }
  499.   end
  500. end
  501. #==============================================================================
  502. # --- XRXS. レクタンギュラーメーター表示・極 ---
  503. #==============================================================================
  504. class MeterSprite < Sprite
  505.   #--------------------------------------------------------------------------
  506.   # ○ オブジェクト初期化
  507.   #--------------------------------------------------------------------------
  508.   def initialize(skin, line_height)
  509.     [url=home.php?mod=space&uid=81523]@skin[/url]   = skin
  510.     @width  = @skin.width
  511.     [url=home.php?mod=space&uid=291977]@height[/url] = line_height
  512.     [url=home.php?mod=space&uid=401263]@line[/url]   = 1
  513.     @amount = 0
  514.     @base_sprite = Sprite.new
  515.     @base_sprite.bitmap = @skin
  516.     @base_sprite.src_rect.set(0, 0, @width, @height)
  517.     @base_sprite.z = 13601
  518.     super()
  519.     self.z = @base_sprite.z + 1
  520.     self.bitmap = @skin
  521.     self.line = 1
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ○ 値の設定
  525.   #--------------------------------------------------------------------------
  526.   def line=(n)
  527.     [url=home.php?mod=space&uid=401263]@line[/url] = n
  528.     refresh
  529.   end
  530.   def amount=(n)
  531.     @amount = n
  532.     refresh
  533.   end
  534.   def refresh
  535.     self.src_rect.set(0, [url=home.php?mod=space&uid=401263]@line[/url] * @height, @width * @amount / 100, @height)
  536.   end
  537.   #--------------------------------------------------------------------------
  538.   # ○ 座標の設定
  539.   #--------------------------------------------------------------------------
  540.   def x=(n)
  541.     super
  542.     @base_sprite.x = n
  543.   end
  544.   def y=(n)
  545.     super
  546.     @base_sprite.y = n
  547.   end
  548.   #--------------------------------------------------------------------------
  549.   # ○ 解放
  550.   #--------------------------------------------------------------------------
  551.   def dispose
  552.     @base_sprite.dispose
  553.     super
  554.   end
  555. end



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


RUBY 代码复制
  1. # ▽△▽ XRXS. コマンドウィンドウ追加機構 ▽△▽
  2. # by 桜雅 在土
  3.  
  4. #==============================================================================
  5. # --- XRXS.コマンドウィンドウ追加機構 ---
  6. #==============================================================================
  7. module XRXS_Window_Command
  8.         #--------------------------------------------------------------------------
  9.         # ○ コマンドを追加
  10.         #--------------------------------------------------------------------------
  11.         def add_command(command)
  12.                 #
  13.                 # 初期化されていない場合、無効化判別用の配列 [url=home.php?mod=space&uid=249395]@disabled[/url] の初期化
  14.                 #
  15.                 [url=home.php?mod=space&uid=249395]@disabled[/url] = [] if @disabled.nil?
  16.                 if @commands.size != @disabled.size
  17.                         for i in [email]0...@commands.size[/email]
  18.                                 @disabled[i] = false
  19.                         end
  20.                 end
  21.                 #
  22.                 # 追加
  23.                 #
  24.                 @commands.push(command)
  25.                 @disabled.push(false)
  26.                 @item_max = @commands.size
  27.                 self.y -= 32
  28.                 self.height += 32
  29.                 self.contents.dispose
  30.                 self.contents = nil
  31.                 self.contents = Bitmap.new(self.width - 32, @item_max * 32)
  32.                 refresh
  33.                 for i in [email]0...@commands.size[/email]
  34.                         if @disabled[i]
  35.                                 disable_item(i)
  36.                         end
  37.                 end
  38.         end
  39.         #--------------------------------------------------------------------------
  40.         # ○ 項目の無効化
  41.         #     index : 項目番号
  42.         #--------------------------------------------------------------------------
  43.         def disable_item(index)
  44.                 [url=home.php?mod=space&uid=249395]@disabled[/url] = [] if @disabled.nil?
  45.                 @disabled[index] = true
  46.                 draw_item(index, disabled_color)
  47.         end
  48.         #--------------------------------------------------------------------------
  49.         # ○ 項目の有効化
  50.         #     index : 項目番号
  51.         #--------------------------------------------------------------------------
  52.         def enable_item(index)
  53.                 [url=home.php?mod=space&uid=249395]@disabled[/url] = [] if @disabled.nil?
  54.                 @disabled[index] = false
  55.                 draw_item(index, normal_color)
  56.         end
  57. end
  58. class Window_Command < Window_Selectable
  59.         #--------------------------------------------------------------------------
  60.         # ○ インクルード
  61.         #--------------------------------------------------------------------------
  62.         include XRXS_Window_Command
  63.         #--------------------------------------------------------------------------
  64.         # ● 項目の無効化
  65.         #--------------------------------------------------------------------------
  66.         def disable_item(index)
  67.                 super
  68.         end
  69. end
     
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-9-30 21:20

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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