Shop Tracking v1.01

bluebooth

Veteran
Veteran
Joined
Nov 12, 2015
Messages
95
Reaction score
115
First Language
English
Primarily Uses
N/A
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.
 

Attachments

Zack Phoenix

Artist
Veteran
Joined
Jun 12, 2013
Messages
185
Reaction score
23
First Language
German
Primarily Uses
RMMV
That's a nice plugin, there are tons of cool uses for that!
 

Neo Soul Gamer

Veteran
Veteran
Joined
Aug 10, 2012
Messages
632
Reaction score
350
First Language
English
Primarily Uses
N/A
This is a great utility for a shop-based side quest. Thank you!
 

Solis

Veteran
Veteran
Joined
Oct 24, 2015
Messages
376
Reaction score
84
First Language
English
Can change shop based on this too maybe! With switches!
 

moldy

Veteran
Veteran
Joined
Nov 15, 2015
Messages
193
Reaction score
29
First Language
English
Primarily Uses
Interesting. So this would allow us to lower shop prices on a customer loyalty program?
 

bluebooth

Veteran
Veteran
Joined
Nov 12, 2015
Messages
95
Reaction score
115
First Language
English
Primarily Uses
N/A
Can change shop based on this too maybe! With switches!
That should be doable, yeah!

Interesting. So this would allow us to lower shop prices on a customer loyalty program?
The current implementation is basic, and simply tracks all purchases and sales. If you wanted to lower prices in specific stores, a plugin extension may be necessary. If you want to use a universal customer loyalty program, then you could easily do that! :)
 

Vendon

LVL 255
Veteran
Joined
Oct 27, 2015
Messages
103
Reaction score
22
First Language
German, English
Primarily Uses
Hello. I have put this plugin below Yanfly Shop Core Plugin but when purchasing an item no matter how many of them, it shows me 12 in the variables and the number does not change. Same happens with selling but instead of 12 it shows me 13. Changing the postion of the plugin ends up in numbers stays at 0
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Managed to find a way to hang a bed cover over my window. So no more being toasted alive in the afternoon!:kaoswt2:
So, uh, has anyone tried buying any resources from KokoroReflections? Because I've been looking for a 'buy' button on the site for like 10 minutes now and can't find one.
Any also thought it's too cringy to put the word "and you" in your credit as a special thanks?
Cause that's what I thought...
Everyone in the US right now: Please stay safe.
Symphony Celestia: Prophecy of the Falling Stars RPG Maker music pack WIP. Symphony Celestia is a new series that focuses on symphonic and orchestrated music to tell a story. Each story will include compositions that make up that story from beginning to end. Themes include: Battles, adventures, character themes, etc. Below is a video preview to the first story.

Forum statistics

Threads
97,979
Messages
948,310
Members
129,242
Latest member
Kelevra069
Top