Hand of cards
The Hand of Cards is a game element that allows players to store cards (or specific types of cards depending on each game) in their hand, keeping them available for use at any time during gameplay.

This guide explains how to create and configure HandOfCards using the All On Board! Mod Kit. The following is a list of things you can do with HandOfCards in All On Board!:
Create Hand of Cards
When you create your game using the Game Creation Wizard with the Hand of Cards feature enabled, a HandOfCards Blueprint will be automatically created in your game’s folder.
If you didn't enable this feature during setup but want to add a hand of cards to your game, follow this guide.
Step 1 - Create the Blueprint
Create a folder named HandOfCards inside your game’s Elements folder.

After that, right-click in the HandOfCards folder to open the Add menu, then select Blueprint Class (All On Board!) to create the Blueprint.

Search for BP_AOBHandOfCards and select it.

Next, a window will automatically open to register your new Hand Of Cards in the Game Element Index Data Table. This table contains a list of all the objects that will be used in your game.
Then, enter the name you want your Hand Of Cards to have in the table and click Register.

Step 2 - Configure the HandOfCards Blueprint
In this second step, open the new Blueprint and select the Visual Card Template. Here, you can set the mesh used for your cards and the material displayed when the hand is empty.
At All On Board!, we usually use the MI_EmptyHandCardsOutline_Plus material for this purpose.

Then, adjust the slot's box to match the size of the Visual Card Template.

If your game only uses cards, you can skip this step and move on to the next one. Otherwise, select the Slot Component and locate the Section Requirement Actor Tag section. In the Required Tag field, replace HandCard with the tag assigned to your cards.
If your cards don't have a tag yet, or you don't remember which tag they use, follow this guide:
Prepare a Game Element to Be Slotted

Step 3 - Open the GameElementsIndexGeneral Data Table
For this step open the GameElementsIndexGeneral Data Table of our game. if your Game ID is "Example", the Data Table will be named DT_Example_GameElementIndexGeneral.

Select the HandOfCard register, and in the Game Element Type write AOBHandOfCards.

Add a new row and name it HandAddonHolder.

In the Game Element Type field, enter. In the Game Element Data Asset field, select GEDA_000AOB_HandAddon.

Step 4 - Add the hand to the TeamSpaces
In this step, open your DeployTool Blueprint, which you can find in your game’s Deploy folder.

Select one of the PlayerTeamSpace components in the Components panel, then click Edit Team Space Anchors.
The following image shows a DeployTool Blueprint from a game configured for a single player, so your DeployTool Blueprint may look different.

Now, enter HandAddonHolder in the New Anchor field, then click Add Anchor.

Next, select the new anchor and reposition it where you want players to hold their cards. Then, select HandAddonHolder, which you created in the previous step, from the Default Game Element Name field.

Once you're happy with its position, click Apply Elements first, followed by Apply Team Space Anchors, to save your changes.

Finally, your game will have Hands of Cards ready to use!
Start the Game with Cards in Hand
To do this guide you need a deck and hand of cards, if you dont have them yet you can create here:
- Create Hand of Cards
- Create a Deck
TODO (from Notion): link pending — "link create deck with the new deck editor".
Step 1 - Create an order
First, create an order that the Game Sequence System will execute at the beginning of the game.
Open your game's Game Sequence Data Asset in the game folder.

Next, expand Game Sequence and Playing. Under On Enter Orders, add a new entry and enter the name of your order. In this example, the order is called “HandSetUp”.
Remember to save your changes.

Step 2 - Create the SendCardsToHands Function
Open your deck's Blueprint. If you created your deck using the DECK CREATION WIZARD, you will have two deck Blueprints: Deck Base and Deck. Open the Deck Blueprint and select Class Settings. At the bottom of the panel, add the required interface.
TODO (from Notion): link to the new editor deck pending.

Next, search for OrderListenerInterface and select it. This interface allows your Blueprint to receive the order you created. Remember to click Compile to apply the changes.

Next, open the Event Graph tab at the top, next to the transform tools.
After Parent: Begin Play, add a Switch Has Authority node and register the order you created in your Blueprint. To do this, you first need to get the Order Dispatch Subsystem node, which allows you to access the Register Order Listener function. This function registers your Blueprint as a listener for the order you created.

Then, right-click on an empty space in the Event Graph and search for the Event ExecuteOrder event. Once you have added the event, add a Get All Actors Of Class node and select the Blueprint class used for your game's hands in the Actor Class field. This way, whenever the order is received, the Blueprint will search for all available hands in the game.
If the Event ExecuteOrder event does not appear, it means you have not added the OrderListenerInterface to your Blueprint yet. Follow this part of the guide.


Drag a wire from the Out Actors pin and search for the For Each Loop node.

Now, add the SendCardsToHand function.

Step 3 - Create the logic of Send Cards To Hand
First, to create the logic for the SendCardsToHand function, add an input of type Hand Of Cards Actor.

After that, create another input of type Integer and name it Number Of Cards.

Get the Slot Component from the Hand Of Cards Actor input and store it in a variable. To do this, drag a wire from the output pin and select Promote to Variable. Then, use the Get Subsystem node to get the CroupierSubsystem and call the PopElements function.

In the Supplier ID field, enter the Supplier ID assigned to your deck. When you create a deck using the Deck Creation Wizard, a Supplier ID is automatically assigned to it. For example, if you named your deck ExampleDeck, its Supplier ID will be ExampleDeck_Key.

If you have trouble finding your Supplier ID or don't remember your deck's name, you can find it in your game's GameElementIndexGeneral Data Table.

Next, add a For Each Loop and use the AOBFactorySubsystem to call the CreateGameElement function. Right-click on the Config input pin and select Split Struct Pin to expose the individual fields of the struct.

Once you've done this, the node will look different. Connect the Array Element output of the For Each Loop to the Item Array input. Enable both Use Transform and World Transform. Finally, create a Get Actor Transform node and connect its output to the Config Transform input.
This setup creates a Game Element for each card name returned by the PopElements function.

Afterwards, get the Slot Component variable again and add the Add Actor To Slot node. Connect the Return Value output of the Create Game Element node to the Adding Data Added Actor input. This will ensure that, once the cards are created, they are added to the hand's Slot Component.

Right-click on an empty space in the graph and search for the name you gave to the function input. A Get node for that input should appear. Select it to retrieve the input value.

After dragging the Hand of Cards input into the graph as a Get node, add the Is Looking Upward function and connect it to the Completed pin of the For Each Loop.

After that, add the Set Locked node using a Get node for the Slot Component variable, and the Set Hand of Cards Visibility node using a Get node for the function's input.
Finally, connect the Return Value of the Is Looking Upwards function to the Visibility input of Set Hand of Cards Visibility. Also, connect it to Set Locked, placing a Not Boolean node in between.
This will ensure that, after the cards are added, the hand of cards is shown or hidden depending on whether the hand is open, while the hand's card slot is locked or unlocked accordingly.

Step 4 - Call the function
For this step, return to the Blueprint's Event Graph.

Finally, add the Send Cards To Hand function. Connect the Array Element output of the For Each Loop to the Hand Of Cards input, and set the desired number of cards to spawn in the hand using the Number of Cards field.

Deal Cards from the Deck
This guide will show you how to create an Action in your deck that allows all players to draw a specific number of cards simultaneously.
Step 1 - Open your Deck Blueprint
Open your deck's Blueprint. If you created your deck using the DECK CREATION WIZARD, you will have two deck Blueprints: Deck Base and Deck. Open the Deck Blueprint and select Class Settings. At the bottom of the panel, add the required interface.
TODO (from Notion): link to the new editor deck pending.
Step 2 - Add the Deal Cards Action
Select the Actions Component in the Components panel. Then, in the Details panel on the right, expand the AOB and Actions sections. Click Add to create a new Action.

Next, change the Action Name field to the name you want to give your Action. For example, you can name it Deal Cards. Then, in the Action Class field, search for BP_000AOB_Action_DealCards and select it.

Then, expand the Action Class field and the Settings. Here you can find the following fields:
- Cards Per Player: Number of Cards you want per player
- Deal Entire Deck: Check this box if you want all the cards in the deck se repartan hasta que no queden cartas en el deck
- Supplier ID: Enter the Supplier ID assigned to your deck. When you create a deck using the Deck Creation Wizard, a Supplier ID is automatically assigned to it. For example, if you named your deck ExampleDeck, its Supplier ID will be
ExampleDeck_Key.

If you have trouble finding your Supplier ID or don't remember your deck's name, you can find it in your game's GameElementIndexGeneral Data Table.

Finally, you can enable the Quick Action option if you want this Action to be triggered when you press the Quick Action button.
