User Tools

Site Tools


plugin-card-shop

This plugin adds a Card Shop scene, a new menu for purchasing and selling cards. The Card Shop can be opened through the following:

  1. On a Map Event or Common Event, use Comments to add notetags to specify the contents of the shop, and whether the player can Buy, Sell, or Remove cards.
  2. In that same event or common event, call the script:
    this.cardShopProcessing();

Only one shop preset can be made per Event, but until the shop is reset its stock will carry over between sessions. This means if the player buys its entire stock, when the player returns to the shop it will stay empty.

Card Shop Plugin is available on itch.io.

Buy, Sell, and Remove

With each Card Shop, you can specify whether the player can buy cards, sell cards and/or remove cards.

Buy The player can add cards to their actors' library based on the inventory you specify through Event Comment tags (outlined below)
Sell The player can remove cards from their library in exchange for half of the card's purchasing cost.
Remove The player can remove cards from their library, but instead of receiving money, they must spend it based on an algorithm in the Remove Price plugin parameter.

Price Formula

Price formulas work like damage formulas, except they determine how much a card costs to buy or remove, or how much it gives the player on selling. Price formulas have several variables you can use:

cardPrice - the original price of a card set in Skill notetags
bought - the total cards bought at that shop
sold - the total cards sold at that shop
removed - the total cards removed at that shop
adjustedCardPrice - a variable just for the Buy formula, this is the price of a card specific to this shop.

Example 1:

Remove price cardPrice + 10 * removed

If a card costs 40 to purchase, it will cost 40 to remove if the player has not removed any cards at this shop, and every time they do the price will increase by 10.

Example 2:

Buy price adjustedCardPrice * 2

This creates a shop where all cards cost double, and in addition some cards have a custom price which is *also* doubled.

Example 3:

Sell price Math.floor(cardPrice * 0.3)

This creates a shop where all cards sold will get you roughly 30% of their value back in gold. This is not impacted by adjustments.

Parameters

Default Card Price The default price of cards in the shop. Can be overridden with notetags.
Buy Price Formula The formula to determine the price of buying a card. See help section for details.
Sell Price Formula The formula to determine the price of selling a card. See help section for details.
Remove Price Formula The formula to determine the price of removing a card. See help section for details.

Preview Card X The X coordinate of the preview card in the Card Shop scene.
Preview Card Y The Y coordinate of the preview card in the Card Shop scene.
Preview Card Scale The scale of the preview card in the Card Shop scene.
Window Card Scale The scale of the cards in the windows in the Card Shop scene.
Selected Card Scale The scale of the card in the windows in the Card Shop scene that is currently being inspected.
Card List Window Width The width in pixels of the Card List Window
Confirm Window Width The width in pixels of the Confirm Window

Front Sprite The sprite used for the scrollbar. The middle third of its height scales to change the bar's size.
Back Sprite The sprite used for the bit behind the scrollbar.
Scroll Bar X The amount of pixels to the right of a scrolling window the scroll bar will appear.
Scroll Bar Y The amount of pixels the top is lowered by and the bottom is raised by to keep within the window.

Use Alt UI? If set to ON, the Help Window will appear underneath the Card Preview, giving more height to the Card List.
Help Window Rows Set the amount of rows of text that the Help Window can fit
Short Actor Window? If set to ON, less information will show on the Actor Window.

Notetags

Notetag Syntax Database Usage Description
<Card Price: X>
Skill This will set the price of that skill's Card to X. You can use \v[x] to substitute the price with a Game Variable.
<card shop>
  3x Skill Y
  5x Skill Z
</card shop>
<card shop>
  5x skillName
  3x skillName
  1x skillName
</card shop>
Event Before you can open the Card Shop scene, you need to specify the contents of the shop in Comments. You can space out the info across multiple Comments in the event page.

In between the opening and closing notetags, you can use the following syntax to populate the card shop. [N]x refers to how many copies of those Cards you want in the Shop.
<card shop>
Skill Y Price Z
skillName Price Z
3x Skill Y Price Z
5x skillName Y Price Z
</card shop>
Event If you want a card that has a different price from the default, this format will let you label specific items in the shop at a custom price
<card shop>
Command: buy
Command: buy, sell, remove, cancel
</card shop>
Event This determines which commands will be present in the scene. If only one is present, the Command Window will be invisible and more space will be given to the Card Selection Window.

Script Calls

Script Call Syntax Description
this.cardShopProcessing();
As long as a Card Shop has been set up through the above Event Comment tags, this will open up the Card Shop scene and take you to the shop belonging to the same event calling this function.
this.resetCardShopInventory();
this.resetCardShopInventory(eventId);
This will reset the Card Shop of the specified event ID (or use the current event if no ID is specified).

This means that it will restock to its original inventory and its Remove costs will be reset.

Commands

Command Syntax Event Usage Description
OpenCardShop
Map Event Functions just as this.cardShopProcessing() to open Card Shop Scene in Event
ResetCardShop [ID]
Map Event Functions just as this.resetCardShopInventory() to restock shop's original nventory and reset its Remove costs. If [EventID] is not specified will default to resetting the shop for the current Event.

Version History

v 1.1.1 
- Added Plugin Params for default Buy and Sell Price Formulas
- Added Plugin Commands for Opening and Resetting Card Shop

v1.1.0 
- Fixed touch input bug in MV that would prevent selection
- Fixed cost text being in the wrong place for the preview card if opening a card shop for the first time before loading any other scenes with cards.
- Fixed crash when calling common events in certain ways.
- Fixed "ghost cards" if the user supplies cards that are hidden from the library.
- Added extra feedback when using deck editor. Now if you try to sell/remove cards when all cards are in use, the help window tells you so.
- Command Window now has room for 4 items
- Dummy Window is now the same dimensions as the Buy Window.
- Added compatibility with YEP_ShopMenuCore          
- Custom prices can now accept formulas, and make use of the  cardPrice variable. You can even combine game variables.
- Added scrollbar
- Introduced an alternate UI design which shrinks the help window and expands the card list window.          
- Added tags allowing you to custom price a custom amount of cards
- Added tags allowing you to specify custom price formulas for buying, selling and removing (overriding default values).

v1.0.0 - Released plugin
plugin-card-shop.txt · Last modified: 2024/03/22 14:35 by banerjeesw