Convert damage in gold loss.

I'm creating a thief enemy that "steals" your money using a damaging skill, whose damage is converted into gold loss. So, to do this, I need a script that works this way: This skill has any damage formula (like the a.atk * 4 - b.def * 2), but instead of dealing damage, it makes the character lose gold based on the result of this damage formula. So, the battle log window must say "Character A loses 5000 Gold!" instead of "Character A received 5000 damage!", to make the players notice how much gold they are losing.

So, can someone do a script with these effects? It must be compatible with Willian Couillard's Final Fantasy Style Battle Log ver 3.06.

Optional: Can also someone find a way to recover the money lost by killing the enemy?
Instead of a script, you could just use a damage formula. This post could be helpful:
Instead of a script, you could just use a damage formula. This post could be helpful:
I'd already tried this, but it only does fixed damage that ignores the target stats and does not show the money lost in the battle log.
but it only does fixed damage that ignores the target stats
You mean like the defense? That's because the formula is not complete. Usually in the formula you add how much the defense of the enemy is going to be taking it into account. The damage is usually expresed as a.atk - b.def
So you have to use that same logic when calculating the x for the gold.

You could also try with yanfly's steal item script.
You mean like the defense? That's because the formula is not complete. Usually in the formula you add how much the defense of the enemy is going to be taking it into account. The damage is usually expresed as a.atk - b.def
So you have to use that same logic when calculating the x for the gold.

You could also try with yanfly's steal item script.
I already have it, it does not work against characters, only against enemies.
Does the damage need to include critical and element bonus like other skills or will it just be straight damage formula?
Does the damage need to include critical and element bonus like other skills or will it just be straight damage formula?
No, just the damage formula, to make things easy for you.
Script update below
Spoiler: Enemy Gold Bag - Steal Gold from Player
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Enemy Gold Bag               ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║   Allows the enemy to store gold    ╠════════════════════╣
# ║   when stolen from the player       ║    14 Aug 2023     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║                                                          ║
# ║   Put note tag on enemy skill note box in order to       ║
# ║   allow the enemy to steal gold from the player          ║
# ║     <gold steal>                                         ║
# ║                                                          ║
# ║   Every enemy will have a gold bag.                      ║
# ║   Every enemy you want to steal needs the steal skill    ║
# ║   with the note tag                                      ║
# ║                                                          ║
# ║   When the enemy is killed, it's gold is taken back      ║
# ║                                                          ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates:                                                 ║
# ║ 1.00 - Created script                                    ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all uses in RPG Maker - Except nudity           ║
# ╚══════════════════════════════════════════════════════════╝

module R2_Enemy_Gold_Bag
  Gold_Steal = "<gold steal>" # tag required on skill to steal gold
  Gold_Text  = "%s lost %s gold!" # Actor, value. e.g. Eric lost 180 gold!
  Gold_Var   = 20  # variable used to store gold stolen for log window
end
 
# ╔══════════════════════════════════════════════════════════╗
# ║ End of Editable Area                                     ║
# ╚══════════════════════════════════════════════════════════╝

#==============================================================================
# ** Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  attr_accessor :gold_bag
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias r2_enemy_gold_bag_initialize  initialize
  def initialize(index, enemy_id)
    r2_enemy_gold_bag_initialize(index, enemy_id)
    @gold_bag = 0
  end
end

#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # * Calculate Damage
  #--------------------------------------------------------------------------
  alias r2_make_gold_stole_damage    make_damage_value
  def make_damage_value(user, item)
    ovars = Marshal.load(Marshal.dump($game_variables))
    oswitchs = $game_switches.clone
    value = item.damage.eval(user, self, $game_variables)
    $game_variables = ovars
    $game_switches = oswitchs
    r2_make_gold_stole_damage(user, item)
    if user.is_a?(Game_Enemy)
      if item.note.include?(R2_Enemy_Gold_Bag::Gold_Steal)
        @result.clear_hit_flags
        if $game_party.gold < value
          value = $game_party.gold
        end
        user.gold_bag += value.to_i
        $game_party.gain_gold(-value.to_i)
        $game_variables[R2_Enemy_Gold_Bag::Gold_Var] = value
        value = 0
        @result.make_damage(value.to_i, item)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Knock Out
  #--------------------------------------------------------------------------
  alias r2_enemy_gold_bag_return_die  die
  def die
    r2_enemy_gold_bag_return_die
    if self.is_a?(Game_Enemy)
      $game_party.gain_gold(self.gold_bag)
    end
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Use Skill/Item
  #--------------------------------------------------------------------------
  alias r2_use_item_gold_stolen use_item
  def use_item
    item = @subject.current_action.item
    targets = @subject.current_action.make_targets.compact
    r2_use_item_gold_stolen
    if item.note.include?(R2_Enemy_Gold_Bag::Gold_Steal)
      @log_window.draw_gold_stolen(targets[0].name, $game_variables[R2_Enemy_Gold_Bag::Gold_Var])
      $game_variables[R2_Enemy_Gold_Bag::Gold_Var] = 0
    end
  end
