幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2535|回复: 7

[已解决] 如何在CP战斗脚本里添加一个新的类Game_Pet ?

[复制链接]

40

主题

190

帖子

1635

积分

⑥精研

●~  ●~   ●

积分
1635
发表于 2011-8-26 12:52:36 | 显示全部楼层 |阅读模式
柳柳的宠物脚本就是那个是把宠物装备在角色身上的,可能因为把宠定义为一个新的类Game_Pet,所以与CP战斗冲突,宠物装备后在CP战斗中没有任何反应,我想应该要在CP制御脚本中相应地添加关于宠物的类,请教具体应该怎么写?

宠物脚本
回复

使用道具 举报

40

主题

190

帖子

1635

积分

⑥精研

●~  ●~   ●

积分
1635
 楼主| 发表于 2011-8-26 13:00:31 | 显示全部楼层
宠物脚本太长了显示不出来,要点编辑才看得出



CP制御脚本
  1. module XRXS65
  2.   #
  3.   # 「バトルスピード」(数値が高いほど早い)
  4.   #
  5.   SPEED = 4.0
  6.   #
  7.   # 戦闘開始時 CP。 固定値と占有率
  8.   #
  9.   CP_PRESET_FIXNUM = 0
  10.   CP_PRESET_RATIO  = 2.0
  11.   #
  12.   # ターンコントローラ (nil  : カウント/ターンを有効。
  13.   #                     数値 : そのインデックスをもつエネミーが支配)
  14.   #
  15.   TC = 0
  16.   #
  17.   # カウント/ターン (TCが有効な場合は無視)
  18.   #
  19.   CPT = 40
  20.   #
  21.   # CP スキン
  22.   #
  23.   SKIN        = "123"  # スキンファイル名(Graphics/Windowskinsフォルダ)
  24.   LINE_HEIGHT =  6        # スキンの"一行"の縦幅[単位:ピクセル]
  25.   #
  26.   # 表示位置セッティング
  27.   #
  28.   X_OFFSET = 144    # 横位置
  29.   Y_OFFSET = 464    # 縦位置
  30.   ALIGN    =   1    #「位置揃え」(CPメーターの位置。0:左寄せ 1:中央 2:右寄せ)
  31.   MAX      =   4    # 確保するサイズ[単位:~人分]
  32.   #
  33.   # アクターコマンドがポップしたときの効果音
  34.   #
  35.   COMMAND_UP_SE = "Audio/SE/046-Book01.ogg"
  36. end
  37. #==============================================================================
  38. # --- CP メーターの描画情報の取得 --- (Game_Battlerにインクルードされます)
  39. #==============================================================================
  40. module XRXS_CP
  41.   #--------------------------------------------------------------------------
  42.   # ○ スキンライン (スキンの何行目を使うか)
  43.   #--------------------------------------------------------------------------
  44.   def cp_linetype
  45.     # CP フルの場合はスキンの 2 行目を使う
  46.     return 2 if self.cp_full?
  47.     # 通常はスキンの 1 行目を使う
  48.     return 1
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # ○ メーター量[単位:%]
  52.   #--------------------------------------------------------------------------
  53.   def cp_lineamount
  54.     # 戦闘不能の場合は 0 %として表示させる
  55.     return 0 if self.dead?
  56.     # CP値を%値に変換して返却する
  57.     return 100 * self.cp / self.max_cp
  58.   end
  59. end
  60. #
  61. # カスタマイズポイントここまで。
  62. #------------------------------------------------------------------------------
  63. #==============================================================================
  64. # --- XRXS. CP機構 ---
  65. #==============================================================================
  66. module XRXS_CP_SYSTEM
  67.   #----------------------------------------------------------------------------
  68.   # ○ 合計 AGI の取得
  69.   #----------------------------------------------------------------------------
  70.   def self.total_agi
  71.     total = 0
  72.     for battler in $game_party.actors + $game_troop.enemies
  73.       total += battler.agi
  74.     end
  75.     return total
  76.   end
  77. end
  78. #==============================================================================
  79. # --- バトラーにCP機能を追加 モジュール ---
  80. #==============================================================================
  81. module XRXS_CP
  82.   #--------------------------------------------------------------------------
  83.   # ○ 最大 CP の取得
  84.   #--------------------------------------------------------------------------
  85.   def max_cp
  86.     return 65535
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ○ CP の取得と設定
  90.   #--------------------------------------------------------------------------
  91.   def cp
  92.     return @cp == nil ? @cp = 0 : @cp
  93.   end
  94.   def cp=(n)
  95.     @cp = [[n.to_i, 0].max, self.max_cp].min
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ○ CP 初期設定
  99.   #--------------------------------------------------------------------------
  100.   def cp_preset
  101.     percent = self.max_cp * XRXS65::CP_PRESET_RATIO * (rand(16) + 16) * self.agi / XRXS_CP_SYSTEM.total_agi / 24
  102.     self.cp = XRXS65::CP_PRESET_FIXNUM + percent
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # ○ CP カウントアップ
  106.   #--------------------------------------------------------------------------
  107.   def cp_update
  108.     self.cp += XRXS65::SPEED * 4096 * self.agi / XRXS_CP_SYSTEM.total_agi
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ○ CP 満タン?
  112.   #--------------------------------------------------------------------------
  113.   def cp_full?
  114.     return @cp == self.max_cp
  115.   end
  116. end
  117. class Game_Battler
  118.   include XRXS_CP
  119. end
  120. #==============================================================================
  121. # --- ガード機能 ---
  122. #==============================================================================
  123. class Game_Battler
  124.   #--------------------------------------------------------------------------
  125.   # ○ ガードフラグ
  126.   #--------------------------------------------------------------------------
  127.   def guarding=(n)
  128.     @guarding = n
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ● 防御中判定 [再定義]
  132.   #--------------------------------------------------------------------------
  133.   def guarding?
  134.     return @guarding
  135.   end
  136. end
  137. #==============================================================================
  138. # --- アクター「コマンド入力可能判定」:CPがないとコマンドしない ---
  139. #==============================================================================
  140. module XRXS_CP_INPUTABLE
  141.   def inputable?
  142.     return (self.cp_full? and super)
  143.   end
  144. end
  145. class Game_Actor < Game_Battler
  146.   include XRXS_CP_INPUTABLE
  147. end
  148. #==============================================================================
  149. # --- エネミー「行動可能判定」:CPがないとコマンドしない ---
  150. #==============================================================================
  151. module XRXS_CP_MOVABLE
  152.   def movable?
  153.     return (self.cp_full? and super)
  154.   end
  155. end
  156. class Game_Enemy < Game_Battler
  157.   include XRXS_CP_MOVABLE
  158. end
  159. class Game_Pet < Game_Battler  # XXOO
  160.   include XRXS_CP_MOVABLE
  161. end
  162. #==============================================================================
  163. # --- 戦闘時 CPカウント ---
  164. #==============================================================================
  165. module XRXS_CP_Battle
  166.   #--------------------------------------------------------------------------
  167.   # ○ パーティ全員の CP を初期設定
  168.   #--------------------------------------------------------------------------
  169.   def cp_preset_party
  170.     for actor in $game_party.actors
  171.       actor.cp_preset
  172.     end
  173.   end
  174.   
  175.   #--------------------------------------------------------------------------
  176.   # ○ トループ全員の CP を初期設定
  177.   #--------------------------------------------------------------------------
  178.   def cp_preset_troop
  179.     for enemy in $game_troop.enemies
  180.       enemy.cp_preset
  181.     end
  182.   end
  183.   
  184.   def cp_preset_troop
  185.     for enemy in $game_troop.enemies
  186.       enemy.cp_preset
  187.     end
  188.   end
  189.   
  190.   #--------------------------------------------------------------------------
  191.   # ○ バトラー全員の CP をカウントアップ
  192.   #--------------------------------------------------------------------------
  193.   def cp_update
  194.     for battler in $game_party.actors + $game_troop.enemies
  195.       battler.cp_update
  196.     end
  197.   end
  198. end
  199. class Scene_Battle
  200.   include XRXS_CP_Battle
  201. end
  202. #==============================================================================
  203. # ■ Scene_Battle
  204. #==============================================================================
  205. class Scene_Battle
  206.   #--------------------------------------------------------------------------
  207.   # ● メイン処理
  208.   #--------------------------------------------------------------------------
  209.   alias xrxs65_main main
  210.   def main
  211.     # エクストラスプライトの初期化
  212.     @extra_sprites = [] if @extra_sprites == nil
  213.     # CP の初期化
  214.     cp_preset_party
  215.     # CP メーターの作成
  216.     @cp_meters = CP_Meters.new
  217.     # CP メーターをエクストラスプライトへ登録
  218.     @extra_sprites.push(@cp_meters)
  219.     # 呼び戻す
  220.     xrxs65_main
  221.     # メーターの解放
  222.     @cp_meters.dispose
  223.   end
  224.   #--------------------------------------------------------------------------
  225.   # ● プレバトルフェーズ開始
  226.   #--------------------------------------------------------------------------
  227.   alias xrxs65_start_phase1 start_phase1
  228.   def start_phase1
  229.     # 呼び戻す
  230.     xrxs65_start_phase1
  231.     # CP の初期化
  232.     cp_preset_troop
  233.     # CP メーターの更新
  234.     @cp_meters.refresh
  235.     # インデックスを計算
  236.     @cp_escape_actor_command_index = @actor_command_window.height/32 - 1
  237.     # アクターコマンドウィンドウに追加
  238. #    @actor_command_window.add_command("逃げる")  # XXOO
  239.     if !$game_temp.battle_can_escape
  240.       @actor_command_window.disable_item(@cp_escape_actor_command_index)
  241.     end
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ● パーティコマンドフェーズ開始
  245.   #--------------------------------------------------------------------------
  246.   alias xrxs65_start_phase2 start_phase2
  247.   def start_phase2
  248.     # 呼び戻す
  249.     xrxs65_start_phase2
  250.     # パーティコマンドウィンドウを無効化
  251.     @party_command_window.active  = false
  252.     @party_command_window.visible = false
  253.     # 強制的にフェイズ 2 を保持
  254.     @phase = 2
  255.     # ただし、既に行動可能者が存在する場合は 3 へ
  256.     start_phase3 if anybody_movable?
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # ○ CP制での ターンのカウント
  260.   #--------------------------------------------------------------------------
  261.   def cp_turn_count
  262.     $game_temp.battle_turn += 1
  263.     # バトルイベントの全ページを検索
  264.     for index in 0...$data_troops[@troop_id].pages.size
  265.       # このページのスパンが [ターン] の場合
  266.       if $data_troops[@troop_id].pages[index].span == 1
  267.         # 実行済みフラグをクリア
  268.         $game_temp.battle_event_flags[index] = false
  269.       end
  270.     end
  271.   end
  272.   #--------------------------------------------------------------------------
  273.   # ● フレーム更新 (パーティコマンドフェーズ)
  274.   #--------------------------------------------------------------------------
  275.   alias xrxs65_update_phase2 update_phase2
  276.   def update_phase2
  277.     # パーティコマンドウィンドウのインデックスを無効化
  278.     @party_command_window.index = -1
  279.     # 呼び戻す
  280.     xrxs65_update_phase2
  281.     # 例外補正
  282.     @turn_count_time = 1 if @turn_count_time == nil
  283.     # ターンのカウント
  284.     if @turn_count_time > 0
  285.       @turn_count_time -= 1
  286.       if @turn_count_time == 0
  287.         cp_turn_count
  288.         @turn_count_time = XRXS65::CPT if XRXS65::TC == nil
  289.       end
  290.     end
  291.     # CP のフレーム更新
  292.     cp_update
  293.     @cp_meters.refresh
  294.     # フル CP のバトラーが存在する場合、ターン開始
  295.     start_phase3 if anybody_movable?
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # ○ フル CP バトラーが存在するか?
  299.   #--------------------------------------------------------------------------
  300.   def anybody_movable?
  301.     for battler in $game_party.actors + $game_troop.enemies
  302.       return true if battler.cp_full?
  303.     end
  304.     return false
  305.   end
  306.   #--------------------------------------------------------------------------
  307.   # ● アクターコマンドウィンドウのセットアップ
  308.   #--------------------------------------------------------------------------
  309.   alias xrxs65_phase3_setup_command_window phase3_setup_command_window
  310.   def phase3_setup_command_window
  311.     # 効果音の再生
  312.     Audio.se_play(XRXS65::COMMAND_UP_SE) rescue nil
  313.     # 呼び戻す
  314.     xrxs65_phase3_setup_command_window
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  318.   #--------------------------------------------------------------------------
  319.   alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  320.   def update_phase3_basic_command
  321.     # C ボタンが押された場合
  322.     if Input.trigger?(Input::C)
  323.       # アクターコマンドウィンドウのカーソル位置で分岐
  324.       case @actor_command_window.index
  325.       when @cp_escape_actor_command_index # 逃げる
  326.         if $game_temp.battle_can_escape
  327.           # 決定 SE を演奏
  328.           $game_system.se_play($data_system.decision_se)
  329.           # アクションを設定
  330.           @active_battler.current_action.kind = 0
  331.           @active_battler.current_action.basic = 4
  332.           # 次のアクターのコマンド入力へ
  333.           phase3_next_actor
  334.         else
  335.           # ブザー SE を演奏
  336.           $game_system.se_play($data_system.buzzer_se)
  337.         end
  338.         return
  339.       end
  340.     end
  341.     # 呼び戻す
  342.     xrxs_bsp1_update_phase3_basic_command
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ● メインフェーズ開始
  346.   #--------------------------------------------------------------------------
  347.   alias xrxs65_start_phase4 start_phase4
  348.   def start_phase4
  349.     # ターン数を引くことによって擬似的にカウントに変化を起こさせない
  350.     $game_temp.battle_turn -= 1
  351.     # フラグを退避
  352.     save_flags = $game_temp.battle_event_flags.dup
  353.     # 呼び戻す
  354.     xrxs65_start_phase4
  355.     # フラグを復旧
  356.     $game_temp.battle_event_flags = save_flags
  357.   end
  358.   #--------------------------------------------------------------------------
  359.   # ● 行動順序作成
  360.   #--------------------------------------------------------------------------
  361.   alias xrxs65_make_action_orders make_action_orders
  362.   def make_action_orders
  363.     # 呼び戻す
  364.     xrxs65_make_action_orders
  365.     # CPが不足している場合は @action_battlers から除外する
  366.     for battler in @action_battlers.dup
  367.       @action_battlers.delete(battler) unless battler.cp_full?
  368.     end
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  372.   #--------------------------------------------------------------------------
  373.   alias xrxs65_update_phase4_step2 update_phase4_step2
  374.   def update_phase4_step2
  375.     # ガードの解除
  376.     @active_battler.guarding = false
  377.     # CPの消費
  378.     @active_battler.cp = 0
  379.     # CP メーターの更新
  380.     @cp_meters.refresh
  381.     # 呼び戻す
  382.     xrxs65_update_phase4_step2
  383.     # 例外補正
  384.     return if @active_battler == nil
  385.     # ターンコントローラ
  386.     if @active_battler.is_a?(Game_Enemy) and @active_battler.index == XRXS65::TC
  387.       cp_turn_count
  388.     end
  389.   end
  390.   #--------------------------------------------------------------------------
  391.   # ● 基本アクション 結果作成
  392.   #--------------------------------------------------------------------------
  393.   alias xrxs65_make_basic_action_result make_basic_action_result
  394.   def make_basic_action_result
  395.     # 呼び戻す
  396.     xrxs65_make_basic_action_result
  397.     # 防御の場合
  398.     if @active_battler.current_action.basic == 1
  399.       @active_battler.guarding = true
  400.       return
  401.     end
  402.     # パーティの逃亡の場合
  403.     if @active_battler.current_action.basic == 4
  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.       update_phase2_escape
  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 $game_party.actors.size...@meters.size
  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 + 2
  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 + 2
  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.     @skin   = skin
  510.     @width  = @skin.width
  511.     @height = line_height
  512.     @line   = 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 = 601
  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.     @line = 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, @line * @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
