查看: 1792|回复: 8

[已经解决] 用了战斗索敌脚本之后,战斗呼吸效果脚本,敌方就不显...

[复制链接]
梦石
0
星屑
1442
在线时间
171 小时
注册时间
2019-10-4
回帖
162
发表于 2023-3-5 16:49:40 | 显示全部楼层 |阅读模式

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

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

×
己方有了呼吸效果,但是敌方就没有显示 但是不懂在哪里改战斗索敌脚本,下面脚本是,呼吸效果脚本,和战斗索敌脚本。删掉战斗索敌脚本,敌我双方都可以呼吸了。加上之后就只有我方有呼吸效果。
[pre lang="ruby"]#◆◇◆◇◆  息遣いスクリプト ver 1・01  ◇◆◇◆◇
# 全マスタースクリプト共通スクリプト
#  サポート掲示板 http://www2.ezbbs.net/21/minto-aaa/
#   by みんと

=begin

導入場所の注意
エイリアスで構成されていますので、
出来るだけ下のほうに導入してください。

■ 更新履歴

○ ver 1.01(2009/03/10)
  一部の挙動と仕様を変更

説明

フロントビューのバトラーは静止画のため、
ただ立ってるだけという感じが否めず、
これまでは虚しいものでした。

そこに、息遣いを擬似表現します。

ゆっくりと微妙にバトラーが縦方向に小さくなって
またゆっくり元に戻ることで息遣いを再現しました。

=end

#==============================================================================
# ☆ MINTO
#------------------------------------------------------------------------------
#   様々なフラグを扱うメインモジュールです。
#==============================================================================

module MINTO
  
  # 息遣いクリプトを有効化 ( true で有効 / false で無効 )
  RGSS = {}
  RGSS["息遣い"] = true
  
  # アクターの息遣いフラグ(ON : true / OFF : false)
  Actor_Standby =  true
  
end

if MINTO::RGSS["息遣い"] == true then

#==============================================================================
# ■ Sprite_Battler
#------------------------------------------------------------------------------
#  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
# スプライトの状態を自動的に変化させます。
#==============================================================================

class Sprite_Battler < RPG::Sprite
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #    viewport : ビューポート
  #    battler  : バトラー (Game_Battler)
  #    alias    : initialize_MINTO_Standby
  #--------------------------------------------------------------------------
  alias :initialize_MINTO_Standby :initialize
  def initialize(viewport, battler = nil)
    # 元の処理を実行
    initialize_MINTO_Standby(viewport, battler)
    # 息遣い用のデータを設定
    @zoom_turn = 0.1875 / 2
    @zoom_count = 0
    @zoom_puls = 100
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新(息遣い)
  #--------------------------------------------------------------------------
  def update_standby
    # バトラーが無効な場合
    if @battler == nil then
      # メソッドを返す
      return
    end
    # バトラーがアクターで、且つ息遣いが不可能な場合
    if @battler.is_a?(Game_Actor) and MINTO::Actor_Standby == false then
      # メソッドを返す
      return
    end
    # アニメ表示中の場合
    if @_animation_duration >= 1 then
      # メソッドを返す
      return
    end
    # コラプス実行中の場合
    if @_collapse_duration >= 1 then
      # メソッドを返す
      return
    end
    # 初期更新の場合
    unless @setup_standby
      # ランダムに繰り返す
      rand(16).times do
        update_standby_zoom
      end
      # セットアップ済みフラグをオン
      @setup_standby = true
    end
    # 息遣いズームを更新
    update_standby_zoom
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新(息遣いズーム)
  #--------------------------------------------------------------------------
  def update_standby_zoom
    # 息遣いカウントを加算
    @zoom_count += 1
    # カウントが 16 になった場合
    if @zoom_count == 16 then
      # カウントを初期化
      @zoom_count = 0
      # 息遣いターンを反転
      @zoom_turn *= -1
    end
    # 息遣い用の補正値を設定
    @zoom_puls -= @zoom_turn
    # 縦のズームを更新する
    self.zoom_y = (1.0 * @zoom_puls) / 100
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #    alias : update_MINTO_Standby
  #--------------------------------------------------------------------------
  alias :update_MINTO_Standby :update
  def update
    # 息遣いを更新
    update_standby
    # 元の処理を実行
    update_MINTO_Standby
  end
