Status
Not open for further replies.

Silenity

Veteran
Veteran
Joined
Dec 17, 2013
Messages
708
Reaction score
302
First Language
English
Primarily Uses
RMMZ
Hello.

I'd like to request a plugin that can change how much gold is dropped by an enemy.

Here's what it could look like notetagged:

<Gold: 5% 1000-1500><Gold: 10% 400-700><Gold: 50% 100-250><Gold: 75% 1-50>
Code:
<Gold: 100% 0-500>
Code:
<Gold: 50% 0-120><Gold: 1% 8000-22000>
The gold drops do not stack. So if you killed an enemy it would land on one of the Gold%s and then give you Gold = to the variance.

So if I killed a slime and it landed on the <Gold: 10% 400-700> it would give me anywhere between 400-700 gold.
 
Last edited by a moderator:

izyees

My Secret Santa
Veteran
Joined
Oct 24, 2015
Messages
248
Reaction score
67
First Language
english
please make sure you search it before requesting.
 

Silenity

Veteran
Veteran
Joined
Dec 17, 2013
Messages
708
Reaction score
302
First Language
English
Primarily Uses
RMMZ
please make sure you search it before requesting.
Hmm. I looked on here and VXAce.net

I didn't see one. If you know of one, please let me know and I can get someone to close this.
 

izyees

My Secret Santa
Veteran
Joined
Oct 24, 2015
Messages
248
Reaction score
67
First Language
english
The gold drops do not stack. So if you killed an enemy it would land on one of the Gold%s and then give you Gold = to the variance.

So if I killed a slime and it landed on the <Gold: 10% 400-700> it would give me anywhere between 400-700 gold.
what the suppose of the percentage? if <Gold: 50% 400-700> it will still give you between 400-700 right?
 

Silenity

Veteran
Veteran
Joined
Dec 17, 2013
Messages
708
Reaction score
302
First Language
English
Primarily Uses
RMMZ
what the suppose of the percentage? if <Gold: 50% 400-700> it will still give you between 400-700 right?
Killing an enemy would get you a 50% rate of dropping gold at all.

But that can be totally optional.

I'm more looking for the random amount aspect of it.
 

DreamX

Veteran
Veteran
Joined
May 30, 2015
Messages
816
Reaction score
839
First Language
English
Primarily Uses
Here you go:

/*: * @plugindesc v1.0 Adds gold variance. * @author DreamX * @help  If the enemy does not have any correct gold notetags, the default way will be used instead. Notetags must be in this exact same format, including spaces: <Gold: X% Y-Z> X is the percentage chance. Y is the minimum. Z is the maximum. The minimum must be equal to or less than the maximum or the notetag will be ignored. Some examples of correct notetags are: <Gold: 5% 9999-9999> <Gold: 30% 1000-1500> <Gold: 65% 1-5000>  The algorithm that decides gold rewards adds notetags sequentially from top to bottom. Any notetag with a percent that exceeds the current ratio will be ignored.  For example: <Gold: 50% 1000-1000> <Gold: 51% 2000-2000>  In this example, the second notetag will be ignored. In other words, do not exceed 100% in sum with your notetag percents.  It is fine, however, not to reach 100% in percent sums. If the sum of the percents is not 100%, there is a chance that the player may not receive any gold. The chance of not receiving gold would be 100% minus the sum of the percents. * ============================================================================ * Terms Of Use * ============================================================================ * Free to use and modify for commercial and noncommercial games, with credit. * ============================================================================ * Credits * ============================================================================ * DreamX * */var Imported = Imported || {};Imported.DreamX_GoldVariance = true;var DreamX = DreamX || {};DreamX.GoldVariance = DreamX.GoldVariance || {};(function () {    DreamX.GoldVariance.Game_Enemy_gold = Game_Enemy.prototype.gold;    Game_Enemy.prototype.gold = function () {        var variantGoldReward = DreamX.GoldVariance.getGold(this.enemy())        if (variantGoldReward !== -1) {            return variantGoldReward;        }        else {            return DreamX.GoldVariance.Game_Enemy_gold.call(this);        }    };    DreamX.GoldVariance.getGold = function (enemy) {        var correctGoldTags = enemy.note.split("\n").filter(function (note) {            return note.match("\<Gold: [0-9]{1,}% [0-9]{1,}-[0-9]{1,}\>");        });        if (correctGoldTags.length <= 0) {            return -1;        }        var goldSlots = [];        var totalPercentage = 0;        correctGoldTags.forEach(function (tag) {            var percentage = parseInt(tag.split(" ")[1].split("%")[0]);            addPercentage = totalPercentage;            if (addPercentage + percentage <= 100) {                totalPercentage += percentage;                percentage += addPercentage;                var low = tag.split(" ")[2].split("-")[0];                var high = tag.split(" ")[2].split("-")[1].split("\>")[0];                if (parseInt(high) >= parseInt(low)) {                    goldSlots.push({percentage: percentage, low: low, high: high});                }            }        });        if (goldSlots.length <= 0) {            return -1;        }        var diceRoll = Math.floor((Math.random() * 100) + 1);        var gotGoldPrize = false;        var prizeIndex;        if (diceRoll <= goldSlots[goldSlots.length - 1].percentage) {            for (i = 0; i < goldSlots.length && !gotGoldPrize; i++) {                if (goldSlots.percentage >= diceRoll) {                    prizeIndex = i;                    gotGoldPrize = true;                }            }        }        if (!gotGoldPrize) {            return 0;        }        if (goldSlots[prizeIndex].high === goldSlots[prizeIndex].low)            return goldSlots[prizeIndex].low;        return Math.floor((Math.random() * goldSlots[prizeIndex].high)                + goldSlots[prizeIndex].low);    };})();
Terms of Use: Credit DreamX
 