复制代码
回复 支持 反对

使用道具 举报

550

主题

9116

帖子

214748万

积分

超级版主

如同神一般的存在,腿神!拖后腿的神~~

Rank: 8Rank: 8

积分
2147483647
发表于 2011-8-26 13:10:09 | 显示全部楼层
战斗类有冲突很正常。。。应该就是仿照game_actor来做。具体的,要看谁有闲工夫捣腾这个了。
我就是你们的神,庶民们,追随我吧!跟着我一起拖后腿!
回复 支持 反对

使用道具 举报

40

主题

190

帖子

1635

积分

⑥精研

●~  ●~   ●

积分
1635
 楼主| 发表于 2011-8-26 13:55:26 | 显示全部楼层
宠物脚本里找到这些关键词:Game_Pet、$pet_sprites、@pet_actor、@pet_actor = []
CP战斗脚本里关于角色和敌人的大致有这些,就是不知道添加宠物的话怎么替换相应地部分

  def cp_preset_party
    for actor in $game_party.actors
      actor.cp_preset
    end
  end
  
  def cp_preset_troop
    for enemy in $game_troop.enemies
      enemy.cp_preset
    end
  end

  def cp_update
    for battler in $game_party.actors + $game_troop.enemies
      battler.cp_update
    end
  end

  def anybody_movable?
    for battler in $game_party.actors + $game_troop.enemies
      return true if battler.cp_full?
    end
    return false
  end
