Set variable with a cast to

Hi everybody.
Is there a way to set a variable in a blueprint with a “cast to” node the blueprint being also dynamic ?

On image attached, I spawn an actor BP (the only way I find to access to it, because actors are not present in the world).
With a spawn with a defined class, I can easyly set up its attached variables.
But I Don’t want a single class, I want to dynamically choose a class, according to a character’s name selected.

In this case, I succeed to spawn the correct BP (attempt done with a print node), but, as the spawn refer in the code to Nothing before run this part of the code, I can’t reach variable with a cast to node.

Is there exist a solution ?

Thanks

What’s the overal idea here? I think you may have ventured down a difficult path.

Ok, so your problem is that you need to get into parent and child classes.

If you have an overarching parent character / weapon / skill etc and derive child actors from that, you wouldn’t have this problem, because that code above would just be spawning all of the same kind of thing.

Have you things like:

or
They're a bit of an overview, I don't know of any real killer vids myself as I don't need subclassing much. But I do know that's where you need to go ;)

EDIT: better example:

You probably right ! My game idea turn into Something difficult…
My idea is a turn by turn game with many different characters.
To do that, I created widgets and datatables to select and choose characters to play with.
Each character has name, characteristics, weapons, rules… The player can choose between différents weapons for each characters.
What i try to do is pick the first charater, select his weapons, and store, then pick a second character, a third…
When all characters are selected we have create a kind of team to play with, and we can spawn then manually on the level.
So characters, datatables (names, caracteritics, weapons, rules), Characters BP, … must be variable, because we Don’t know what character and what weapon the player will choose, also the amount of characters…

If you have the weapons list in the data table, select weapon from there, save everything in a structure, then do the same for the second one? At the end for each struct Spawn the actor with the appropriate variables? Not sure I fully understand what you are trying to do, sorry if it doesn’t help!

Thanks a lot, every question you respond to me and every videos you share are Always instructives !
I need to Watch several times to understand right, and it helps me to progress about the engine ^^

I want to avoid structure in this case, because all progress I did so far (based on struct) lead me to set up variables ready to be send (but maybe I’m wrong).
If I fail with derive childs actor (response by ClockWorkOcean), I will try a structure solution, but for now, with this method, I Don’t see how to cast structure done in an variable actor.