end

end[/pre]
[pre lang="ruby"]# ————————————————————————————————————
# 本脚本来自www.66rpg.com,转载请保留此信息
# ————————————————————————————————————

# ▼▲▼ XRXS_BP 8. バトルバック?Full-View+可動カメラ ver..05d ▼▲▼
# by 桜雅 在土

#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 追加?公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :x_pos # バトルフィールド 横 位置(+が右 )
attr_accessor :y_pos # バトルフィールド 高さ 位置(+が上 )
attr_accessor :z_pos # バトルフィールド奥行き位置(+が手前)
attr_accessor :zoom # 現在のズーム倍率
#战斗场横向位置(+为右)
#战斗场高度位置(+为上)
#战斗场纵深位置(+在跟前)
#当前变焦倍率
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 追加?公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :actor_in_battlefield # アクターもフィールドに
  #--------------------------------------------------------------------------
  # ● セットアップ
  #--------------------------------------------------------------------------
  alias xrxs_bp8_setup setup
  def setup(actor_id)
    xrxs_bp8_setup(actor_id)
    # 機能"アクターもフィールドに"
    # trueを優先する
    @actor_in_battlefield = false if @actor_in_battlefield != true
  end
end
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 追加?公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :actor_in_battlefield # アクターもフィールドに
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias xrxs_bp8_initialize initialize
  def initialize(troop_id, member_index)#——————敌人坐标
    @actor_in_battlefield = false
    @x_pos = $data_troops[troop_id].members[member_index].x - 520
    @y_pos = -($data_troops[troop_id].members[member_index].y - 304)
    @field_x_offset = -192
    @field_y_offset = -144-50
    @z_pos = 0
    @zoom = 1.00
    xrxs_bp8_initialize(troop_id, member_index)
  end
  #--------------------------------------------------------------------------
  # ● バトル画面 X 座標の取得--战斗画面X坐标的取得
  #--------------------------------------------------------------------------
  def screen_x
    $xcam_x = 0 if $xcam_x == nil
    return 320 - @field_x_offset + (@x_pos.to_i - $xcam_x) * @zoom
  end
  #--------------------------------------------------------------------------
  # ● バトル画面 Y 座標の取得--战斗画面Y坐标的取得
  #--------------------------------------------------------------------------
  def screen_y
    $xcam_y = 0 if $xcam_y == nil
    return 240 - @field_y_offset + (-@y_pos.to_i + 64 + $xcam_y) * @zoom
  end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
  #--------------------------------------------------------------------------
  # ● フレーム更新--帧更新
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update update
  def update
    # 初期化
    @z_offset = 0
    # 戻す--复原
    xrxs_bp8_update
    # バトラーが nil の場合戻る--战斗者是否为空的情况下
    return if @battler == nil
    # 敵のみにカメラが影響。--摄像机只影响敌人。
    # 見方もバトルフィールドにいる場合ここの if を外す--视角也在战斗场上的情况下去掉这里的if,and
   if (@battler.is_a?(Game_Actor)and @battler.actor_in_battlefield) or @battler.is_a?(Game_Enemy)
      # ズーム率if (@battler.is_a?(Game_Actor) and @battler.actor_in_battlefield) or @battler.is_a?(Game_Enemy)
      zoom = 1.00 * 200 / (($xcam_z != nil ? $xcam_z : 200) - @z_offset)
      self.zoom_x = zoom
      self.zoom_y = zoom
      @battler.zoom = zoom
      # スプライトの座標を設定--设定精灵的坐标
      self.x = @battler.screen_x
      self.y = @battler.screen_y
      self.z = @battler.screen_z
    end
  end
