Can someone tell me what it don'y work?

I tried to do some of random spawn of random actors but it don’t work… There is no error report its just that the actors never spawn… I have 2 actors and 4 target points.

Thanks for answering

I am confused. You are spawning things that are already in the world. If they are already in the world (and they must be if they have a location or exist at all), then they dont need ro be spawned again do they? unless it js some kind of blob that grows more pieces of itself or something like that?

  1. What node did you connect these spawning node with?

  2. You are trying to get all actor of a class, get a random actor then get that actor class, then spawn another actor of same class? It seem like a roundabout way for me, why not just use a list of class and then random from that list?

  3. Try to use PrintString node to see if your code been call and other information from your code, like the result of random index,…

No no this BP take actors in the content browser. It worked with just one item but not with random items in an array like this

This BP is connected with the event beginPlay. I try to spawn a random actor on a random place with the targetpoint actor transform

You think it will work if i put all the actor in a hidden place in the world and duplicate them ?

Putting aside my suggestion number 2, have you tried PrintString node? And what blueprint did that even BeginPlay belong to?

I will try it this evening because i’m in classroom now and i’ll send a picture of the result. And the event BeginPlay is in my Level Blueprint

you are literally creating duplicates of actors that exist in the level. it really makes zero sense. if you want to get a random item from a list then you should create a variable make it an array and make its type actor class reference. this will give you a purple class pin like you need and eliminate the need to have the actors you want to spawn already have an instance in the level. you can then set the members of the array (items in the list) by setting the default value of the variable. there are other methods as well to set the value.

oh yea also length -1 is basically just the last index which there is a node for.

It is okay to do it by duplication but may increase the likelihood of confusion later.
If you really want to do it that way then you just need to change how you set the spawn Location. Don’t spawn them at their same location on top of themselves - spawn them at the location you want them to appear instead.

For the way your mind works, I think it would be easiest for you to place invisible actors in the level (like a playerstart or even something else) which have no collision, then in your blueprint where you spawn the new actors, put a GetActorsWithTag node and use the location of one of those in the array that comes out of it.

Then in your level you set the Tags on those invisible actors to be the ones youre using in the GetActorsWithTag blueprint node. This will make it so the new actors you spawn will be spawned at the same
location as those invisible markers, which basicaly makes them
act as spawn points in the level.

You will need to have a way for your blueprint to decide which Tags to find those marker actors with so that it chooses the right places to spawn the right actors.

Hmmm yes but i will try many issues and just take the best, when i will achieve it i will make a final answer on this topic and close it. Thanks for all :slight_smile:

Okay i will try this evening thank you. Maybe i will just hide under the landscape all the actor because i dont have a lot

i wouldnt as it detracts from your performance and there are much better ways to accomplish the task.