Hello friends.
I have a question like in title. I have an actor. This actor is present in different numbers on each map. I want these actors to occur randomly in one of the places I have determined on the map. For example, I have 2 actors in the 1st map and there are 6 areas that I have determined. These 2 actors will be randomly formed in one of the 6 areas and they will not be able to occur simultaneously in the same area. So a field can only host one actor. how can I do that? I hope there is an instructional video about it. Thank you and have a nice day.
Make an actor blueprint, call it TargetLocation. In contains no code, just a variable
Put some of these blueprints in your level and set the spawn radius ( you can make the default 250, for instance ).
Make an actor blueprint, call it PlaceActors. It has the variables:
Locations = An array of TargetLocation blueprints ( from above ), just declare it, nothing to set.
ActorsToSpawn = The number you want to spawn
Mesh to spawn = The mesh you want to spawn ( we can change this if you want to spawn a blueprint ).
The code is like this:
Place it in the level, and set the mesh and number you want to spawn
Press play
2 Likes
Oh one more question I have, so how can I get it detected if the character hits any of these? I hope you know about this. This is how I normally use it. so when the character hits this actor, the actor destroy.
If the character hits the spawned things?
Best way would be to place blueprints instead of static meshes.
The procedure is exactly the same, but instead of spawning a mesh and setting it, you spawn a blueprint of your choice
1 Like
I will try, I hope I can do it. it looks a bit confusing because i’m very new to game making ^^
Just change this bit
to the name of your blueprint, and get rid of this bit:
1 Like