Author Topic: [XP] Gold Variance  (Read 4219 times)

Offline chaucer

  • Transcended Spirit
  • ***
  • Posts: 151
  • LV: 13
  • Gender: Male
    • View Profile
[XP] Gold Variance
« on: June 09, 2013, 11:38:18 AM »
Gold Variance
Authors: Chaucer
Version: 1.0
Type: Battle Add-on
Key Term: Battle Add-on

Introduction
  • Adds Variance to gold so obtained ammount is random based on %


Features

  • Random gold gain from enemies
  • Easy to configure

Screenshots
N/A

Demo
N/A

Script
(click to show/hide)


Instructions
Place below Scene_Debug
Directions Inside Script

Compatibility
not compatible anything that rewrites gained gold method

Credits and Thanks

  • Chaucer
  • Credits not needed anyone could make this.

Author's Notes

Hope it helps someone

Online KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3045
  • LV: 372
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [XP] Gold Variance
« Reply #1 on: June 10, 2013, 09:15:38 AM »
I encourage you to find a more compatible approach to this system. Challenge yourself.



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


NNID: KK20-CP
Discord: KK20 Tyler#8901
Join the CP Discord Server

Offline chaucer

  • Transcended Spirit
  • ***
  • Posts: 151
  • LV: 13
  • Gender: Male
    • View Profile
Re: [XP] Gold Variance
« Reply #2 on: June 10, 2013, 11:03:55 AM »
i tried doing this different ways I'm not very good with scripting as i don't have much time to practice. I'd been looking for something to do this for a while, but couldn't find anything. I'll try and find a better way of making this happen but as of right now this was the only way i could get to work. Also i felt i'd attempt to contribute to the community here,  feel free to delete this post if you want or leave it, cya.

Offline LiTTleDRAgo

  • Astral Trancist
  • *****
  • Posts: 841
  • LV: 514
  • Gender: Male
    • View Profile
    • ~
Re: [XP] Gold Variance
« Reply #3 on: June 10, 2013, 02:14:52 PM »
instead rewriting phase5 Scene_Battle, isn't it easier to modify Window_BattleResult to modify the gold?

(click to show/hide)

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] Gold Variance
« Reply #4 on: June 10, 2013, 03:54:39 PM »
While that would work Drago, you'd still have to modify phase5 to prevent the party from gaining another batch of gold.

Offline LiTTleDRAgo

  • Astral Trancist
  • *****
  • Posts: 841
  • LV: 514
  • Gender: Male
    • View Profile
    • ~
Re: [XP] Gold Variance
« Reply #5 on: June 10, 2013, 07:48:35 PM »
in the script, party only receive the surplus (not all the gold) so its okay

Quote
    inc = rand((gold.to_f * 25 / 100).to_i)
    @gold = gold + inc
    $game_party.gain_gold(inc)

Online KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3045
  • LV: 372
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [XP] Gold Variance
« Reply #6 on: June 10, 2013, 08:05:36 PM »
But now there is no variance, only a percent bonus so to speak. If the party would normally get 1000 gold, assuming 25% variance, they should gain an amount between 750 - 1250. Your fix limits this to 1000 - 1250.

Then you must consider the amount of gold the party has before adding the variance to it. What if the party has max gold (9999999) before the battle, Phase 5 adds (I don't know...) 10000 gold, and after calculating variance the party should happen to get 7500 gold, you can't do a simple $game_party.gain_gold(-2500) because now the party lost money for winning.

I actually have the solution already, but I'll hide it for now unless someone requests it or someone else figures it out. It's very similar to what you have posted Drago.



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


NNID: KK20-CP
Discord: KK20 Tyler#8901
Join the CP Discord Server

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19930
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Gold Variance
« Reply #7 on: June 10, 2013, 08:34:19 PM »
I agree, it has to be done in phase5 of Scene_Battle for the exact same reasons that KK20 already pointed out. That part of the scripts is a weakpoint in that regard, because it wasn't coded in a modular way. Way too much stuff crunched into one method.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline LiTTleDRAgo

  • Astral Trancist
  • *****
  • Posts: 841
  • LV: 514
  • Gender: Male
    • View Profile
    • ~
Re: [XP] Gold Variance
« Reply #8 on: June 11, 2013, 05:06:49 AM »
how about this?

(click to show/hide)
« Last Edit: November 03, 2015, 05:34:37 PM by LiTTleDRAgo »

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] Gold Variance
« Reply #9 on: June 11, 2013, 05:29:39 AM »
You're still gonna gain extra gold. Because you're calling the old method. You're going to have to rewrite the method.

Offline LiTTleDRAgo

  • Astral Trancist
  • *****
  • Posts: 841
  • LV: 514
  • Gender: Male
    • View Profile
    • ~
Re: [XP] Gold Variance
« Reply #10 on: June 11, 2013, 07:23:13 AM »
it's already tested

party gold = 0
enemy = ghost * 3 @1000 G (total 3000 G)
after win 01 gold = 2830 G (get 2830 G)
after win 02 gold = 5981 G (get 3151 G)
after win 03 gold = 9044 G (get 3063 G)

Online KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3045
  • LV: 372
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [XP] Gold Variance
« Reply #11 on: June 11, 2013, 07:50:43 AM »
++ for figuring out something different (and better) than mine.
(click to show/hide)
My way was designed to calculate the party's gold in another variable (stored before phase5 begins) and add/subtract the difference to $game_party.gold after the default method added the base amount.



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


NNID: KK20-CP
Discord: KK20 Tyler#8901
Join the CP Discord Server

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] Gold Variance
« Reply #12 on: June 11, 2013, 08:21:01 AM »
it's already tested

party gold = 0
enemy = ghost * 3 @1000 G (total 3000 G)
after win 01 gold = 2830 G (get 2830 G)
after win 02 gold = 5981 G (get 3151 G)
after win 03 gold = 9044 G (get 3063 G)

Oh! Sorry, I completely missed the fact that you set the enemy's gold to 0. Sorry about that. >.< Nice job. :3

Offline chaucer

  • Transcended Spirit
  • ***
  • Posts: 151
  • LV: 13
  • Gender: Male
    • View Profile
Re: [XP] Gold Variance
« Reply #13 on: June 11, 2013, 08:29:40 AM »
cool, nice work i just started working on mine right now but i see you all already solved it. I'll still use what I've made for my project but nice work. :) i guess back to learning ruby language take care.

Offline djskagnetti

  • Awakened Visionist
  • **
  • Posts: 60
  • LV: -1
    • View Profile
Re: [XP] Gold Variance
« Reply #14 on: August 21, 2015, 11:18:03 PM »
Sorry for Necro, but LiTTleDRAgo's does not work if gold is 1.  It makes it a fraction of 1, so you can get like .9484283 gold, for instance.

KK20's code works, though.