end

#==============================================================================
# ** Window_BattleLog
#==============================================================================
class Window_BattleLog < Window_Selectable
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Draw Gold Stolen                                             [NEW METHOD] ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
  def draw_gold_stolen(target, value)
    if value > 0
      ww = window_width
      if COOLIE::LOG::SHOW_DAMAGE
        show_log
        back_to(1)
        text = sprintf(R2_Enemy_Gold_Bag::Gold_Text, target, value)
        draw_text(0, 0, ww - 24, line_height, text, v_align)
        wait
        clear
      end
    end
  end
end
Thank you, it worked.

It only has a minor problem, but only fix it if you want: it does not show if you recovered the money after defeating the enemy. After the battle ends, it only still shows the default money amount of the enemy, it does not sum with the stolen money recovered. I'm using Vanfly Victory Aftermath 1.03, but even without this script, it still does not show.

But only fix it if you want, it's just a minor, cosmetic problem.
It only has a minor problem, but only fix it if you want: it does not show if you recovered the money after defeating the enemy. After the battle ends, it only still shows the default money amount of the enemy, it does not sum with the stolen money recovered. I'm using Vanfly Victory Aftermath 1.03, but even without this script, it still does not show.
The easiest way is to show the gold returning when the enemy is defeated.
If I tried to make it so that it waiting until the end then you would have to win the battle because if you lost gold and then killed the enemy that took it but did not get it back yet and then you retreated, you would lose that gold even though you killed the thief.
This alters the previous method so that you see the message when you kill the enemy.
But I took away the player name and changed it to party. You can change the text, just not the %s.
Does this work better?
Spoiler: Enemy Gold Bag - Steal gold from player
Ruby:
# ╔═══════════════════════════════════════════════╦════════════════════╗
# ║ Title: Enemy Gold Bag                         ║  Version: 1.04     ║
# ║ Author: Roninator2                            ║                    ║
# ╠═══════════════════════════════════════════════╬════════════════════╣
# ║ Function:                                     ║   Date Created     ║
# ║   Allows the enemy to store gold              ╠════════════════════╣
# ║   when stolen from the player                 ║    14 Aug 2023     ║
# ╚═══════════════════════════════════════════════╩════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Requires: nil                                                      ║
# ║                                                                    ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Brief Description:                                                 ║
# ║       Enemy holds gold stolen until killed.                        ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Instructions:                                                      ║
# ║                                                                    ║
# ║   Put note tag on enemy skill note box in order to                 ║
# ║   allow the enemy to steal gold from the player                    ║
# ║     <gold steal>                                                   ║
# ║                                                                    ║
# ║   Every enemy will have a gold bag.                                ║
# ║   Every enemy you want to steal needs the steal skill              ║
# ║   with the note tag                                                ║
# ║                                                                    ║
# ║   When the enemy is killed, it's gold is taken back                ║
# ║                                                                    ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Updates:                                                           ║
# ║ 1.00 - 14 Aug 2023 - Script finished                               ║
# ║ 1.01 - 15 Aug 2023 - Set messages to show Party word               ║
# ║ 1.02 - 15 Aug 2023 - Set messages to show actor name               ║
# ║ 1.03 - 20 Aug 2023 - Optimized Code                                ║
# ║ 1.04 - 27 Mar 2024 - Combined actor and party options              ║
# ║                                                                    ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Credits and Thanks:                                                ║
# ║   Roninator2                                                       ║
# ║                                                                    ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Terms of use:                                                      ║
# ║  Follow the original Authors terms of use where applicable         ║
# ║    - When not made by me (Roninator2)                              ║
# ║  Free for all uses in RPG Maker except nudity                      ║
# ║  Anyone using this script in their project before these terms      ║
# ║  were changed are allowed to use this script even if it conflicts  ║
# ║  with these new terms. New terms effective 03 Apr 2024             ║
# ║  No part of this code can be used with AI programs or tools        ║
# ║  Credit must be given                                              ║
# ╚════════════════════════════════════════════════════════════════════╝

module R2_Enemy_Gold_Bag
  Gold_Steal = "<gold steal>" # tag required on skill to steal gold
  
  Use_Actor = true # must be actor or party not both
  Actor_Text  = "%s lost %s gold!" # Actor, value. e.g. Eric lost 180 gold!
  Actor_Saved = "%s recovered %s gold!" # Actor, value. e.g. Eric recovered 180 gold!
  
  # party will be used if actor is false
  Party_Text  = "Party lost %s gold!" # Actor, value. e.g. Eric lost 180 gold!
  Party_Saved = "Party recovered %s gold!" # Actor, value. e.g. Eric recovered 180 gold!
end
 
# ╔════════════════════════════════════════════════════════════════════╗
# ║                      End of editable region                        ║
# ╚════════════════════════════════════════════════════════════════════╝

#==============================================================================
# ** Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  attr_accessor :gold_bag
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias r2_enemy_gold_bag_initialize  initialize
  def initialize(index, enemy_id)
    r2_enemy_gold_bag_initialize(index, enemy_id)
    @gold_bag = 0
  end
end

#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # * Calculate Damage
  #--------------------------------------------------------------------------
  alias r2_make_gold_stole_damage    make_damage_value
  def make_damage_value(user, item)
    ovars = Marshal.load(Marshal.dump($game_variables))
    oswitchs = $game_switches.clone
    value = item.damage.eval(user, self, $game_variables)
    $game_variables = ovars
    $game_switches = oswitchs
    r2_make_gold_stole_damage(user, item)
    if user.is_a?(Game_Enemy)
      if item.note.include?(R2_Enemy_Gold_Bag::Gold_Steal)
        @result.clear_hit_flags
        if $game_party.gold < value
          value = $game_party.gold
        end
        user.gold_bag += value.to_i
        $game_party.gain_gold(-value.to_i)
        value = 0
        @result.make_damage(value.to_i, item)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Knock Out
  #--------------------------------------------------------------------------
  alias r2_enemy_gold_bag_return_die  die
  def die
    r2_enemy_gold_bag_return_die
    if self.is_a?(Game_Enemy)
      if self.gold_bag > 0
        $game_party.gain_gold(self.gold_bag)
        SceneManager.scene.recover_gold(self.gold_bag) if SceneManager.scene_is?(Scene_Battle)
        self.gold_bag = 0
      end
    end
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Use Skill/Item
  #--------------------------------------------------------------------------
  alias r2_use_item_gold_stolen use_item
  def use_item
    item = @subject.current_action.item
    targets = @subject.current_action.make_targets.compact
    r2_use_item_gold_stolen
    if item.note.include?(R2_Enemy_Gold_Bag::Gold_Steal)
      @log_window.draw_gold_stolen(targets[0].name, @subject.gold_bag)
    end
  end
  def recover_gold(gold)
    name = @subject.name
    @log_window.draw_recover_gold(name, gold)
  end
end

#==============================================================================
# ** Window_BattleLog
#==============================================================================
class Window_BattleLog < Window_Selectable
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Draw Gold Stolen                                             [NEW METHOD] ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
  def draw_gold_stolen(target, value)
    if value > 0
      ww = window_width
      if COOLIE::LOG::SHOW_DAMAGE
        show_log
        back_to(1)
        if R2_Enemy_Gold_Bag::Use_Actor
          text = sprintf(R2_Enemy_Gold_Bag::Actor_Text, target, value)
        else
          text = sprintf(R2_Enemy_Gold_Bag::Party_Text, target, value)
        end
        draw_text(0, 0, ww - 24, line_height, text, v_align)
        wait
        clear
      end
    end
  end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Draw Gold Recovered                                          [NEW METHOD] ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
  def draw_recover_gold(actor, value)
    if value > 0
      ww = window_width
      if COOLIE::LOG::SHOW_DAMAGE
        show_log
        back_to(1)
        if R2_Enemy_Gold_Bag::Use_Actor
          text = sprintf(R2_Enemy_Gold_Bag::Actor_Saved, actor, value)
        else
          text = sprintf(R2_Enemy_Gold_Bag::Party_Saved, actor, value)
        end
        draw_text(0, 0, ww - 24, line_height, text, v_align)
        wait
        clear
      end
    end
  end