end
#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias xrxs_bp8_initialize initialize
  def initialize
    # 初期化
    @now_bg_x = -1
    @now_bg_y = -1
    @now_bg_z = -1
    # 通常時の実行
    xrxs_bp8_initialize
    # ビューポートを作成 @viewport1 = Viewport.new(-192, -144, 1024, 768)
    @viewport1 = Viewport.new(-55, -144, 1920, 1080) #————黑边修改
    # バトルバックスプライトを作成
    @battleback_sprite = Sprite.new(@viewport1)
    @battleback_name = ""
    # エネミースプライトを作成
    @enemy_sprites = []
    for enemy in $game_troop.enemies.reverse
      @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
    end
    # 天候を作成
    @weather = RPG::Weather.new(@viewport1)
    # フレーム更新
    update
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 背景坐标
  #--------------------------------------------------------------------------
   alias xrxs_bp8_update update
  def update
    # 战斗背景的文件名和现在的不一样的情况1024, 768 1920, 1080
    if @battleback_name != $game_temp.battleback_name
      @battleback_name = $game_temp.battleback_name
      if @battleback_sprite.bitmap != nil
        @battleback_sprite.bitmap.dispose
      end
      bg_bitmap = RPG::Cache.battleback(@battleback_name)
      bg_bitmap_stretch = Bitmap.new(1280, 1080)
      bg_bitmap_stretch.stretch_blt(Rect.new(0, 0, 1280, 1080), bg_bitmap, bg_bitmap.rect)
      @battleback_sprite.bitmap = bg_bitmap_stretch
    end
    # 相机移动位置的场合
    if @now_bg_x != $xcam_x or @now_bg_y != $xcam_y or @now_bg_z != $xcam_z
      # ズーム率
      zoom = 1.0 * 190 / $xcam_z
      @battleback_sprite.zoom_x = zoom
      @battleback_sprite.zoom_y = zoom
      # 修改相机Z
      maximum = 192 * (296 - $xcam_z) / 100
      $xcam_x = [[$xcam_x, -maximum].max, maximum].min
      # 背景位置更新 500 200
      @battleback_sprite.x = -$xcam_x * zoom - 0 * (zoom - 1) - 5 #————最终背景坐标位置
      @battleback_sprite.y = $xcam_y * zoom - 0* (zoom - 1)- 5 #————最终背景坐标位置
      # 値更新
      @now_bg_x = $xcam_x
      @now_bg_y = $xcam_y
      @now_bg_z = $xcam_z
    end
    # 戻す
    xrxs_bp8_update
  end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● メイン処理(主处理)
  #--------------------------------------------------------------------------
  alias xrxs_bp8_main main
  def main
    # カメラ初期位置決定
    $xcam_x = 0
    $xcam_y = 0
    $xcam_z = 195 #————黑边修改
    # カメラの最初の目的値
    @xcam_x_destination = 0
    @xcam_y_destination = 0
    @xcam_z_destination = 185
    # 今、注目バトラーは無し。
    @xcam_watch_battler = nil
    # 初期化
    @wait_count_xcam = 0
    # 戻す
    xrxs_bp8_main
  end