Silenity

Veteran
Veteran
Joined
Dec 17, 2013
Messages
708
Reaction score
302
First Language
English
Primarily Uses
RMMZ
Here you go:

/*: * @plugindesc v1.0 Adds gold variance. * @author DreamX * @help  If the enemy does not have any correct gold notetags, the default way will be used instead. Notetags must be in this exact same format, including spaces: <Gold: X% Y-Z> X is the percentage chance. Y is the minimum. Z is the maximum. The minimum must be equal to or less than the maximum or the notetag will be ignored. Some examples of correct notetags are: <Gold: 5% 9999-9999> <Gold: 30% 1000-1500> <Gold: 65% 1-5000>  The algorithm that decides gold rewards adds notetags sequentially from top to bottom. Any notetag with a percent that exceeds the current ratio will be ignored.  For example: <Gold: 50% 1000-1000> <Gold: 51% 2000-2000>  In this example, the second notetag will be ignored. In other words, do not exceed 100% in sum with your notetag percents.  It is fine, however, not to reach 100% in percent sums. If the sum of the percents is not 100%, there is a chance that the player may not receive any gold. The chance of not receiving gold would be 100% minus the sum of the percents. * ============================================================================ * Terms Of Use * ============================================================================ * Free to use and modify for commercial and noncommercial games, with credit. * ============================================================================ * Credits * ============================================================================ * DreamX * */var Imported = Imported || {};Imported.DreamX_GoldVariance = true;var DreamX = DreamX || {};DreamX.GoldVariance = DreamX.GoldVariance || {};(function () {    DreamX.GoldVariance.Game_Enemy_gold = Game_Enemy.prototype.gold;    Game_Enemy.prototype.gold = function () {        var variantGoldReward = DreamX.GoldVariance.getGold(this.enemy())        if (variantGoldReward !== -1) {            return variantGoldReward;        }        else {            return DreamX.GoldVariance.Game_Enemy_gold.call(this);        }    };    DreamX.GoldVariance.getGold = function (enemy) {        var correctGoldTags = enemy.note.split("\n").filter(function (note) {            return note.match("\<Gold: [0-9]{1,}% [0-9]{1,}-[0-9]{1,}\>");        });        if (correctGoldTags.length <= 0) {            return -1;        }        var goldSlots = [];        var totalPercentage = 0;        correctGoldTags.forEach(function (tag) {            var percentage = parseInt(tag.split(" ")[1].split("%")[0]);            addPercentage = totalPercentage;            if (addPercentage + percentage <= 100) {                totalPercentage += percentage;                percentage += addPercentage;                var low = tag.split(" ")[2].split("-")[0];                var high = tag.split(" ")[2].split("-")[1].split("\>")[0];                if (parseInt(high) >= parseInt(low)) {                    goldSlots.push({percentage: percentage, low: low, high: high});                }            }        });        if (goldSlots.length <= 0) {            return -1;        }        var diceRoll = Math.floor((Math.random() * 100) + 1);        var gotGoldPrize = false;        var prizeIndex;        if (diceRoll <= goldSlots[goldSlots.length - 1].percentage) {            for (i = 0; i < goldSlots.length && !gotGoldPrize; i++) {                if (goldSlots.percentage >= diceRoll) {                    prizeIndex = i;                    gotGoldPrize = true;                }            }        }        if (!gotGoldPrize) {            return 0;        }        if (goldSlots[prizeIndex].high === goldSlots[prizeIndex].low)            return goldSlots[prizeIndex].low;        return Math.floor((Math.random() * goldSlots[prizeIndex].high)                + goldSlots[prizeIndex].low);    };})();


Terms of Use: Credit DreamX


Thanks a ton! <3 You're a beast!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,324
Reaction score
8,755
First Language
German
Primarily Uses
RMMV
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

So before I inevitably start a new project to reorganize myself (I will make sure to save important info dw), I will make an external list of what I want in the final database.
Although a lot of things are still not finished, I can't delay the early access date.
It's her birthday. :kaojoy:
Have you ever been truly comfortable? This weekend I experienced it for the first time in my 33 years on this planet. Try to get comfy, friends.
Every once in a while I check to see if my planned game titles are taken or trademarked. Still okay. I plan to take my time for the sake of quality, but at the same time it feels like a race against some hidden dev out there who also plans to publish or register the same title.
Who else here likes frogs? I sure do like them squishy beings! :rwink:

froggy.png

Forum statistics

Threads
117,193
Messages
1,105,361
Members
153,324
Latest member
duselre
Top