Hello,
I currently have 5 objects in my game, 2 of which i randomly want to be destroyed, keeping the remaining 3 as they were. I presume putting them in an array, shuffling them and then selecting the first 2 or 3 to be destroyed or kept alive a good way of doing it. (Might not be!)
I am very new to blueprinting and ue4, so if you could possibly show or explain an example blueprint that would be fantastic.
I presume putting them in an array,
shuffling them and then selecting the
first 2 or 3 to be destroyed or kept
alive a good way of doing it. (Might
not be!)
Aye, this sounds about right. For any number of actors:
This will remove 2. Do note that the size of the array does not change, it now contains 2 null references to actors that no longer exist - handle with care. It’s probably a good idea to check the array size before you attempt to remove an element that may be outside of array bounds. Alternatively, you can do it like so, which is a tad safer:
If you have only 5 objects that you’ve placed in the level, you can gather them manually by selecting them in the world and dragging them to the graph: