Hello! i have a problem and i could not understand nor how to solve it.
if this is solved in another post i would like to take a look so i can remove mine.
Perhaps there’s no need to add a new component. Use the existing CAC and set a new shield class. This would destroy the existing shield actor and replace it with a new instance:
give this actor a CAC upfront (it can have no class assigned) and only assign a class when a Shield is picked up. Setting class to None would destroy existing shield; setting class to a Shield_Class would destroy the existing and spawn a brand new one:
That’s be the most straightforward and my fav providing I understood what is needed correctly. This way you do not need to instantiate / juggle new child actor components. Probably the best option unless you have 1000 spaceships, making a mobile game and need to worry about memory footprint.
We start with no CAC, when a Shield is picked up, we add a component; we reuse it when a new shield is picked up. The component can be, optionally, destroyed.
There’s more ways but everything else I can think of seems over-engineered.
Essentially, the ship / robot (? ?) already has a bunch of CACs, each dedicated to a relevant sybsystem:
We do not Add / Remove components at run-time, we replace the class of the relevant CAC instead.
i feel more lost to be honest. i like the first option but somehow it feels complicated like what dose give this actor a CAC upfront what is upfront mean? and how to connect/add this with the script i did? anyway i try to fiddle with it to see if i get it right.
And this character runs around and pick ups various equipment, right? Any reason why it cannot own the CACs?
Perhaps these could be CAC’s:
That’d simplify the whole thing dramatically. You wouldn’t need to attach / spawn new components.
Do note that we have no clue how you organised any of this beyond what you tell us. As in, no clue what the spawner are for… It seems quite modular in nature.
ok I’m not a programmer nor a coder I’m artist and designer, and i did all of that by watching tut and asking around plus copy & past some cods. do you have discord? i think it would be much easier for me to show you while streaming!
I’m not a programmer nor a coder I’m artist and designer
Way too late for that, you’re all of those things now.
If you do not want to juggle components spawned dynamically at run-time, perhaps the most straightforward solution would be to give the MetalHead empty slots for the shields:
When they pick it up, they can equip it by changing the class of the CAC. You will need to filter what is what, ofc. But seeing what else you’ve got, that should not be an issue. Inheritance in place already, nice.
yeah i think i need to do that, but take a look at this maybe it will clarify something:
if you noticed on the outliner when picking up more shields they actually stack inside each other for example if the shield takes damage and get destroyed the other shield will replaced it, i hope this make sense