Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: G_G on May 17, 2009, 01:56:46 pm

Title: [XP] Gold and Exp Plus
Post by: G_G on May 17, 2009, 01:56:46 pm
Gold and Exp Plus
Authors: game_guy
Version: 1.3
Type: Exp and Gold Add On
Key Term: Battle Add-on



Introduction

In some RPG's I'm sure you've seen some items or equipment that increases the
percent of Experience and Gold you recieve. This script gives weapons and
armors Exp and Gold % that increase the exp and gold you gain.



Features




Screenshots

N/A


Demo
This is the demo for the Default Battle System not Blizz ABS
Demo (http://cid-b4a439303792c7fe.skydrive.live.com/self.aspx/.Public/Project4.exe)


Script

This is for teh Default Battle System
Spoiler: ShowHide

#==============================================================================#
# Gold and Experience Percent Add On
#==============================================================================#
=begin
Intro:
In some RPG's I'm sure you've seen some items or equipment that increases the
percent of Experience and Gold you recieve. This script gives weapons and
armors Exp and Gold %.

What it does is take the percent you defined for the weapon or armor
and makes it a percent. Than it takes the expereince or gold and gets the percent
defined and adds it to it.

Instructions. Go to the BEGIN CONFIG and follow those instructions.

IT IS RECOMMENDED TO USE A NUMBER FROM 1-100 unless you want an item that doubles
the exp or gold you gain.


=end

module RPG
  class Weapon
    def gold_plus
      case id
      #========================================================#
      # BEGIN CONFIG
      #========================================================#
      #========================================================#
      # when weapon_id then return gold gain in percent
      #========================================================#
      when 1 then return 5
      end
      return 0
    end
    def exp_plus
      case id
      #========================================================#
      # when weapon_id then return exp gain in percent
      #========================================================#
      when 1 then return 100
      end
      return 0
    end
  end
  class Armor
    def gold_plus
      case id
      #========================================================#
      # when armor_id then return gold gain in percent
      #========================================================#
      when 1 then return 5
      end
      return 0
    end
    def exp_plus
      case id
      #========================================================#
      # when armor_id then return exp gain in percent
      #========================================================#
      when 1 then return 5
      end
      #========================================================#
      # END CONFIG
      #========================================================#
      return 0
    end
  end
end
class Game_Actor
  def gold_plus
    n = 0
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon.gold_plus if weapon != nil
    n += armor1.gold_plus if armor1 != nil
    n += armor2.gold_plus if armor2 != nil
    n += armor3.gold_plus if armor3 != nil
    n += armor4.gold_plus if armor4 != nil
    return n
  end
  def exp_plus
    n = 0
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon.exp_plus if weapon != nil
    n += armor1.exp_plus if armor1 != nil
    n += armor2.exp_plus if armor2 != nil
    n += armor3.exp_plus if armor3 != nil
    n += armor4.exp_plus if armor4 != nil
    return n
  end
end

class Scene_Battle
  def start_phase5
    @phase = 5
    goldpercent = 0
    $game_system.me_play($game_system.battle_end_me)
    $game_system.bgm_play($game_temp.map_bgm)
    goldpercent += $game_party.actors[0].gold_plus if $game_party.actors[0] != nil
    goldpercent += $game_party.actors[1].gold_plus if $game_party.actors[1] != nil
    goldpercent += $game_party.actors[2].gold_plus if $game_party.actors[2] != nil
    goldpercent += $game_party.actors[3].gold_plus if $game_party.actors[3] != nil
    exppercent = 0
    exppercent += $game_party.actors[0].exp_plus if $game_party.actors[0] != nil
    exppercent += $game_party.actors[1].exp_plus if $game_party.actors[1] != nil
    exppercent += $game_party.actors[2].exp_plus if $game_party.actors[2] != nil
    exppercent += $game_party.actors[3].exp_plus if $game_party.actors[3] != nil
    exp = 0
    gold = 0
    treasures = []
    for enemy in $game_troop.enemies
      unless enemy.hidden
        exp += enemy.exp
        gold += enemy.gold
        if rand(100) < enemy.treasure_prob
          if enemy.item_id > 0
            treasures.push($data_items[enemy.item_id])
          end
          if enemy.weapon_id > 0
            treasures.push($data_weapons[enemy.weapon_id])
          end
          if enemy.armor_id > 0
            treasures.push($data_armors[enemy.armor_id])
          end
        end
      end
    end
    val = gold
    val *= goldpercent
    val = val / 100
    gold += val
   
    val = exp
    val *= exppercent
    val = val / 100
    exp += val
   
    treasures = treasures[0..5]
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          @status_window.level_up(i)
        end
      end
    end
    $game_party.gain_gold(gold)
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    @phase5_wait_count = 100
  end
end


This is for Blizz ABS
Spoiler: ShowHide
#==============================================================================#
# Gold and Experience Percent Add On for BLizz ABS
#==============================================================================#
=begin
Intro:
In some RPG's I'm sure you've seen some items or equipment that increases the
percent of Experience and Gold you recieve. This script gives weapons and
armors Exp and Gold %.

What it does is take the percent you defined for the weapon or armor
and makes it a percent. Than it takes the expereince or gold and gets the percent
defined and adds it to it.

Instructions. Go to the BEGIN CONFIG and follow those instructions.

IT IS RECOMMENDED TO USE A NUMBER FROM 1-100 unless you want an item that doubles
the exp or gold you gain.


=end

module RPG
 class Weapon
   def gold_plus
     case id
     #========================================================#
     # BEGIN CONFIG
     #========================================================#
     #========================================================#
     # when weapon_id then return gold gain in percent
     #========================================================#
     when 1 then return 5
     end
     return 0
   end
   def exp_plus
     case id
     #========================================================#
     # when weapon_id then return exp gain in percent
     #========================================================#
     when 1 then return 100
     end
     return 0
   end
 end
 class Armor
   def gold_plus
     case id
     #========================================================#
     # when armor_id then return gold gain in percent
     #========================================================#
     when 1 then return 5
     end
     return 0
   end
   def exp_plus
     case id
     #========================================================#
     # when armor_id then return exp gain in percent
     #========================================================#
     when 1 then return 5
     end
     #========================================================#
     # END CONFIG
     #========================================================#
     return 0
   end
 end
end
class Game_Actor
 def gold_plus
   n = 0
   weapon = $data_weapons[@weapon_id]
   armor1 = $data_armors[@armor1_id]
   armor2 = $data_armors[@armor2_id]
   armor3 = $data_armors[@armor3_id]
   armor4 = $data_armors[@armor4_id]
   n += weapon.gold_plus if weapon != nil
   n += armor1.gold_plus if armor1 != nil
   n += armor2.gold_plus if armor2 != nil
   n += armor3.gold_plus if armor3 != nil
   n += armor4.gold_plus if armor4 != nil
   return n
 end
 def exp_plus
   n = 0
   weapon = $data_weapons[@weapon_id]
   armor1 = $data_armors[@armor1_id]
   armor2 = $data_armors[@armor2_id]
   armor3 = $data_armors[@armor3_id]
   armor4 = $data_armors[@armor4_id]
   n += weapon.exp_plus if weapon != nil
   n += armor1.exp_plus if armor1 != nil
   n += armor2.exp_plus if armor2 != nil
   n += armor3.exp_plus if armor3 != nil
   n += armor4.exp_plus if armor4 != nil
   return n
 end
end
if BlizzABS::VERSION < 2.51
 raise "Blizz ABS Version isnt high enough. Now Closing."
end

class BlizzABS::Processor
 def gold_result(enemy)
     if enemy.gold != 0
       gold = enemy.gold
       if $tons_version != nil
         if $tons_version >= 6.4 && TONS_OF_ADDONS::DIFFICULTY
           gold = gold * $game_system.gold_rate / 100
         end
         if $tons_version >= 6.5 && $game_system.PASSIVE_SKILLS
           $game_party.actors.each {|actor| gold *= actor.gold_rate}
           gold = gold.to_i
         end
       end
       goldpercent = 0
       goldpercent += $game_party.actors[0].gold_plus if $game_party.actors[0] != nil
       goldpercent += $game_party.actors[0].gold_plus if $game_party.actors[1] != nil
       goldpercent += $game_party.actors[0].gold_plus if $game_party.actors[2] != nil
       goldpercent += $game_party.actors[0].gold_plus if $game_party.actors[3] != nil
       val = gold
       val *= goldpercent
        val = val / 100
       gold += val
       return gold
     end
     return 0
   end
 def exp_result(enemy)
     if enemy.exp != 0
       exp = enemy.exp
       if $tons_version != nil
         if $tons_version >= 6.4 && TONS_OF_ADDONS::DIFFICULTY
           exp = exp * $game_system.exp_rate / 100
         end
         if $tons_version >= 6.5 && $game_system.PASSIVE_SKILLS
           $game_party.actors.each {|actor| exp *= actor.exp_rate}
           exp = exp.to_i
         end
       end
       exppercent = 0
       exppercent += $game_party.actors[0].exp_plus if $game_party.actors[0] != nil
       exppercent += $game_party.actors[0].exp_plus if $game_party.actors[1] != nil
       exppercent += $game_party.actors[0].exp_plus if $game_party.actors[2] != nil
       exppercent += $game_party.actors[0].exp_plus if $game_party.actors[3] != nil
       val = exp
        val *= exppercent
       val = val / 100
       exp += val
       ($BlizzABS.actors + $BlizzABS.pets).each {|b|
           b.battler.exp += exp if b.valid? && !b.battler.cant_get_exp?}
         end
     return exp
   end
 
end



Instructions

In the script.


Compatibility

Not tested with SDK. Should work with most things.

Compatible with Blizz ABS now I released teh plugin.

Not tested with Side View Animated Battle System


Credits and Thanks




Author's Notes

Enjoy!
Title: Re: [XP] Gold and Exp Plus
Post by: G_G on May 21, 2009, 06:15:52 pm
Does anyone like this? Or is to useless. Oh and The plugin for babs is almost done.

*bumps*

Also database worthy?
Title: Re: [XP] Gold and Exp Plus
Post by: Sally on May 21, 2009, 06:36:08 pm
i think its database worthy, but what does the gold % do?
Title: Re: [XP] Gold and Exp Plus
Post by: G_G on May 21, 2009, 06:43:44 pm
The same as exp %

Whatever the weapons or armor gold % is defined to changes the amount of money earned from battles.

Example:
Sword has is defined with 5% extra gold

it'll take 5% of the gold already earned from the battle than adds it to it

It does exactly the same for exp.


So if the Sword has 5% extra gold and you earn 100 gold you'll get 105 gold because 5% of 100 is 5
Title: Re: [XP] Gold and Exp Plus
Post by: Blizzard on May 22, 2009, 04:37:24 am
Quote from: Sally on May 21, 2009, 06:36:08 pm
i think its database worthy, but what does the gold % do?


*slaps his mods* Why is this not in database yet?! >8U *moves*
Title: Re: [XP] Gold and Exp Plus
Post by: G_G on May 22, 2009, 05:30:39 pm
Does anyone like this script at all? Or do you just not get what it does ;___;
Title: Re: [XP] Gold and Exp Plus
Post by: Shadonking on May 23, 2009, 02:28:34 pm
this script is really cool, when the blizz abs plugin is out i will def use it. levelup (Powerup) G_G
Title: Re: [XP] Gold and Exp Plus
Post by: Calintz on May 23, 2009, 02:29:42 pm
Hey silly ...
This is DEF. NOT useless ...

very nice script actually. Good job as always Game_Guy.
Title: Re: [XP] Gold and Exp Plus
Post by: G_G on May 23, 2009, 02:45:48 pm
I finally got it done and made sure all bugs are fixed the script for Babs.

You will only need this script and not the other one.

Spoiler: ShowHide
#==============================================================================#
# Gold and Experience Percent Add On for BLizz ABS
#==============================================================================#
=begin
Intro:
In some RPG's I'm sure you've seen some items or equipment that increases the
percent of Experience and Gold you recieve. This script gives weapons and
armors Exp and Gold %.

What it does is take the percent you defined for the weapon or armor
and makes it a percent. Than it takes the expereince or gold and gets the percent
defined and adds it to it.

Instructions. Go to the BEGIN CONFIG and follow those instructions.

IT IS RECOMMENDED TO USE A NUMBER FROM 1-100 unless you want an item that doubles
the exp or gold you gain.


=end

module RPG
 class Weapon
   def gold_plus
     case id
     #========================================================#
     # BEGIN CONFIG
     #========================================================#
     #========================================================#
     # when weapon_id then return gold gain in percent
     #========================================================#
     when 1 then return 5
     end
     return 0
   end
   def exp_plus
     case id
     #========================================================#
     # when weapon_id then return exp gain in percent
     #========================================================#
     when 1 then return 100
     end
     return 0
   end
 end
 class Armor
   def gold_plus
     case id
     #========================================================#
     # when armor_id then return gold gain in percent
     #========================================================#
     when 1 then return 5
     end
     return 0
   end
   def exp_plus
     case id
     #========================================================#
     # when armor_id then return exp gain in percent
     #========================================================#
     when 1 then return 5
     end
     #========================================================#
     # END CONFIG
     #========================================================#
     return 0
   end
 end
end
class Game_Actor
 def gold_plus
   n = 0
   weapon = $data_weapons[@weapon_id]
   armor1 = $data_armors[@armor1_id]
   armor2 = $data_armors[@armor2_id]
   armor3 = $data_armors[@armor3_id]
   armor4 = $data_armors[@armor4_id]
   n += weapon.gold_plus if weapon != nil
   n += armor1.gold_plus if armor1 != nil
   n += armor2.gold_plus if armor2 != nil
   n += armor3.gold_plus if armor3 != nil
   n += armor4.gold_plus if armor4 != nil
   return n
 end
 def exp_plus
   n = 0
   weapon = $data_weapons[@weapon_id]
   armor1 = $data_armors[@armor1_id]
   armor2 = $data_armors[@armor2_id]
   armor3 = $data_armors[@armor3_id]
   armor4 = $data_armors[@armor4_id]
   n += weapon.exp_plus if weapon != nil
   n += armor1.exp_plus if armor1 != nil
   n += armor2.exp_plus if armor2 != nil
   n += armor3.exp_plus if armor3 != nil
   n += armor4.exp_plus if armor4 != nil
   return n
 end
end
if BlizzABS::VERSION < 2.51
 raise "Blizz ABS Version isnt high enough. Now Closing."
end

class BlizzABS::Processor
 def gold_result(enemy)
     if enemy.gold != 0
       gold = enemy.gold
       if $tons_version != nil
         if $tons_version >= 6.4 && TONS_OF_ADDONS::DIFFICULTY
           gold = gold * $game_system.gold_rate / 100
         end
         if $tons_version >= 6.5 && $game_system.PASSIVE_SKILLS
           $game_party.actors.each {|actor| gold *= actor.gold_rate}
           gold = gold.to_i
         end
       end
       goldpercent = 0
       goldpercent += $game_party.actors[0].gold_plus if $game_party.actors[0] != nil
       goldpercent += $game_party.actors[0].gold_plus if $game_party.actors[1] != nil
       goldpercent += $game_party.actors[0].gold_plus if $game_party.actors[2] != nil
       goldpercent += $game_party.actors[0].gold_plus if $game_party.actors[3] != nil
       val = gold
       val = val / 100
       val = val * goldpercent
       if val < 1
         val = 1
       end
       gold = gold + val
       return gold
     end
     return 0
   end
 def exp_result(enemy)
     if enemy.exp != 0
       exp = enemy.exp
       if $tons_version != nil
         if $tons_version >= 6.4 && TONS_OF_ADDONS::DIFFICULTY
           exp = exp * $game_system.exp_rate / 100
         end
         if $tons_version >= 6.5 && $game_system.PASSIVE_SKILLS
           $game_party.actors.each {|actor| exp *= actor.exp_rate}
           exp = exp.to_i
         end
       end
       exppercent = 0
       exppercent += $game_party.actors[0].exp_plus if $game_party.actors[0] != nil
       exppercent += $game_party.actors[0].exp_plus if $game_party.actors[1] != nil
       exppercent += $game_party.actors[0].exp_plus if $game_party.actors[2] != nil
       exppercent += $game_party.actors[0].exp_plus if $game_party.actors[3] != nil
       val = exp
       val = val / 100
       val = val * exppercent  
       if val < 1
         val = 1
       end
       exp = exp + val
       ($BlizzABS.actors + $BlizzABS.pets).each {|b|
           b.battler.exp += exp if b.valid? && !b.battler.cant_get_exp?}
         end
     return exp
   end
 
end


Quote from: Calintz16438 on May 23, 2009, 02:29:42 pm
Hey silly ...
This is DEF. NOT useless ...

very nice script actually. Good job as always Game_Guy.


What do you mean? Lol.
Title: Re: [XP] Gold and Exp Plus
Post by: Blizzard on May 23, 2009, 04:30:37 pm
DEF. NOT = DEFINITELY NOT
xD
Title: Re: [XP] Gold and Exp Plus
Post by: Calintz on May 23, 2009, 04:39:04 pm
Lmao, thanks for clearing that up Blizzard.

**Note
In your 1st post you asked the forum members if this was a useless script G_G. I am simply throwing out my personal input.
Title: Re: [XP] Gold and Exp Plus
Post by: G_G on May 23, 2009, 04:45:59 pm
Yea I understand now. I really didnt know what DEF meant other than Defense....
thats where my confusion was :^_^':
Title: Re: [XP] Gold and Exp Plus
Post by: Xuroth on May 25, 2009, 02:13:32 pm
Great idea for a script. it reminds me of XP scrolls in Guild Wars
Title: Re: [XP] Gold and Exp Plus
Post by: feandrad on June 04, 2009, 11:09:58 am
Great script!!
Title: Re: [XP] Gold and Exp Plus
Post by: Holyrapid on June 10, 2009, 06:44:03 am
This is such a great script. I´ll use this in my game. Leves up.
Title: Re: [XP] Gold and Exp Plus
Post by: TheGreyFox on June 20, 2009, 12:32:54 pm
Can someone edit this to instead use a player's money to say....power up a certain weapon's attack? Or in my case i need it for a whole set o.o (weapon, armor, helm, gloves and boots)
Title: Re: [XP] Gold and Exp Plus
Post by: G_G on June 20, 2009, 12:59:40 pm
That would go in a script request topic. And instead of editing this script someone would need to make a new one because what you asked for is to power up weapons and armors attacks. Which really doesnt fit this script
Title: Re: [XP] Gold and Exp Plus
Post by: Holyrapid on June 21, 2009, 01:04:47 pm
Hey, G_G, i was wondering if i can give it negative amounts so it instead decreaeses them.
To create "cursed" equipment or something like that.
Title: Re: [XP] Gold and Exp Plus
Post by: G_G on June 21, 2009, 01:16:57 pm
yea you can
when configuring it just use a negative number
when 1 then return -5
Title: Re: [XP] Gold and Exp Plus
Post by: Holyrapid on June 23, 2009, 11:21:47 am
Ok, that´s great :) Thanks G_G
I´ll probaly use this.
Title: Re: [XP] Gold and Exp Plus
Post by: G_G on July 05, 2009, 04:28:27 pm
Updated fixed such a stupid mistake that FTS pointed out xD
Title: Re: [XP] Gold and Exp Plus
Post by: AresWarrior on May 25, 2010, 01:58:31 pm
hey this is a really nice script. i was wondering if you could add an option to increase enemy item drop probability?
Title: Re: [XP] Gold and Exp Plus
Post by: SBR* on May 25, 2010, 03:21:59 pm
Quote from: AresWarrior on May 25, 2010, 01:58:31 pm
hey this is a really nice script. i was wondering if you could add an option to increase enemy item drop probability?


