JK_DirectShop - Skip buy/sell window on purchase/sell only

● ARCHIVED · READ-ONLY
Started by Pirobi 29 posts Page 1 of 2 View original ↗
  1. JK_DirectShop v1.6
    Author: Pirobi and JK Software

    Introduction
    This simple script will, for shop commands where "PurchaseOnly" is checked, go directly to the buy screen. I decided to do this because it seemed redundant to have to still navigate that window if you aren't allowed to sell, and, if I recall correctly, it was like this in previous versions of RPG Maker.

    In addition, this script can allow users to have a "SellOnly" shop that works the same way. Plugin commands are used to simulate this(see the Plugin Commands section below).

    How to Use
    Please save the script below into "JK_DirectShop.js" and put it in your plugins folder.
    In the plugins window, place this plugin BELOW any other Shop Plugins.

    When you check "PurchaseOnly" in the editor for a shop command, the shop will become a BuyOnly shop. If it is checked when trying to do a SellOnly shop, nothing changes and it will still be a SellOnly shop. Use normal shop processing and uncheck "PurchaseOnly" to function as the default shop. You can also use the plugin commands for the same effect.

    Plugin Parameters
    Using Default Shop
    • Set to true if not using a custom shot plugin (such as Yanfly). This is very crude and may be updated in the future to be more flexible.
    Plugin Commands
    DirectBuy
    • This will make the NEXT shop command called a purchaseOnly shop.
    DirectSell
    • This will make the NEXT shop command called a sellOnly shop.

    If using the plugins, they must be called each time BEFORE the shop processing is called because the shop will "reset" after the processing ends.

    Script
    JK_DirectShop Plugin

    Compatibility
    This script will work with other shop plugins, as long as this plugin is placed BELOW any other shop plugins.


    Credit and Thanks
    - Pirobi and JK Software


    Release History
    -1.6:
    Hid unused command window from the shop scene. Added plugin parameter to determine how to draw shop scene windows.
    -1.5: PurchaseOnly checkbox in Shop Processing no longer matters DirectSell is called. Using proper aliasing to call shop for normal shop situations. As of 1.5, this should definitely be compatible with other shop systems as a plug and play!

    -1.4: So I don't really remember doing the 1.3 update....Anyway, minor fixes so that the plugin performs as expected.

    -1.3: Simplified the code to make it more compatible with other Shop plugins

    -1.2: Added functionality for a "SellOnly" option, which is missing from the default shop options(I'm 99% sure this was a thing in past makers). A plugin command is available to do that (I even added a command for the purchase only).

    -1.1: Moved the gold window to below the status window(the window on the right side), and moved the buy and status windows up to fill in the space left by removing the buy/sell window. As this rewrites the original Scene_Shop and related windows, it is NOT recommended to use this plugin in conjunction with other scripts that also modify the shop scene, due to unforeseen behavior.

    -1.0: Initial release
  2. This feels like it would be perfect for a vending machine
  3. Thanks for a great plugin!
    Do you want to make Direct Sell?
    I find it would be very useful for my game. ^_^
  4. AnnTenna said:
    Thanks for a great plugin!
    Do you want to make Direct Sell?
    I find it would be very useful for my game. ^_^

    Direct Sell would be a little harder to implement, but I can see what I can do. 
  5. Many thanks for the quick response!


    I am happy and I hope that it does not have much more difficult.  I tried to do it myself, I did not succeed. 
  6. AnnTenna said:
    Many thanks for the quick response!


    I am happy and I hope that it does not have much more difficult.  I tried to do it myself, I did not succeed. 



    Okay, so I did it haha. I will modify my original post, so please be sure to look at that for more details on the update. 


    Essentially, I added a plugin command to allow for Direct Sell (Since there's no box in the shop command for that)(I also added a command for DirectBuy for consistency). You will need to call this plugin every time you want to call the shop where you want to Sell only.


    If there are any issues that come up with using it, please let me know!
  7. Yes !!!!


    This is what I need! Thank you! I add this plugin to the game.


    Just have small problem: the plugin don't seem compatible with "No Item Categories"




    I don't know, if you can see it .... In any case, please take my big respect!


    PS 1% - Previously, it was similarly! 0_0
  8. AnnTenna said:
    Yes !!!!


    This is what I need! Thank you! I add this plugin to the game.


    Just have small problem: the plugin don't seem compatible with "No Item Categories"





    I don't know, if you can see it .... In any case, please take my big respect!


    PS 1% - Previously, it was similarly! 0_0



    It would be more difficult to make our scripts compatible, unfortunately, since we are overriding the same functions :(  
  9. Ok.  :)  I will not use No Item Categories, because JK_DirectShop more necessary for my game.
  10. My friend made a plugin that provides compatibility.
    View attachment DE79_DirectShopNoCategoriesComposer.js
     

    Spoiler
    //=============================================================================
    // DE79_DirectShopNoCategoriesComposer.js
    //=============================================================================

    /*:
    * @plugindesc fix compatibility between JK_DirectShop and NoItemCategories
    * @author DE79
    * *
    * @help This plugin does not provide plugin commands.
    * Version 1.0
    *
    */

    (function() {

    Scene_Shop.prototype.createCategoryWindow = function() {
    this._categoryWindow = new Window_ItemCategory();
    this._categoryWindow.setHelpWindow(this._helpWindow);
    this._categoryWindow.y = (this._sellOnly) ? this._helpWindow.y + this._helpWindow.height : this._dummyWindow.y;
    this._categoryWindow.hide();
    this._categoryWindow.deactivate();
    this._categoryWindow.setHandler('ok', this.onCategoryOk.bind(this));
    this._categoryWindow.setHandler('cancel', this.onCategoryCancel.bind(this));
    this.addWindow(this._categoryWindow);
    };

    Scene_Shop.prototype.createSellWindow = function() {
    var wy = (this._sellOnly) ? this._helpWindow.height : this._helpWindow.height + this._categoryWindow.height;
    var wh = (this._sellOnly) ? Graphics.boxHeight - wy - this._goldWindow.height : Graphics.boxHeight - wy;
    this._sellWindow = new Window_ShopSell(0, wy, Graphics.boxWidth, wh);
    this._sellWindow.setHelpWindow(this._helpWindow);
    this._sellWindow.hide();
    this._sellWindow.setHandler('ok', this.onSellOk.bind(this));
    if (this._sellOnly) {
    this._sellWindow.setHandler('cancel', this.popScene.bind(this));
    this._sellWindow.activate();
    this._sellWindow.select(0);
    } else {
    this._sellWindow.setHandler('cancel', this.onSellCancel.bind(this));
    this._sellWindow.select(0);
    }
    this.addWindow(this._sellWindow);
    };

    })();



    But I have another problem. In Firefox (only) bug when entering the store:


    fox.png
  11. @AnnTenna, at first glance, that error looks like it is in the core JS file, not in my plugin. Could you send me a picture of your debug console when the error occurs?
  12. I apologize for the delay. The error occurs only in browser. I don't understand what is required. Perhaps you would like to see this.


    oaa.png


    ss2jpg_3954648_20937807.jpg
  13. I would need to attempt to reproduce this, I'm not sure why it is happening.
  14. Hi! 


    This error occured when I clicked an unsellable Item (0 Gold), which - however - appeared in the sell windows (a sell only shop).

    Spoiler
    sell shop.png
  15. @Henryetha I have tried to reproduce your issue but it seems to work on my end...could you please send me a demo containing your issue?
  16. Do you know if this plugin will conflict with Yanfly's Shop Core?
  17. @queenchrom I do not believe so, since this plugin rewrites and sets some of the windows to fixed positions, but I could investigate more/find a way to make the two compatible.
  18. queenchrom said:
    Do you know if this plugin will conflict with Yanfly's Shop Core?



    I have updated the script to that it will (hopefully, only testing by users will find out for sure!) be compatible with any shop plugins. The only condition is that this script be listed AFTER the other shop plugin. For example, if you use Yanfly's Shop core, list that script BEFORE this one in the plugin list. And it should work :D
  19. @queenchrom With the new update, this plugin should no longer conflict with Yanfly's Shop plugin. All I did was make the buy/sell screen active when the shop is called, so that the shop itself can be created using anyone's plugins(so long as this plugin is placed below it).