Decks and drawing cards question

I have searched but no luck.

I have a deck that is placed on the map where it is not visible to the players. I want them to click a button that draws a card from that deck and places it at a visible location on the map. But, if any of the cards from that deck are already on the map it should return it to the deck, shuffle and then draw the card.

Are there any tutorials or other modules that show this sort of thing? I tried looking at a few modules but they had a lot of complexity with other parts of the game that I could not tell what was what. I can make the button appear but I am not sure how I tell it to check for existing cards outside of the deck, return them to the deck if there are, and then draw a card.

Thanks for any help!

This is possible but quite complex. Some of the complexity hinges on whether or not you want your draw deck to be “shuffle: always” in the settings. This means there is no maintained order of the cards in the deck, every draw action takes a random card from what’s there (i.e., not necessarily the top card as with this setting there is really no identifiable top card).

You’ll be using a pretty lengthy combination of Triggers, Return to Deck, Send to Location, and a Multi-Action Button to package it all into a one-click process. Complexity will go up again if “places it at a visible location on the map” translates to their being multiple possible landing spots for the drawn card.

I would suggest looking at some of the automated drawing and deck construction I did in the Pax Porfiriana module as a starting point, you can lift much of what you’ll need from there.

What you want to do has several parts, and I suggest you start by doing them piecemeal to make it easier for you.

First, I assume you know how to hide a deck because you didn’t ask.

Start by creating a toolbar button that discards all cards that are in the main window. Just do that for now. To do this, you will need to assign a marker (e.g. “card = 1”) and a discard trait to each card. Then make a map-level global key command to discard all cards, which you link to the toolbar button.

Then as a separate task, create a toolbar button that draws a random card from a deck on puts it on a specific spot on the main map. I suggest you make the deck always shuffle to avoid having to do it by command.

Once you have those pieces working, then you can tackle a button that combines both those features.

JoelCFC25 and shilinski, I appreciate the responses.

I think you are correct and I should do 1 piece at a time. After looking at the modules I really had no idea what was doing what and was leaning towards doing a step at a time.

I have hidden the deck by using negative values for the X and Y position of the deck. I also have Draw new cards face up? checked on and Re-shuffle is set to Always.

I will give this a try and hopefully I won’t have too many questions about it!

Again, thank you for the reply and help!

OK that was not so bad. All seems to be working. Now to see if I can figure out the one button does all. :slight_smile:

(Let me know if you cannot see the images.)

I made a Game Piece Prototype for the cards that includes Marker - cardType = BattleCard and
Return to Deck

and Send to Location traits:

And here are the Global Command Keys