Projectile movement comp. in all instances.

So, I have a mesh actor bp with the projectile movement as a component, and I have 3 instances of it already placed in the level.
I´m basically trying to move with the p.m. component the 3 instances by setting the velocity variable from 0 to something at runtime…all good except only one instance moves, and the other 2 just stay there.

Is there anyway to get all instances in the level to move or do something by affecting a variable in the parent bp?
The reason I´m asking is because I later want to spawn and destroy the same mesh actor instances at runtime, and I´ve already tried an array variable with "get all actors of class"node and all that, but the array variable gets messed up after an instance is destroyed.

Please I need a little help, a fresh perspective could go a long way, and I´ve been stuck in the same problem for weeks!!

Thanks a lot!!

Not sure what p.m is but I think you should spawn the instance then add it to an array, its easy to manage them that way then you can remove the item from the array when it gets destroyed or use isValid to check if the instance can be accessible, if isValid is false that means the instance has been destroyed, you can then remove it from the array if you haven’t done that already.

Also since you have them already in the level you can select an instance in the level, then right click in the level blueprint and select add reference then you can change their velocity when a key is pressed or something similar.

Thanks for your answer!

p.m. meant projectile movement component, but I´ve change my approach…
I´ve been trying to move the objects in the level using an add “actor world offset” node tied to a timeline and an array populated with the results of “get all actors of class” node.
The thing is when I try to destroy the actors with a triggervolume and a “destroy actor” node, only the first one gets destroyed and the others get ignored. I´ve used the remove item from the array node before destroying the actor, but apparently this only returns an empty array, and…of course…I get the pending kill error message.

This is my setup: destroy actor in array posted by anonymous | blueprintUE | PasteBin For Unreal Engine

They should be destroyed once they leave the triggerbox regardless of the array, are they leaving it at the same time ? as far as the offset goes you should do it inside the actor itself instead of doing it for all of them in one place, just add a timer and trigger it in the event begin play withing the actor itself, this way you can customize each actor like changing the offset variable for each of them.

as for destroying I’d investigate the triggerbox not triggering for all of them start by printing a message whenever one of them leaves it just so you can make sure it does trigger for all of them.

Ok, just tried that. Somehow the strange behavior of the triggerbox and the destroy node is connected to the array variable. Whenever the array node or the get all actors or the for each loop node are connected, I get the “pending kill” error.
And like I said before, the triggerbox only destroys the first actor that goes trough. (btw, the actors leave the box one at a time)

Any thoughts?
Thanks!!

That´ll be great!! but how do I that? Do I just zip and upload the project folder in my pc, or is there a setting in ue4 to pack the whole project and send it?
Anyway, I think I´ve narrowed down the issue with a problem populating the array variable.

On begin play I have a “Get all actors of class” and then a set array node and then a print string showing how many actors are in the array. I detached the destroy node from the triggervolume, and instead I just plugged an get array length node and a print string with the amount of actors in the array.

All good so far, the actors move as intended, they overlap the trigger volume as wanted…but!..every time an actor overlaps, it prints 0 elements in the array.

So if I understand correctly Actor1 leaves the triggerbox so it gets destroyed, but Actor2 does not get destroyed when it leaves the box ? if that’s true then that shouldn’t happen based on the BP you showed me, if you can give a me a download link for the project or a similar one I’d be happy to look into it.

There’s an option File >> Package project >> Zip up project. Once done you can upload it to Mega or one drive or any website you want and post the link.
After you set the array do check the length immediately to see if you successfully found the actors which should explain the 0 length issue.