Table of Contents
This plugin adds a Card Shop scene, a new menu for purchasing and selling cards. The Card Shop can be opened through the following:
- 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.
- 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:
buyPrice - the original Buy Price of a card set through Skill notetags. sellPrice - the original Sell Price of a card set through Skill notetags. removePrice - the original Remove Price of a card set through 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 removePrice + 10 * removed
If a card costs 40 to remove by default, 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(buyPrice * 0.3)
This creates a shop where all cards sold will get you roughly 30% of their buy 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. |
Free Card Text | The text to display for a card that costs 0 Gold. |
Card Shop Scene
Preview Coordinates | The coordinates of the preview card in the Card Shop scene. |
Preview Card Scale | The scale of the preview card in the Card Shop scene. |
Preview Cost Coordinates | The offset coordinates for the Cost text for the preview card. |
Max Visible Rows | A number used to calculate what row the player currently has selected before scrolling down. If the game scrolls down too early, try raising this value; and it if scrolls too late, try lowering it. |
Card Placement Settings | A struct containing several parameters to determine how cards will fit inside their windows. |
Card Placement Settings | |
---|---|
Max Columns | The number of cards a row before cards move to the next row in the window. |
Card Scale | The scale of the cards in the windows in the Deck Editor scene. |
Selected Card Scale | The scale of the card in the windows in the Deck Editor scene that is currently being inspected. |
Starting Padding | The padding between the left/top of the Window and the top-left-most card. |
Card Spacing | The spacing between cards. |
Amount Text Offset | The coordinate offset values for the Amount text. They default to underneath the center of the cards. |
Amount Text Justify | Whether the amount text of a card will be centered, aligned left, or right. |
Card List Window Width | The width in pixels of the Card List Window |
Confirm Window Width | The width in pixels of the Confirm Window |
Gold Window Width | The width in pixels of the Confirm Window |
Hide Actor Window? | If this is false, the Actor Window will appear to the side of the inventory window. If the Actor Window is hidden, it will instead appear in place of the inventory window when the user is prompted to select an actor to give a card to. This prompt occurs when buying a card while having multiple party members. |
Actor Window Width | The width of the Actor Window, if Hide Actor Window is set to false. |
Short Actor Window? | If this is true, the Actor Window will display less information. Useful if the window is thin. |
Move Help Window | If this is false, the Help Window will take up the entire bottom of the screen. If this is true, the Help Window will instead only be underneath the Card Preview, giving more height to the Card List. |
Help Window Rows | Sets the amount of rows of text that the Help Window can fit. 0 will hide the Help Window entirely. |
Scrollbar Settings
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. |
Background Image | A background image can be added to the scene. |
Card Pack settings
Card Pack Presets | A list of Card Packs you can add to the shop. Each Preset has the below parameters. |
---|---|
Name | The name that will display for the card pack. |
Description | The text that will fill the Help Window when highlighting this card pack. |
Amount of Cards in Pack | The amount of cards any copy of this pack can contain. |
Card Pool | The list cards that could appear in any copy of this pack. Each item in this list has two parameters: Skill is the Skill ID of the Card in the pool. Weight is the value that determines the probability of this Card to be picked from the pool. Higher Weight means that a Card is more likely to appear. |
Give Whole Pack to Actor? | If true, when you buy a Card Pack all cards will go to the actor you select. When false, each card can go to a different actor individually. |
Notetags
Notetag Syntax | Database Usage | Description |
---|---|---|
<Card Price: X> <Card Buy Price> | 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 Sell Price> | Skill | This will set the sell price of that skill's Card to X. You can use \v[x] to substitute the price with a Game Variable. |
<Card Remove Price> | Skill | This will set the removal price of that skill's Card to X. You can use \v[x] to substitute the price with a Game Variable. |
<Shop Image: fileName> | Skill | This will cause that skill's Card to appear using the specified image in the Card Shop. Images should be placed in img/CGC/shop. |
<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> Pack Preset Y 3x Pack Preset Y </card shop> | Event | You can add Card Packs that have been set up through the Card Pack Preset parameters. |
<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. |
<card shop> Buy Price priceFormula Sell Price priceFormula Remove price priceFormula </card shop> | Event | These override the default formulas used to determine how much a card is worth when buying, selling or removing. The default formulas are set through plugin parameters. |
<card shop> Buy Limit X Sell Limit X Remove Limit X </card shop> | Event | These determine how many cards can be bought, sold, or removed respectively before the option to buy/sell/remove is disabled. |
Lastly, this plugin has tools to allow you to randomize values within these comments, like so:
1x Skill [1-4]
Replacing a number with [min-max] will make the shop determine a random number between the minimum and the maximum (inclusive). So in the above example Skill 1, Skill 2, Skill 3, or Skill 4 may appear.
You can also put this at the beginning of the notetag, like so:
[1-3]x Skill 4
This will cause the Shop to stock between 1 and 3 copies of Skill 4.
Additionally, you can also use the following:
1x Skill [5, 7, 9]
Replacing a number with [x, y, z, etc] will make the shop choose from the list of numbers inside the brackets. So in the above example Skill 5, Skill 7, or skill 9 may appear.
This works anywhere in the comments to determine the shop inventory. This means you can do this:
<card shop> [3-4]x Skill [7, 8, 9, 11, 13, 15] [1-2]x Pack Preset [1-3] [1-2]x Pack Preset [1-3] [1-2]x Pack Preset [1-3] Buy Price buyPrice * [1-2] </card shop>
Note that these randomization methods will only produce whole numbers. Also note that any random numbers will retain their values when a shop's inventory is reset through script calls or plugin commands.
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
v1.2.0 - Updated for compatibility with CoreEngine v1.6.2. - Complete overhaul of Card Shop Scene as a product of the Library overhaul. - Lots of UI improvements. More UI parameters. - Fixed bug where buy formula would reset to default after backing out and reentering shop. - Fixed bug where bought and sold variables would reset between shop instances. - Fixed default sell formula not working. - Added parameter to change what displays when a card is free. - Added Card Packs to the shop. - Added custom Sell and Remove prices to Card Notetags. - Added custom Image notetags for Cards when displaying in the Shop. - Added Buy Limit, Sell Limit, and Remove Limit options in a <card shop> settings tag. - Added randomization options in <card shop> settings tags. - Added compatibility with YEP_X_MoreCurrencies. 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