Double Gold/Exp based on Luk/Dex

Made this script for a request here.

Sharing it here in case any one else need this feature in their game.

Features:

[1] A chance of double exp/gold based on a sum up total of actor's luck/dex that stacks with the game default double gold/exp.

[2] The more actors with the tags in the battle the higher the chance of getting double gold/exp

[3] Max success rate % per actor can get is 9.99% (999 luck/dex) unless you have scripts that exceed that.

How to Use:

[1] Plug & Play + tags, place the script above Material and below Main

[2] Add <EXTRAEXP> or <extra exp> in the actor's note tag for extra exp based on luck

[3] Add <EXTRAGOLD> or <extra gold> in the actor's note tag for extra gold based on dex

Compatibility:

Part of this script is using the overwrite method, so it will conflict witch scripts that tries to overwrite how the exp/gold is being displayed/earned at the end of a battle.

Terms of Use:

Free for use in commercial and free games

Script:

Spoiler
Code:
#==============================================================================# ■ Meow Face Extra Battle Bonuses#------------------------------------------------------------------------------# Double Exp/Gold based on Actor's Luck/Dex#==============================================================================# How to Use:# [1] Plug & Play, Put this script below Material and above other custom scripts# [2] For the actors you want to have this special ability#      Add <EXTRAEXP> or <extra exp> in the actor's note tag for extra exp based on luck#      Add <EXTRAGOLD> or <extra gold> in the actor's note tag for extra gold based on dex#==============================================================================# Edit Anything Pass This Line at Your Own Risk!#==============================================================================#--------------------------------------------------------------------------# ○ Starting of New Methods#--------------------------------------------------------------------------class RPG::Actor < RPG::BaseItem  def expex    return true if @note[/<(?:EXTRAEXP|extra exp)>/i]    return false  end  def goldex    return true if @note[/<(?:EXTRAGOLD|extra gold)>/i]    return false  end  endclass Game_Actor < Game_Battler  def ex_exp?    actor.expex  end  def ex_gold?    actor.goldex  endendclass Game_Troop < Game_Unit  def get_battle_member_luck    @total_luk = 0    $game_party.battle_members.each do |m|      if m.ex_exp?        @total_luk += m.luk      end    end    return @total_luk/100 if @total_luk != nil  end  def get_battle_member_dex    @total_agi = 0    $game_party.battle_members.each do |m|      if m.ex_gold?        @total_agi += m.agi      end    end    return @total_agi/100  if @total_agi != nil  end  def exp_extra?    @ex_exp_rate = get_battle_member_luck    @rate = rand(100)+1    return true if @rate <= @ex_exp_rate    return false  end  def gold_extra?    @ex_gold_rate = get_battle_member_dex    @rate = rand(100)+1    return true if @rate <= @ex_gold_rate    return false  endend#--------------------------------------------------------------------------# ○ End of New Methods#--------------------------------------------------------------------------module BattleManager#--------------------------------------------------------------------------# ◎ Starting of Alias Methods#--------------------------------------------------------------------------  class <<self      alias meow_setup setup  end  def self.setup(troop_id, can_escape = true, can_lose = false)    meow_setup(troop_id, can_escape = true, can_lose = false)    @extraexp = $game_troop.exp_extra?    @extragold = $game_troop.gold_extra?  end#--------------------------------------------------------------------------# ◎ End of Alias Methods#--------------------------------------------------------------------------#--------------------------------------------------------------------------# ● Starting of Overwrite Methods#--------------------------------------------------------------------------  def self.display_exp    if $game_troop.exp_total > 0      earn = $game_troop.exp_total      earn *= 2 if @extraexp      text = sprintf(Vocab::ObtainExp, earn)      $game_message.add('\.' + "Double Exp Gained!") if @extraexp      $game_message.add('\.' + text)    end  end  def self.gain_gold    if $game_troop.gold_total > 0      earn = $game_troop.gold_total      earn *= 2 if @extragold      text = sprintf(Vocab::ObtainGold, earn)      $game_message.add('\.' + "Double Gold Income!") if @extragold      $game_message.add('\.' + text)      $game_party.gain_gold(earn)    end    wait_for_message  end  def self.gain_exp    earn = $game_troop.exp_total    earn *= 2 if @extraexp    $game_party.all_members.each do |actor|      actor.gain_exp(earn)    end    wait_for_message  endend#--------------------------------------------------------------------------# ● End of Overwrite Methods#--------------------------------------------------------------------------
Although this is a RSSG3 script, many (most?) users of Ace don't use DEX as the name of a stat. What is the Ace equivalent?
Although this is a RSSG3 script, many (most?) users of Ace don't use DEX as the name of a stat. What is the Ace equivalent?
Dex = Agi
Sorry for the necroposting, but can someone post a version of this script that is formatted correctly? Thanks!
Code format fixed.
Spoiler: Meow Face - Extra Battle Binuses
Ruby:
#==============================================================================
# ■ Meow Face Extra Battle Bonuses
#------------------------------------------------------------------------------
# Double Exp/Gold based on Actor's Luck/Dex
#==============================================================================
# How to Use:
# [1] Plug & Play, Put this script below Material and above other custom scripts
# [2] For the actors you want to have this special ability
# Add <EXTRAEXP> or <extra exp> in the actor's note tag for extra exp based on luck
# Add <EXTRAGOLD> or <extra gold> in the actor's note tag for extra gold based on dex
#==============================================================================
# Edit Anything Pass This Line at Your Own Risk!
#==============================================================================
#--------------------------------------------------------------------------
# ○ Starting of New Methods
#--------------------------------------------------------------------------
class RPG::Actor < RPG::BaseItem 
  def expex   
    return true if @note[/<(?:EXTRAEXP|extra exp)>/i]   
    return false 
  end 
  def goldex   
    return true if @note[/<(?:EXTRAGOLD|extra gold)>/i]   
    return false 
  end 
