The problem is this. I can’t see the
variables on the actor child anymore.
Am i setting this up correctly?
Adding it here as it was getting tight up there.
A little confused regarding what you’re trying to achieve now. Can you explain?
I can’t see the variables on the actor
child anymore.
The base actor class pulls data from a DT and holds onto the struct. It then pushes the data to the widget, right? You’re sending self reference to the widget I assume?
So you started creating child actors?
Maybe you never store the struct data you pull from the DT? I can’t see it in any of the pics. Also if you’re doing stuff in the Construction Script, a child will need to manually call its parent’s Construction Script (in the child right click the Construction Script node and Add Call To Parent Function).
I’ve been using numbers just to test. i got row names as well.
I would like to spawn 3 different copies of the actor when an action is called upon. Spawning 3 random cards every time.
I would like to spawn 3 different
copies of the actor when an action is
called upon. Spawning 3 random cards
every time.
The image I posted is a method to spawn cards. So it would sit outside of the card object - the SpawnActor node will create whatever you choose in the class dropdown. Spawning a card from inside of a card could create an infinite loop - not a good idea.
It’s up to you if you want to create a base or one of the children; and it’s up to you which blueprint will handle spawning of the cards. With a setup like this, you’re free to do it pretty much anywhere. Maybe wrap it in a function that takes an int (number of cards) and returns an array of cards. Place the function in the GameInstance and it becomes available from anywhere.
I do not know how your game is supposed to work. You probably have a main game loop and conditions that grant the player / opponent cards - these could call the abovementioned GameInstance function. Difficult to advise without knowing more about how you envisioned it.
The player can pick between 3 cards he brings to the next phase. The cards will have costs between 1 to 3 and the player has 3 Mana to spend on cards each round.
So i would like to spawn 3 cards at random for the player to drag and drop into his hand. then play them in the next phase.
I don’t understand, sorry. What do you mean by linked to DT. There’s nothing to link. DT is static. When you spawn an actor it just pull the relevant data from it.
If you’re creating something similar to Slay the Spire, I think there are combat rounds, right (I never played the game)? The beginning of a combat round should be the trigger that spawns X cards and / or removes the ones in hand.
Sorry, linked was the wrong word to use. I’ll try to be clearer.
I’m currently spawning my cards on a button press (later to be changed to spawn when entering the “combat” mode)
The card displays the information drawn from my DT. If i am to add functionality to the cards i need to spawn the correct Child Actor to the card. I’m wondering how i can do this.
the plan is to make every card a child actor and add the required actor components to the child.
And then the child, once it has executed parent’s Construction Script, can add its own components or override any functionality that the parent has - this is also a very common thing to do.
I’m now able to spawn the cards and the child actor. But it seams that the widget and the actor spawn does different things. My string for a certain card can pop up from the spawner, but nothing is displayed.
Right now i’m spawning the cards on a Key press from the level BP like this:
I think the problem is that when the cards is spawned it picks random cards from the DT. Then when a card is spawned it picks another random drom the DT in the card construction script. I need a way for them to pick the same card. This is what i think is happening.
So I need someway to send the row name from my spawner to the card? The spawner is in the level bp right now.
I’m using the name to feed information to the Widget.
And it works! I moved the card spawner to the game mode and did a cast from the card to get the same result! TY so much!
I still have questions about the drag and drop but ill create a new thread for that!