end
The easiest way is to show the gold returning when the enemy is defeated.
If I tried to make it so that it waiting until the end then you would have to win the battle because if you lost gold and then killed the enemy that took it but did not get it back yet and then you retreated, you would lose that gold even though you killed the thief.
This alters the previous method so that you see the message when you kill the enemy.
But I took away the player name and changed it to party. You can change the text, just not the %s.
Does this work better?
Spoiler: Enemy Gold Bag - Steal gold from player
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Enemy Gold Bag               ║  Version: 1.01     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║   Allows the enemy to store gold    ╠════════════════════╣
# ║   when stolen from the player       ║    14 Aug 2023     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║                                                          ║
# ║   Put note tag on enemy skill note box in order to       ║
# ║   allow the enemy to steal gold from the player          ║
# ║     <gold steal>                                         ║
# ║                                                          ║
# ║   Every enemy will have a gold bag.                      ║
# ║   Every enemy you want to steal needs the steal skill    ║
# ║   with the note tag                                      ║
# ║                                                          ║
# ║   When the enemy is killed, it's gold is taken back      ║
# ║                                                          ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates:                                                 ║
# ║ 1.00 - Created script                                    ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all uses in RPG Maker - Except nudity           ║
# ╚══════════════════════════════════════════════════════════╝

module R2_Enemy_Gold_Bag
  Gold_Steal = "<gold steal>" # tag required on skill to steal gold
  Gold_Text  = "Party lost %s gold!" # Actor, value. e.g. Eric lost 180 gold!
  Gold_Saved = "Party recovered %s gold!" # Actor, value. e.g. Eric recovered 180 gold!
end
 
# ╔══════════════════════════════════════════════════════════╗
# ║ End of Editable Area                                     ║
# ╚══════════════════════════════════════════════════════════╝

#==============================================================================
# ** Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  attr_accessor :gold_bag
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias r2_enemy_gold_bag_initialize  initialize
  def initialize(index, enemy_id)
    r2_enemy_gold_bag_initialize(index, enemy_id)
    @gold_bag = 0
  end
end

#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # * Calculate Damage
  #--------------------------------------------------------------------------
  alias r2_make_gold_stole_damage    make_damage_value
  def make_damage_value(user, item)
    ovars = Marshal.load(Marshal.dump($game_variables))
    oswitchs = $game_switches.clone
    value = item.damage.eval(user, self, $game_variables)
    $game_variables = ovars
    $game_switches = oswitchs
    r2_make_gold_stole_damage(user, item)
    if user.is_a?(Game_Enemy)
      if item.note.include?(R2_Enemy_Gold_Bag::Gold_Steal)
        @result.clear_hit_flags
        if $game_party.gold < value
          value = $game_party.gold
        end
        user.gold_bag += value.to_i
        $game_party.gain_gold(-value.to_i)
        value = 0
        @result.make_damage(value.to_i, item)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Knock Out
  #--------------------------------------------------------------------------
  alias r2_enemy_gold_bag_return_die  die
  def die
    r2_enemy_gold_bag_return_die
    if self.is_a?(Game_Enemy)
      if self.gold_bag > 0
        $game_party.gain_gold(self.gold_bag)
        SceneManager.scene.recover_gold(self.gold_bag) if SceneManager.scene_is?(Scene_Battle)
        self.gold_bag = 0
      end
    end
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Use Skill/Item
  #--------------------------------------------------------------------------
  alias r2_use_item_gold_stolen use_item
  def use_item
    item = @subject.current_action.item
    r2_use_item_gold_stolen
    if item.note.include?(R2_Enemy_Gold_Bag::Gold_Steal)
      @log_window.draw_gold_stolen(@subject.gold_bag)
    end
  end
  def recover_gold(gold)
    @log_window.draw_recover_gold(gold)
  end
end

#==============================================================================
# ** Window_BattleLog
#==============================================================================
class Window_BattleLog < Window_Selectable
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Draw Gold Stolen                                             [NEW METHOD] ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
  def draw_gold_stolen(value)
    if value > 0
      ww = window_width
      if COOLIE::LOG::SHOW_DAMAGE
        show_log
        back_to(1)
        text = sprintf(R2_Enemy_Gold_Bag::Gold_Text, value)
        draw_text(0, 0, ww - 24, line_height, text, v_align)
        wait
        clear
      end
    end
  end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Draw Gold Recovered                                          [NEW METHOD] ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
  def draw_recover_gold(value)
    if value > 0
      ww = window_width
      if COOLIE::LOG::SHOW_DAMAGE
        show_log
        back_to(1)
        text = sprintf(R2_Enemy_Gold_Bag::Gold_Saved, value)
        draw_text(0, 0, ww - 24, line_height, text, v_align)
        wait
        clear
      end
    end
  end
end

