Yeah that makes sense, got slightly used to using only object reference as that was what I only needed so far, I forgot about class reference.
With that additional question, let me illustrate it to you.
I’m operating on the 3D tile-based space and if a player actor is next to an enemy actor and vice versa it can initiate combat, with possible up to 5 fighters (1 Player and 4 Enemies, one from each side of the player)
For combat, player uses Dice and Equipment, both are User Widgets.
Equipment requires dice to make an effect, applying the rolled value to assigned slot, similar to Dicey Dungeons.
In example above in Dicey Dungeons, if the player puts a dice with rolled Value 2 into the slot, the text changes to “Do 2 damage” and activates dealing enemy 2 damage.
In Dicey Dungeons it is implemented fairly easily, as the space is 2D and there are only 2 combatants, player and enemy.
Similiar to Dicey Dungeons, during combat on player’s turn, there is a HUD with all available equipment and rolled dice this turn. Where in this game, both Equipment and Dice are Widgets user can interact with.
(Screenshot from combat in Dicey Dungeons)
Now lets get an example of an Equipment from my game.
(Image is from a physical prototype)
In this equipment, player has one slot for a dice in this equipment. If they insert a dice by drag&drop method then in sequence as planned:
First: Widget of the dice slot checks if Dice is legal choice (For example, if the slot requires value of 6 or more, if player will insert a dice with rolled 4, the dice will be returned)
Secondly: After insertion of the dice, item description changes to reflect new value. (For example, if in this card there would be inserted a dice with rolled value 10, the text changes from “Deal [Any] damage to an enemy in front of you.” to “Deal 10 damage to an enemy in front of you.”)
Thirdly: Widget checks if all dice slots are filled, example above needs only one dice. If yes, widget should launch a function that in this case, gets information what actor is in front of the player actor and then in this example Deal 10 damage to them.
After completing the function, equipment widget disables itself until next turn unless stated otherwise.
And this is the part where I need a suggestion.
widget should launch a function that in this case, gets information what actor is in front of the player actor and then in this example Deal 10 damage to them.
So far the Equipment Widget is made of 3 main parts.
The template, which is on Construct modified by the struct loaded from DataTable,
which includes:
And second part of the equipment is widget Description&Slots, containing the dynamic text description of what the equipment does and including the dice slots widgets for inserting dices in combat.
This part needs to be done manually to work properly, because each equipment will have different effect and may require different dices/rolled values.
Because of that the plan was to make it manually for each equipment and assign it to the DataTable, so the real Equipment Widget will add it to itself as a child on Construct in Vertical Box inside DescriptionScaleBox, replacing [ItemDescription] Text.
For that was the first part of the post and with that thanks for help.
Now the third part is, the function that is supposed to interact with actors by doing the effects of the equipment, as stated here:
Thirdly: Widget checks if all dice slots are filled, example above needs only one dice. If yes, widget should launch a function that in this case, gets information what actor is in front of the player actor and then in this example Deal 10 damage to them.
What is the best way to make such an interaction between User Widget and target Actor?
Should it be a specific different object/blueprint? Or could I somehow implement it as a function in the “Description&Slots” User Widget?