#--------------------------------------------------------------------------
# ● フレーム更新(フレーム=相机,相机的更新)
#--------------------------------------------------------------------------
  alias xrxs_bp8_update update
  def update
    # カメラ位置の更新。//更新摄像机位置
    if @wait_count_xcam > 0
    # ウェイトカウントを減らす
    @wait_count_xcam -= 1
    else
      # カメラ: Z 座標//相机:Z坐标
      if $xcam_z != @xcam_z_destination
        if $xcam_z < @xcam_z_destination
          distance = [(@xcam_z_destination - $xcam_z)/8, 1].max
        else
          distance = [(@xcam_z_destination - $xcam_z)/8, -1].min
        end
        $xcam_z = [[$xcam_z + distance, 74].max, 296].min#————黑边修改
      end
      # 相机: X 座標(战斗位置的推进)
      if @xcam_watch_battler != nil
        if $xcam_x != @xcam_watch_battler.x_pos
          if ($xcam_x - @xcam_watch_battler.x_pos).abs < 8
            distance = @xcam_watch_battler.x_pos - $xcam_x
          elsif $xcam_x < @xcam_watch_battler.x_pos
            distance = [(@xcam_watch_battler.x_pos - $xcam_x)/8, 8].max
          else
            distance = [(@xcam_watch_battler.x_pos - $xcam_x)/8, -8].min
          end
        maximum = 50 * (296 - $xcam_z) / 111
        $xcam_x = [[$xcam_x + distance, -maximum].max, maximum].min
        end
      elsif $xcam_x != @xcam_x_destination
        if ($xcam_x - @xcam_x_destination).abs < 8
          distance = @xcam_x_destination - $xcam_x
        elsif $xcam_x < @xcam_x_destination
          distance = [(@xcam_x_destination - $xcam_x)/8, 8].max
        else
          distance = [(@xcam_x_destination - $xcam_x)/8, -8].min
        end
        maximum = 50 * (296 - $xcam_z) / 111#————黑边修改
        $xcam_x = [[$xcam_x + distance, -maximum].max, maximum].min
      end
      # カメラ: Y 座標
      if @xcam_watch_battler != nil
      y = @xcam_watch_battler.y_pos/2
        if $xcam_y != y
          if ($xcam_y - y).abs < 8
            distance = y - $xcam_y
          elsif $xcam_y < y
            distance = [(y - $xcam_y)/8, 8].max
          else
            distance = [(y - $xcam_y)/8, -8].min
          end
        maximum = 50 * (296 - $xcam_z) / 111
        $xcam_y = [[$xcam_y + distance, -maximum].max, maximum].min
        end
      elsif $xcam_y != @xcam_y_destination
        if $xcam_y < @xcam_y_destination
          distance = [(@xcam_y_destination - $xcam_y)/8, 1].max
        else
          distance = [(@xcam_y_destination - $xcam_y)/8, -1].min
        end
        maximum = 50 * (296 - $xcam_z) / 111
        $xcam_y = [[$xcam_y + distance, -maximum].max, maximum].min
      end
    end
    # 通常実行
    xrxs_bp8_update
  end
  #--------------------------------------------------------------------------
  # ● パーティコマンドフェーズ開始(指令的指派)
  #--------------------------------------------------------------------------
  alias xrxs_bp8_start_phase2 start_phase2
  def start_phase2
    # カメラ:センタリング
    @xcam_watch_battler = nil
    @xcam_x_destination = 0
    @xcam_z_destination = 185
    # 戻す
    xrxs_bp8_start_phase2
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (アクターコマンドフェーズ)帧更新攻击
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update_phase3 update_phase3
  def update_phase3
    # カメラをキャラ位置へ把摄影机移到角色位置
    if @active_battler != nil and @active_battler.actor_in_battlefield
      @xcam_x_destination = @active_battler.x_pos
      @xcam_z_destination = 175
    end
    xrxs_bp8_update_phase3
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (アクターコマンドフェーズ : エネミー選択)帧更新敌方选项
  #--------------------------------------------------------------------------
   alias xrxs_bp8_update_phase3_enemy_select update_phase3_enemy_select
  def update_phase3_enemy_select
    # カメラ:敵ターゲットをズームアップ
    @xcam_x_destination = $game_troop.enemies[@enemy_arrow.index].x_pos * $game_troop.enemies[@enemy_arrow.index].zoom
    @xcam_z_destination = 175
    # 戻す
    xrxs_bp8_update_phase3_enemy_select
  end
  #--------------------------------------------------------------------------
  # ● エネミー選択終了
  #--------------------------------------------------------------------------
  alias xrxs_bp8_end_enemy_select end_enemy_select
  def end_enemy_select
    # カメラ:中心へ
    @xcam_x_destination = 0
    @xcam_z_destination = 185
    # 戻す
    xrxs_bp8_end_enemy_select
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)主动阶段2动作开始
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update_phase4_step2 update_phase4_step2
    def update_phase4_step2
    # 戻す
    xrxs_bp8_update_phase4_step2
    # ステップ 3 に移行する場合 转移到步骤3的情况
    if @phase4_step == 3
      if @active_battler.is_a?(Game_Enemy) or @active_battler.actor_in_battlefield
        # カメラ:行動バトラーへのズームアップを予約 摄像机预约行动移动变焦
        @xcam_x_destination = @active_battler.x_pos * @active_battler.zoom if @active_battler.x_pos != nil
        @xcam_z_destination = 175
      end
      # 最低 20 フレーム待つ最少等待20帧
      @wait_count = 20
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update_phase4_step3 update_phase4_step3
  def update_phase4_step3
    # 戻す
    xrxs_bp8_update_phase4_step3
    if @target_battlers.size > 0 and
      (@target_battlers[0].is_a?(Game_Enemy) or @target_battlers[0].actor_in_battlefield)
      # カメラ:ターゲットへのズームアップを予約
      @xcam_x_destination = @target_battlers[0].x_pos * @target_battlers[0].zoom if @target_battlers[0] != nil
      @xcam_z_destination = 185
      # もし対象アニメが「位置:画面」のものの場合
      if @animation2_id > 0 and $data_animations[@animation2_id].position == 3
        # カメラをセンタリング
        @xcam_x_destination = 0
        # ズームアウトまでやっちゃう?w?
        @xcam_z_destination = 222
      end
    end
    # 最低 20 フレーム待つ
    @wait_count = 20
  end
  #--------------------------------------------------------------------------
  # ● アフターバトルフェーズ開始
  #--------------------------------------------------------------------------
  alias xrxs_bp8_start_phase5 start_phase5
  def start_phase5
    @xcam_z_destination = 185
    xrxs_bp8_start_phase5
  end