end
class Game_Actor < Game_Battler 
  def ex_exp?   
    actor.expex 
  end 
  def ex_gold?   
    actor.goldex 
  end
end
class Game_Troop < Game_Unit 
  def get_battle_member_luck   
    @total_luk = 0   
    $game_party.battle_members.each do |m|     
      if m.ex_exp?       
        @total_luk += m.luk     
      end   
    end   
    return @total_luk/100 if @total_luk != nil 
  end 
  def get_battle_member_dex   
    @total_agi = 0   
    $game_party.battle_members.each do |m|     
      if m.ex_gold?       
        @total_agi += m.agi     
      end   
    end   
    return @total_agi/100  if @total_agi != nil 
  end 
  def exp_extra?   
    @ex_exp_rate = get_battle_member_luck   
    @rate = rand(100)+1   
    return true if @rate <= @ex_exp_rate   
    return false 
  end 
  def gold_extra?   
    @ex_gold_rate = get_battle_member_dex   
    @rate = rand(100)+1   
    return true if @rate <= @ex_gold_rate   
    return false 
  end
end
#--------------------------------------------------------------------------
# ○ End of New Methods
#--------------------------------------------------------------------------
module BattleManager
#--------------------------------------------------------------------------
# ◎ Starting of Alias Methods
#-------------------------------------------------------------------------- 
  class <<self     
    alias meow_setup setup 
  end 
  def self.setup(troop_id, can_escape = true, can_lose = false)   
    meow_setup(troop_id, can_escape = true, can_lose = false)   
    @extraexp = $game_troop.exp_extra?   
    @extragold = $game_troop.gold_extra? 
  end
#--------------------------------------------------------------------------
# ◎ End of Alias Methods
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ● Starting of Overwrite Methods
#-------------------------------------------------------------------------- 
  def self.display_exp   
    if $game_troop.exp_total > 0     
      earn = $game_troop.exp_total     
      earn *= 2 if @extraexp     
      text = sprintf(Vocab::ObtainExp, earn)     
      $game_message.add('\.' + "Double Exp Gained!") if @extraexp     
      $game_message.add('\.' + text)   
    end 
  end 
  def self.gain_gold   
    if $game_troop.gold_total > 0     
      earn = $game_troop.gold_total     
      earn *= 2 if @extragold     
      text = sprintf(Vocab::ObtainGold, earn)     
      $game_message.add('\.' + "Double Gold Income!") if @extragold     
      $game_message.add('\.' + text)     
      $game_party.gain_gold(earn)   
    end   
    wait_for_message 
  end 
  def self.gain_exp   
    earn = $game_troop.exp_total   
    earn *= 2 if @extraexp   
    $game_party.all_members.each do |actor|     
      actor.gain_exp(earn)   
    end   
    wait_for_message 
    end
end
#--------------------------------------------------------------------------
# ● End of Overwrite Methods
#--------------------------------------------------------------------------
I kinda getting this when i put the formated one:

1780592837280.png


Can someone help me?
Here's the line:
1780592989855.png
I kinda getting this when i put the formated one:

View attachment 367519

Can someone help me?
Here's the line:
Where did you put the script?
It works fine
Mine you you have to have characters with a lot of Agility and Luck to gain the benefits often.
Otherwise it will be quite rare due to the math performed.

Original thread: https://forums.rpgmakerweb.com/threads/double-gold-exp-based-on-luk-dex.45127/