And here it is with the players name showing up.
Spoiler: Enemy Gold Bag - Steal Gold from Player
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Enemy Gold Bag               ║  Version: 1.02     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║   Allows the enemy to store gold    ╠════════════════════╣
# ║   when stolen from the player       ║    14 Aug 2023     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║                                                          ║
# ║   Put note tag on enemy skill note box in order to       ║
# ║   allow the enemy to steal gold from the player          ║
# ║     <gold steal>                                         ║
# ║                                                          ║
# ║   Every enemy will have a gold bag.                      ║
# ║   Every enemy you want to steal needs the steal skill    ║
# ║   with the note tag                                      ║
# ║                                                          ║
# ║   When the enemy is killed, it's gold is taken back      ║
# ║                                                          ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates:                                                 ║
# ║ 1.00 - Created script                                    ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all uses in RPG Maker - Except nudity           ║
# ╚══════════════════════════════════════════════════════════╝

module R2_Enemy_Gold_Bag
  Gold_Steal = "<gold steal>" # tag required on skill to steal gold
  Gold_Text  = "%s lost %s gold!" # Actor, value. e.g. Eric lost 180 gold!
  Gold_Saved = "%s recovered %s gold!" # Actor, value. e.g. Eric recovered 180 gold!
end
 
# ╔══════════════════════════════════════════════════════════╗
# ║ End of Editable Area                                     ║
# ╚══════════════════════════════════════════════════════════╝

#==============================================================================
# ** Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  attr_accessor :gold_bag
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias r2_enemy_gold_bag_initialize  initialize
  def initialize(index, enemy_id)
    r2_enemy_gold_bag_initialize(index, enemy_id)
    @gold_bag = 0
  end
end

#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # * Calculate Damage
  #--------------------------------------------------------------------------
  alias r2_make_gold_stole_damage    make_damage_value
  def make_damage_value(user, item)
    ovars = Marshal.load(Marshal.dump($game_variables))
    oswitchs = $game_switches.clone
    value = item.damage.eval(user, self, $game_variables)
    $game_variables = ovars
    $game_switches = oswitchs
    r2_make_gold_stole_damage(user, item)
    if user.is_a?(Game_Enemy)
      if item.note.include?(R2_Enemy_Gold_Bag::Gold_Steal)
        @result.clear_hit_flags
        if $game_party.gold < value
          value = $game_party.gold
        end
        user.gold_bag += value.to_i
        $game_party.gain_gold(-value.to_i)
        value = 0
        @result.make_damage(value.to_i, item)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Knock Out
  #--------------------------------------------------------------------------
  alias r2_enemy_gold_bag_return_die  die
  def die
    r2_enemy_gold_bag_return_die
    if self.is_a?(Game_Enemy)
      if self.gold_bag > 0
        $game_party.gain_gold(self.gold_bag)
        SceneManager.scene.recover_gold(self.gold_bag) if SceneManager.scene_is?(Scene_Battle)
        self.gold_bag = 0
      end
    end
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Use Skill/Item
  #--------------------------------------------------------------------------
  alias r2_use_item_gold_stolen use_item
  def use_item
    item = @subject.current_action.item
    targets = @subject.current_action.make_targets.compact
    r2_use_item_gold_stolen
    if item.note.include?(R2_Enemy_Gold_Bag::Gold_Steal)
      @log_window.draw_gold_stolen(targets[0].name, @subject.gold_bag)
    end
  end
  def recover_gold(gold)
    name = @subject.name
    @log_window.draw_recover_gold(name, gold)
  end
end

#==============================================================================
# ** Window_BattleLog
#==============================================================================
class Window_BattleLog < Window_Selectable
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Draw Gold Stolen                                             [NEW METHOD] ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
  def draw_gold_stolen(target, value)
    if value > 0
      ww = window_width
      if COOLIE::LOG::SHOW_DAMAGE
        show_log
        back_to(1)
        text = sprintf(R2_Enemy_Gold_Bag::Gold_Text, target, value)
        draw_text(0, 0, ww - 24, line_height, text, v_align)
        wait
        clear
      end
    end
  end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Draw Gold Recovered                                          [NEW METHOD] ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
  def draw_recover_gold(actor, value)
    if value > 0
      ww = window_width
      if COOLIE::LOG::SHOW_DAMAGE
        show_log
        back_to(1)
        text = sprintf(R2_Enemy_Gold_Bag::Gold_Saved, actor, value)
        draw_text(0, 0, ww - 24, line_height, text, v_align)
        wait
        clear
      end
    end
  end
end
Thank you, everything is solved now. Both scripts work well. I'll use the first one.
Once again I notice that the first script Koudelka is gonna use from now on is not optimized.
Like it keeps converting value to an integer over and over again. :S
And the last @result.make_damage method call could simply pass a 0 and item as its parameters.
Plus, the Window_BattleLog methods Roninator created could call a third method that could let him avoid some code repetition. Just saying.

Original thread: https://forums.rpgmakerweb.com/threads/convert-damage-in-gold-loss.160280/