回复 支持 反对

使用道具 举报

550

主题

9116

帖子

214748万

积分

超级版主

如同神一般的存在,腿神!拖后腿的神~~

Rank: 8Rank: 8

积分
2147483647
发表于 2011-8-26 14:42:11 | 显示全部楼层
一般来说。。宠物脚本是可以自己做的。。。原理就是game_actor复制一遍成为game_pet,然后根据自己的需要作修改。。。比如不用装备,game_party市有关队列的,这个看需要作修改

但是偷懒的话也可以,就是不用做game_pet类,单纯的用game_actor。但是替换队员什么的要做考虑,做适当修改。其他的地方只要有game_actor类出现的地方都做相应的pet类的修改就可以了。。。

我描述的比较混乱。。。哎哎。。。。反正就是照着game_actor来写game_pet或者是直接就用game_actor,game_actor出现的地方都做pet类的相应修改。
我就是你们的神,庶民们,追随我吧!跟着我一起拖后腿!
回复 支持 反对

使用道具 举报

40

主题

190

帖子

1635

积分

⑥精研

●~  ●~   ●

积分
1635
 楼主| 发表于 2011-8-26 14:56:53 | 显示全部楼层
66那个宠物系统有点特别,抓到后是个物品,装备给角色有额外的攻击效果,感觉就是可以攻击敌人的敌人,或者说像某种法宝,和单纯角色类的宠物不太一样吧。因为那个宠物脚本已经定义过了Game_Pet,所以我就想怎么把这个新的类在CP脚本的相应Game_Actor、Game_Enemy 部分复制某些地方替换掉就可以了,就是不知能不能简单地替换?
回复 支持 反对

使用道具 举报

40

主题

190

帖子

1635

积分

⑥精研

●~  ●~   ●

积分
1635
 楼主| 发表于 2011-8-26 15:12:38 | 显示全部楼层
宠物脚本里有一句:  for enemy in @pet_actor   ,莫非这脚本里的宠物其实还是敌人?
回复 支持 反对

使用道具 举报

40

主题

190

帖子

1635

积分

⑥精研

●~  ●~   ●

积分
1635
 楼主| 发表于 2011-8-26 15:42:32 | 显示全部楼层
居然成功了!!?运气真好哇~~我就添加了两个地方:

#--------------------------------------------------------------------------
  # ○ バトラー全員の CP をカウントアップ
  #--------------------------------------------------------------------------
  def cp_update
    for battler in $game_party.actors + $game_troop.enemies + @pet_actor
      battler.cp_update
    end
  end

  #--------------------------------------------------------------------------
  # ○ フル CP バトラーが存在するか?
  #--------------------------------------------------------------------------
  def anybody_movable?
    for battler in $game_party.actors + $game_troop.enemies + @pet_actor
      return true if battler.cp_full?
    end
    return false
  end
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2024-3-28 18:25 , Processed in 0.025053 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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