end
#==============================================================================
# ◇ RPG::再定義「戦闘中の"画面"アニメの位置修正」//重新定义“战斗中的“画面”动画位置修正”
#==============================================================================
module RPG
  class Sprite < ::Sprite
    def animation_set_sprites(sprites, cell_data, position)
      for i in 0..15
      sprite = sprites
      pattern = cell_data[i, 0]
      if sprite == nil or pattern == nil or pattern == -1
        sprite.visible = false if sprite != nil
        next
      end
      sprite.visible = true
      sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
      if position == 3
        if self.viewport != nil
          if $scene.is_a?(Scene_Battle)
            sprite.x = self.viewport.rect.width / 2
            sprite.y = 304
          else
            sprite.x = self.viewport.rect.width / 2
            sprite.y = self.viewport.rect.height - 160
          end
        else
          sprite.x = 320
          sprite.y = 240
        end
      else
        sprite.x = self.x - self.ox + self.src_rect.width / 2
        sprite.y = self.y - self.oy + self.src_rect.height / 2
        sprite.y -= self.src_rect.height / 4 if position == 0
        sprite.y += self.src_rect.height / 4 if position == 2
      end
      sprite.x += cell_data[i, 1]
      sprite.y += cell_data[i, 2]
      sprite.z = 2000
      sprite.ox = 96
      sprite.oy = 96
      sprite.zoom_x = cell_data[i, 3] / 100.0
      sprite.zoom_y = cell_data[i, 3] / 100.0
      sprite.angle = cell_data[i, 4]
      sprite.mirror = (cell_data[i, 5] == 1)
      sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
      sprite.blend_type = cell_data[i, 7]
      end
    end
  end
end



[/pre]
梦石
0
星屑
2117
在线时间
1461 小时
注册时间
2009-2-6
回帖
197

开拓者

发表于 2023-3-5 18:34:04 | 显示全部楼层
这两个脚本都对Sprite_Battler的内容进行了重写,简单点实现可以把下面那个バトルバック?Full-View+可動カメラ ver..05d脚本的■Sprite_Battler 那部分语句直接全注释掉,差不多80行到110行的内容,应该就行了

点评

不过注释了之后,少了推进感,不过我觉得我可以解决的,再次感谢  发表于 2023-3-5 19:22
可行的,完美解决,Thanks♪(・ω・)ノ大佬!  发表于 2023-3-5 19:08

评分

参与人数 1星屑 +50 赞 +1 收起 理由
guoxiaomi + 50 + 1 认可答案

查看全部评分

回复 1 0

使用道具 举报

梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2023-3-5 20:09:56 | 显示全部楼层
本帖最后由 soulsaga 于 2023-3-5 20:58 编辑

用了呼吸脚本的效果?               
https://www.bilibili.com/video/BV1SG41177ys

点评

所以试了没/.  发表于 2023-3-6 12:36
试试还原脚本改版 呼吸脚本133和135互换我好像这样改动过  发表于 2023-3-5 20:28
暂时有个很明显的缺陷,在发动全体魔法敌方会被严重压缩,如果能判定在发动魔法的时候取消缩放,效果就会很自然了  发表于 2023-3-5 20:20
回复

使用道具 举报

梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2023-3-6 22:03:19 | 显示全部楼层
我也有同时用这两个脚本..已经自行解决了
只是不太记得过程
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部