Necropost  >:(.
Title: Re: [XP] Gold and Exp Plus
Post by: djskagnetti on October 08, 2011, 09:19:23 am
sorry for necropost

i've only tried the Demo

i've changed the gold and xp % to 10, 50, 100, 5000, 5000000 and i get 5 xp and 33 gold every time no matter what.
Title: Re: [XP] Gold and Exp Plus
Post by: KK20 on November 29, 2013, 02:16:28 pm
Major necro, but this was brought to my attention from firevenge007.

exp = val
val = val / 100
val = val * goldpercent
gold = gold + val

Thanks to the amazing world of integers, this would generally zero out most of the time. A simple switch of lines was needed. This has been applied to the original post.

exp = val
val = val * goldpercent
val = val / 100
gold = gold + val

I know this was like around the time G_G was getting into RMXP scripting, but even 4 years later people are still using it. :P
Title: Re: [XP] Gold and Exp Plus
Post by: ForeverZer0 on November 30, 2013, 08:38:43 am
It's not really a necro if it is relevant to the topic, and more then just a "I like this script" or something trivial like that.
Title: Re: [XP] Gold and Exp Plus
Post by: KK20 on November 30, 2013, 02:42:55 pm
I like to call them relevant necroposts. It's still a necropost by definition--it's just a tolerable one (according to forum rules).

:urgh: