Skip to main content

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.

Hand of Cards in game

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.

HandOfCards folder inside the 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.

Add menu with Blueprint Class All On Board!

Search for BP_AOBHandOfCards and select it.

Searching for BP_AOBHandOfCards

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.

Register window for the Game Element Index Data Table

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.

Visual Card Template mesh and material settings

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

Slot box adjusted to the Visual Card Template size

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

Required Tag field in the Section Requirement Actor Tag section

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.

GameElementsIndexGeneral Data Table

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

HandOfCard register with Game Element Type AOBHandOfCards

Add a new row and name it HandAddonHolder.

New row named HandAddonHolder

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

Game Element Data Asset set to 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.

DeployTool Blueprint in the 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.

Edit Team Space Anchors in the DeployTool Blueprint

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

HandAddonHolder entered in the New Anchor field

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.

Anchor repositioned with Default Game Element Name set

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

Apply Elements and Apply Team Space Anchors buttons

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:

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.

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.

HandSetUp order under On Enter Orders

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.

Class Settings of the Deck Blueprint

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.

Searching for OrderListenerInterface

OrderListenerInterface added to the Blueprint

Next, open the Event Graph tab at the top, next to the transform tools.

Event Graph tab 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.

Register Order Listener after Switch Has Authority

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.

Event ExecuteOrder in the Event Graph

Get All Actors Of Class with the hands Blueprint class

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

For Each Loop connected to Out Actors

Now, add the SendCardsToHand function.

SendCardsToHand function added

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.

Hand Of Cards Actor input

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

Number Of Cards integer input

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.

Slot Component promoted to variable and PopElements call

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.

Supplier ID field of PopElements

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.

Supplier ID in the 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.

CreateGameElement with Split Struct Pin

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.

CreateGameElement connections with Get Actor Transform

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.

Add Actor To Slot connected to Create Game Element

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.

Get node for the function input

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.

Is Looking Upward connected to the Completed pin

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.

Set Locked and Set Hand of Cards Visibility nodes

Step 4 - Call the function​

For this step, return to the Blueprint's Event Graph.

Blueprint 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.

Send Cards To Hand connected in the Event Graph

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.

Class Settings of the Deck Blueprint

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.

Add button in the Actions section

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.

Action Class set to BP_000AOB_Action_DealCards

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.

Deal Cards Action Settings fields

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.

Supplier ID in the 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.

Quick Action option enabled