RPG Maker Forums

Shop Tracking v1.01
Author: Michael Morris @Blue Booth Studios

Introduction
This simple plugin allows you to bind two variables to track the amount of gold players spend buying items in stores, and the amount of gold players earn selling items in stores.


Features
- Can track player gold spent/earned from buying/selling.
- Common use is for Achievements.

How to Use
- Copy script into your game js/plugins directory.
- Import plugin and set tracking variables in plugin config.
- Call script plugin commands within your own events or plugins.


Requirements
This script has no external requirements.


Demo
No demo provided.

Script
Code:
//=============================================================================
// Bluebooth Plugins - Track Shopping
// BBS_TrackShopping.js
//=============================================================================

//=============================================================================
 /*:
 * @title Track Shopping Plugin
 * @author Michael Morris (https://www.*******.com/bluebooth)
 * @date Feb 13, 2016
 * @filename BBS_TrackShopping.js
 * If you enjoy my work, consider supporting me on *******!
 *
 * https://www.*******.com/bluebooth
 *
 * @plugindesc v1.01 Tracks total money the player spends buying and selling at stores.
 * Special Thanks to Tsukihime for all the help.
 * Special Thanks to 'Ramza' Michael Sweeney for being so supportive.
 *
 * ============================================================================
 * Terms of Use
 * ============================================================================
 *  - Free for use in non-commercial and commercial projects with credits
 *
 * ============================================================================
 * Parameters
 * ============================================================================
 * @param Buying Tracking Game Variable
 * @desc Index of Game Variable to use to track amount bought.  Tracking does not reset when saving/loading.
 * @default -1
 *
 * @param Selling Tracking Game Variable
 * @desc Index of Game Variable to use to track amount sold.  Tracking does not reset when saving/loading.
 * @default -1
 *
 * @help
 * ============================================================================
 * Description
 * ============================================================================
 *
 * Tracks total money the player spends buying and selling at stores.
 *
 * ============================================================================
 * Change Log
 * ============================================================================
 * 1.01 - Plugin finished.
 *
 */
//=============================================================================

//=============================================================================
var Imported = Imported || {} ;
var BBS = BBS || {};
Imported.TrackShopping = 1;
BBS.TrackShopping = BBS.TrackShopping || {};

(function() {

       //=============================================================================
    // Parameter Variables
    //=============================================================================
    var parameters = PluginManager.parameters('BBS_TrackShopping');
    var pBuyGameVarIndex          = Number(parameters['Buying Tracking Game Variable'] || '-1');
    var pSellGameVarIndex          = Number(parameters['Selling Tracking Game Variable'] || '-1');
   
    var BBS_TS_Scene_Shop_doBuy = Scene_Shop.prototype.doBuy;
    Scene_Shop.prototype.doBuy = function(number) {
        BBS_TS_Scene_Shop_doBuy.call(this, number);
               
        if (pBuyGameVarIndex > 0) {
            var changeInSpentGold = $gameVariables.value(pBuyGameVarIndex);
            changeInSpentGold = changeInSpentGold + (number * this.buyingPrice());
            $gameVariables.setValue(pBuyGameVarIndex, changeInSpentGold);
        }
    };
   
    var BBS_TS_Scene_Shop_doSell = Scene_Shop.prototype.doSell;
    Scene_Shop.prototype.doSell = function(number) {
        BBS_TS_Scene_Shop_doSell.call(this, number);
       
        if (pSellGameVarIndex > 0) {
            var changeInSoldGold = $gameVariables.value(pSellGameVarIndex);
            changeInSoldGold = changeInSoldGold + (number * this.sellingPrice());
            $gameVariables.setValue(pSellGameVarIndex, changeInSoldGold);
        }
    };

})(BBS.TrackShopping);
//=============================================================================
// End of File
//=============================================================================


Change Log


1.01
- Plugin finished.


Known Bugs / TODO
Suggestions, bug reports, and feature requests are welcomed!


Compatibility Issues
None known. Compatible with Klaus Map Overlays, Terrax Lighting System, and most (if not all) of Yanfly's plugins.


Credit and Thanks
- Micheal Morris @Blue Booth Studios
- So much credit to Tsukihime and all of those who have been supportive of my scripts and put up with my incessant barrage of questions.


Author's Notes
Free for non-commercial and commercial use.

Latest Threads

Latest Posts

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,469
Members
137,821
Latest member
Capterson
Top