Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Merging of two scripts please

Code:
 #------------------------------------------------------------------------------
#     Training by Claimh
#==============================================================================

module Training
#==============================================================================
# â–¡ Customizing START
#==============================================================================
  # StateID
  TR_STATE = 17

  # EXP(%)Increase
  TR_PAR = 100

#==============================================================================
# â–¡ Customizing END
#==============================================================================
end

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● アフターバトルフェーズ開始
  #--------------------------------------------------------------------------
  alias start_phase5_trainig start_phase5
  def start_phase5
    # EXPを初期化
    exp = 0
    # ループ
    for enemy in $game_troop.enemies
      # エネミーが隠れ状態でない場合
      unless enemy.hidden
        # 獲得 EXP、ゴールドを追加
        exp += enemy.exp
      end
    end
    # EXP 獲得
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false and actor.states.include?(Training::TR_STATE)
        last_level = actor.level
        actor.exp += (exp * Training::TR_PAR / 100).truncate
        if actor.level > last_level
          @status_window.level_up(i)
        end
      end
    end
    start_phase5_trainig
  end
end
Code:
 #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆ リザルト画面2追加スクリプト「戦利品」 - KGC_RS2[Rewards]  ◆
#_/    â—‡ Last update : 2007/03/16 â—‡
#_/----------------------------------------------------------------------------
#_/  ≪リザルト画面2≫用の戦利品確認画面です。
#_/   画面コード : "KGC[Rewards]"
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ カスタマイズ項目 ★
#==============================================================================

module KGC
module RS2_Rewards
  # ◆レベルアップ画像
  #  "Graphics/Pictures" から読み込む。
  LVUP_IMAGE     = "Level_up"
  # ◆スキル習得画像
  NEWSKILL_IMAGE = "New_skill"
  # ◆レベルアップ SE
  LVUP_SE = RPG::AudioFile.new("116-Raise02")
  # ◆レベルアップ時、経験値の代わりに表示するメッセージ
  LVUP_MSG = "LEVEL UP!"
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

# ○画面コード定義
module KGC::ResultScene2
  SCENE_CODE["KGC[Rewards]"] = Proc.new { Scene_RS2_Rewards.new }
end

#==============================================================================
# â–  Sprite_RewardPartyIcon
#==============================================================================

class Sprite_RewardPartyIcon < Sprite
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     viewport : ビューポート
  #     filename : 画像ファイル名
  #--------------------------------------------------------------------------
  def initialize(viewport = nil, filename = "")
    super(viewport)
    self.bitmap = RPG::Cache.picture(filename)
    # 原点を中央にする
    self.ox = self.bitmap.width >> 1
    self.oy = self.bitmap.height >> 1
    self.zoom_x = self.zoom_y = 3.0
    self.opacity = 150
    self.color.set(255, 255, 255)
    @duration = 80
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    if self.bitmap != nil
      self.bitmap.dispose
    end
    super
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    # アニメーション
    if @duration > 0
      @duration -= 1
      case @duration
      when 60..79  # 出現
        self.zoom_x = self.zoom_y = 1.0 + (@duration - 60) / 10.0
        self.opacity = 255 - (@duration - 60) * 13
      when 40..59
        self.color.set(255, 255, 255, (@duration - 40) * 13)
      when 0..19   # 消去
        self.opacity = @duration * 13
      end
      if @duration == 0
        self.visible = false
      end
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Window_BattleResult
#==============================================================================

class Window_BattleResult < Window_Base
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader   :exp                      # 獲得経験値
  attr_reader   :gold                     # 獲得金額
  attr_reader   :treasures                # 戦利品
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Window_RS2_Rewards_Result
#------------------------------------------------------------------------------
#   戦闘結果を表示するウィンドウです。
#==============================================================================

