Setting Up A Card System (MV)

Heyo, everyone!

So, I've got myself a pretty interesting task today. Effectively, my goal is to set up some sort of card system, where a player can create a deck, have that deck shuffled, and draw a hand during battle from which a card can be selected for use as a skill. This has not surprisingly been very difficult, but I figured I'd come here to see if you guys could brainstorm with me to figure this out.

So I'll get the elephant in the room out of the way first: Irina's Card Game Core would probably make this process much easier, but for whatever reason it's completely up and vanished. Can't purchase it anywhere, and for obvious reasons I don't want to attain it by illegitimate means. Ignoring that, I've heard it's not perfect in some regards, and with my specific goal to set up this deck-skill system, I've figured there could be some other means to do this.

So, my next idea was to use a personal favourite of mine, Equip Battle Skills. Unfortunately, part of my idea here is that the cards would be usable by all party members (I'm even going as far as trying to make a "hand" global to the whole party), so EBS being actor-exclusive won't do us too much good without heavy adjustments. Even if I did reconstruct that plugin to suit our needs, we would still have to figure out that pesky randomness element. So, for now, that'll have to be a pass too.

So I'm thinking Item Core is the way to go. I've gotten REALLY, REALLY close to getting this to work, but sadly so far my efforts aren't fruitful. Here's what I've been trying so far:

-I've got an item type I'm referring to as "Slots". This is how many cards the party can set into their Deck, so it's gonna be a Non-Independent Item, and I've set it up as an upgrader.
-Each "Card" exists as both an item, and a skill. The idea is that once we have all the slots filled, we can run a Common Event at the start of each turn to shuffle any card that is tagged with some kind of "In-Deck" signifier, then after selecting five of them, it puts them into your hand and teaches that skill to the party. Unfortunately, this is basically where I've gotten stuck. For starters, making this "In-deck" tag isn't as easy as I expected. At first, I was thinking each card would be a Variable, so once you "upgraded" it into your Deck, it would increase that Variable by one, telling the game how many of each card is in the deck.

However, I'm having trouble getting these systems to work. For now, I'm just focused on making a deck - You can add a card to your deck, in a way that is easy for the player to see which cards are and aren't in their deck, and in a way that the shuffler can easily skim through which cards are equipped. However, just getting the Upgrade Slot part of my scheme to work hasn't been very fruitful yet. At first I was thinking that the Slot item would be used to upgrade the Card into a "Slotted" state, and then a "Slotted" card could be disassembled back into a non Slotted Card, and a Slot. Unfortunately, from the looks of it the disassembler only lets you select one of these items to get back, not both, so that's a little annoying. There doesn't seem to be any easy way for me to make it so you can only slot a certain number of each card this way either (say you have 45 copies of a card, but can only slot 4). Either way, the UI isn't looking too hot.

So, I'm a little curious if you guys have any ideas on how to proceed with this! If the Irina plugin is actually legally floating around somewhere I haven't checked, I'd appreciate if someone could point me there, too!
I would almost say a dedicated plugin just for that would be needed. (I'm not good with eventing and personally dislike complicated event command setups when I know I can code what I need. But I CAN code, so I'm biased. 😛)
I would almost say a dedicated plugin just for that would be needed. (I'm not good with eventing and personally dislike complicated event command setups when I know I can code what I need. But I CAN code, so I'm biased. 😛)
Yeah, I'd be in the same boat but this one sounds like a big enough undertaking that I'm not super confident I could handle it myself, and while I could probably afford to commission someone else to make the plugin, I'd rather avoid that if I can pull it off with the resources I've got.
Certainly understandable. To make at least part of it easier, you won't need a TON of variables, if you're confident on scripts. You could make cards that exist in the usable deck an array. In eventing, variables can't do arrays, but you can use JS to MAKE it hold arrays. You'd need more JS to interact with that array, but then you wouldn't need a variable for each card or whatever. Could do the same with cards currently in the hand as well.
I heard that Irina's card game plugin was cancelled because it was SUPER buggy and the author didn't support people who asked her for help to fix the bugs.
I heard that Irina's card game plugin was cancelled because it was SUPER buggy and the author didn't support people who asked her for help to fix the bugs.
Yeah, that seems to be along the lines of what I was getting from my searches. That said, I've yet to find an alternative that isn't defunct. It sounds like this will be a tricky task, but luckily I don't really need all the features the plugins I've been skimming through are asking for.



Taking the Array advice, I'm working out how to approach this now. I am can definitely set up a "draw 5 random items from this array, then give SkillID to the party", but getting those *into* the array is gonna be tricky. I think I'll start updating this thread as I progress.


-Update 1: So, I'm not at my desk to test this, but I'm thinking I'll stick to the Upgrade strat for now and have an Eval that adds this.item to a MaxCards array. Then, in a Battle Start common event, I'll make a CurrentCards array that equals MaxCards. This way, I can shuffle CurrentCards and subtract cards after using them to make it more deck-like. I'll let you guys know if this works later tonight.

-Update 2: Making progress, I think. I've set up the Slot item to have this upgrade effect:
Code:
let maxCards = $gameVariables.value(3);

maxCards.push(item.baseItemId);

$gameVariables.setValue(3, maxCards);
Now I'm having a bit of trouble *checking* if this is working as intended, but the console log isn't giving me errors so something must be happening.

Now for my next problem: right now, I've set it up so you have 30 slots, which means you can put 30 cards into your deck. The problem, however, is that I'm having trouble allowing you to take cards *out* of your deck. My first idea was to make a second Upgrade Item that removes the upgrade, but that causes problems. On one hand, if I make it so you can only use one Upgrade per card (so you can only add it to your deck once), it prevents another upgrade from being used to remove it. But if I don't add this limitation, you can add as many of a single card as you want.

For now I'm trying to see if I can get Disassemblers to work instead. They seem to yield better results. If I make the Disassembler (dubbed "Remove") a consumable item, I can set it so that when I slot a card in, I gain a remove, and when I use the remove to disassemble the card, it gives me the card back, as well as another Slot. This way, t
he number of Removes plus the number of Slots will always total 30.

Now my next tricky part is going to be figuring out for sure if those arrays work. Remove also has its own code to remove the item from the array but I'm not 100% sure it's going to work:
Code:
let maxCards = $gameVariables.value(3);
if (maxCards.includes(targetItem.itemId)){
   if (maxCards[i] === targetItem.itemId){
     maxCards.splice(i, 1);
}
}

No console errors so far, but I definitely need to figure out exactly how to see all of the cards in the Array.

-Update 3: So from the looks of it, the Upgrade Effect notetag only takes one Eval at a time. Or maybe "Eval" only accounts for one line, but in that case it's pretty much impossible to define a variable and then do something with it.

I can get the console log to display the Array, so that's a start, but now we need to make it so when we add a card to the deck, all of this occurs:
Code:
<Upgrade Effect>

Text Color: 2

Reset Suffix

Eval: let maxCards = $gameVariables.value(3);

maxCards.push(item.itemId);

$gameVariables.setValue(3, maxCards);

Console.log(maxCards);

$gameParty.gainItem($dataItems[2], 1);

Maybe I'll just do a Common Event...

-Update 4: Change of plans! I'm using Equip Actor Items since it seems to have a perfect setup for creating separate arrays for items in the inventory and items outside the inventory. There are a couple setbacks but I'm working out the kinks now. So far, so good!
1621537729796.png
Hey I was wondering if you made any progress on this?
Hey I was wondering if you made any progress on this?
So, this was a bit of a pet project that I had to put aside for my main project, so I'm not actively working on it. That said, I did get some further progress that I don't recall posting here.

For starters, for my pre-battle common event, I created an array that is equal to your current deck. This way, the "duplicate" deck is what draws and loses cards and whatnot. From there, I believe I created a "shuffle" mechanic by pulling a random number equal to the size of the array, then removing the drawn card from the array and adding its adjacent skill to the character at hand. Admittedly, after abandoning this project my computer exploded and I lost most of it, but fair warning that my method was extremely JavaScript heavy so if you try to emulate it, there'll be a lot of coding.

Original thread: https://forums.rpgmakerweb.com/threads/setting-up-a-card-system-mv.136675/