class Window_RS2_Rewards_Result < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    @exp = $game_temp.battle_exp
    @gold = $game_temp.battle_gold
    @bp = $game_temp.battle_bp
    @ap = $game_temp.battle_ap
    super(0, 0, 320, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.z = 10000
    self.contents.font.name = ["Mercurius Script MT Bold", Font.default_name]
    self.contents.font.size = 20
    self.contents.font.bold = true
    self.contents.font.italic = true
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear

    self.contents.font.color = text_color(3)
    self.contents.font.size = 25
    self.contents.draw_frame_text(4, 32, 256, 48, "Victory!", 1)

    self.contents.font.size = 20
    self.contents.font.color = normal_color
    self.contents.draw_frame_text(4, 80, 160, 48, @exp.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_frame_text(176, 80, 96, 48, "EXP")

    self.contents.font.color = normal_color
    self.contents.draw_frame_text(4, 112, 160, 48, @gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_frame_text(176, 112, 96, 48, $data_system.words.gold)

    if $imported["SkillCPSystem"]
      self.contents.font.color = normal_color
      self.contents.draw_frame_text(4, 160, 160, 48, @bp.to_s, 2)
      self.contents.font.color = system_color
      self.contents.draw_frame_text(176, 160, 96, 48, KGC::BP_NAME)
    end

    if $imported["EquipLearnSkill"]
      self.contents.font.color = normal_color
      self.contents.draw_frame_text(4, 192, 160, 48, @ap.to_s, 2)
      self.contents.font.color = system_color
      self.contents.draw_frame_text(176, 192, 96, 48, "AP")
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Window_RS2_Rewards_Treasure
#------------------------------------------------------------------------------
#   戦利品を表示するウィンドウです。
#==============================================================================

class Window_RS2_Rewards_Treasure < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    @treasures = $game_temp.battle_treasures
    super(320, 0, 320, @treasures.size * 32 + 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 255
    self.z = 10010
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.draw_shadow_text(0, 0, 288, 32, "You Recieved:", 1)
    @treasures.each_with_index { |item, i|
      draw_item_name(item, 4, i * 32 + 32)
    }
  end
  #--------------------------------------------------------------------------
  # ● アイテム名の描画
  #     item : アイテム
  #     x    : 描画先 X 座標
  #     y    : 描画先 Y 座標
  #--------------------------------------------------------------------------
  def draw_item_name(item, x, y)
    if item == nil
      return
    end
    bitmap = RPG::Cache.icon(item.icon_name)
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
    self.contents.font.color = normal_color
    self.contents.draw_shadow_text(x + 28, y, 212, 32, item.name)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Window_RS2_Rewards_Party
#------------------------------------------------------------------------------
#   パーティメンバーを表示するウィンドウです。
#==============================================================================

class Window_RS2_Rewards_Party < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    @actors = $game_party.actors
    @level_up_sprites = []
    @new_skill_sprites = []
    super(320, 0, 320, @actors.size * 64 + 32)
    self.y = (480 - self.height) >> 1
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 255
    self.z = 10000
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 破棄
  #--------------------------------------------------------------------------
  def dispose
    # スプライトを破棄
    (@level_up_sprites + @new_skill_sprites).each { |s|
      s.bitmap.dispose unless s.bitmap.disposed?
      s.dispose
    }
    super
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    level_up_flag = false
    new_skill_flag = false
    self.contents.clear
    @actors.each_with_index { |actor, i|
      dy = i * 64
      # パラメータを描画
      self.contents.font.color = normal_color
      draw_actor_name(actor,   4, dy)
      draw_actor_level(actor, 128, dy)
      # レベルアップした場合
      if actor.level > $game_temp.actor_last_level[actor.id]
        self.contents.font.color = text_color(6)
        self.contents.draw_shadow_text(4, dy + 32, 288, 32,
          KGC::RS2_Rewards::LVUP_MSG)
        # レベルアップスプライトを作成
        sp = Sprite_RewardPartyIcon.new(nil, KGC::RS2_Rewards::LVUP_IMAGE)
        sp.x = self.x + sp.ox + 16
        sp.y = self.y + sp.oy + dy + 16
        sp.z = 11000
        @level_up_sprites << sp
        level_up_flag = true
        actor.recover_all
      # レベルアップしていない場合
      else
        self.contents.font.color = system_color
        self.contents.draw_shadow_text( 4, dy + 32, 64, 32, "NEXT LEVEL:")
        self.contents.font.color = normal_color
        self.contents.draw_shadow_text(80, dy + 32, 96, 32,
          actor.next_rest_exp_s, 2)
      end
      # 新しいスキルを習得した場合
      skills = ($imported["EquipLearnSkill"] || $imported["SkillCPSystem"]) ?
        actor.learned_skills : actor.skills
      if (skills - $game_temp.actor_last_skills[actor.id]).size > 0
        # スキル習得スプライトを作成
        sp = Sprite_RewardPartyIcon.new(nil, KGC::RS2_Rewards::NEWSKILL_IMAGE)
        sp.x = self.x + sp.ox + 16
        sp.y = self.y + sp.oy + dy + 48
        sp.z = 11000
        @new_skill_sprites << sp
        new_skill_flag = true
      end
    }
    # レベルアップ SE を演奏
    if level_up_flag || new_skill_flag
      $game_system.se_play(KGC::RS2_Rewards::LVUP_SE)
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    # スプライトを更新
    (@level_up_sprites + @new_skill_sprites).each { |s|
      s.update
    }
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# â–  Scene_RS2_Rewards
#------------------------------------------------------------------------------
#   戦利品獲得画面を制御するクラスです。
#==============================================================================

class Scene_RS2_Rewards < Scene_RS2
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super  # ← 入れておいた方が、後から機能を追加するときに便利。
    @phase = 1
    @treasures = $game_temp.battle_treasures
    # ウィンドウを作成
    @result_window = Window_RS2_Rewards_Result.new
    @treasure_window = Window_RS2_Rewards_Treasure.new
    @treasure_window.opacity = @treasure_window.contents_opacity = 255
    @party_window = Window_RS2_Rewards_Party.new
  end
  #--------------------------------------------------------------------------
  # ● 破棄
  #--------------------------------------------------------------------------
  def dispose
    super
    # ウィンドウを破棄
    @result_window.dispose
    @treasure_window.dispose
    @party_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 更新
  #--------------------------------------------------------------------------
  def update
    super
    @result_window.update
    @treasure_window.update
    @party_window.update
    case @phase
    when 1
      update_phase1
    when 2
      update_phase2
    else
      exit_scene
    end
  end
  #--------------------------------------------------------------------------
  # ● フェーズ 1 更新
  #--------------------------------------------------------------------------
  def update_phase1
    # C ボタンが押されたら次のフェーズへ
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      if @treasures.size > 0
        @phase = 2
      else
        exit_scene
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● フェーズ 2 更新
  #--------------------------------------------------------------------------
  def update_phase2
    # C ボタンが押されたら終了
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      exit_scene
      return
    end
    # 戦利品ウィンドウをフェードイン
    if @treasure_window.opacity < 255
      @treasure_window.opacity += 16
      @treasure_window.contents_opacity += 16
    end
  end
end

I would like so that when the above state is inflicted the EXP shows the end result.

Training by Claimh allows you to inlflict a state that will muliply the obtained exp by an integer you assign.

Battle_Trophey by KGC simply shows the amount of EXP gained from battle, but won;t show the multiplied amount when the state inflicted.

If someone can help thank you.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top