Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How can I use multiple Spawn Actor from Class?


I have a Spawn Actor from Class setup and it works great.

I can place one into the world and enemies will spawn at the rate which i have set, the issue is if I fill the world the enemies can spawn outside of the walls / gaps and therefore just fall forever until the game ends... This is an issue as I need a wave based spawning system so round one can spawn x amount of enemies of a certain type and round 2 can spawn more enemies...

When i try to place 2 Spawn Actor from Class in the world the enemies ONLY spawn from the first one and not the second one... I will attach my blueprint and other relevant screenshots.

I am new with unreal so any suggestions would help.



Product Version: UE 4.12
more ▼

asked Jul 28 '16 at 07:50 PM in Blueprint Scripting

avatar image

15 13 17 17

avatar image Tommow Jul 28 '16 at 08:00 PM

Please check the below screenshots. Sorry for the bad writing, i was using paint :) alt text

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Issue is very simple, you searching all spawner actors but oyu only gettign one with index 0 so only one works... not only that is binded to multiple functions in each EnemySpawner object.

You don't need reference of object of a blueprint you are in, if object pin is not connected it should default to "self" which is object you currently in. If not there is "Self" node that returns current object you are in. So remove whole "Get All Actors Of Class" part, if you get error you need to connect something to Object pin connect "Self" node

more ▼

answered Jul 28 '16 at 08:13 PM

avatar image

35.9k 929 169 1105

avatar image Tommow Jul 28 '16 at 08:19 PM

Thank you for the reply. I am new to unreal so I am very sorry but I do not understand what you mean. Could you simplify the answer for me please. Again thank you so much for the quick reply.

avatar image Shadowriver Jul 28 '16 at 09:11 PM

Other guys seems to give you example :p Are you aware that bluprints are classes? do you know what class is?

avatar image Tommow Jul 28 '16 at 09:23 PM

Not really :(

avatar image Shadowriver Jul 28 '16 at 11:18 PM

here is my video about basics of classes and object, blueprint is a class same as C++ class:


Problem with UE4 is that it shows classes as asset which is misleading way of showing them, they are hilarchy which oyu can see in Class Viewer. Class is just a "blueprint" of objects, a stamp for object, type of object and each object is a instance of that class and code in it is executed for each object you spawn

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

on your "Enemy Spawner" Event Beginplay -> get all enemy spawner -> get element 0 from array HERE IS THE ERROR you get all spawners with (Get all actors from class...) but then you tell to just use the element 0, everytime you use this function it is returning all Enemy Spawners, for coincidence (or not, i don't know how "get all actors from class" is implemented) the first element from the array is always the same, so the call to spawn enemy in another spawners never happens, to fix instead of all this code in "begin play" i would just use Event BeginPlay->Set Timer By Function Name and use "This" in the "Object" camp (so every spawner would call "spawn enemies" for itself)

edit:other guy answered first, his answer is right, very similar to what i told, i will still leave my answer just in case you think it's easier to understand

more ▼

answered Jul 28 '16 at 08:25 PM

avatar image

1.1k 31 17 65

avatar image Tommow Jul 28 '16 at 08:34 PM

Well it helped slightly but it still takes a lot to understand when you are new like me... Can I not adjust the BP to be able to use multiple spanners?

Could I use something such as a random int and int 1 spawns from spanner 1 and int 2 spawns from spanner 2 etc...

Or is that just over complicating things?

Again I appreciate all of this but I am struggling due to lack of experience :/

avatar image veccher Jul 28 '16 at 08:51 PM

sure, keep the rest of the code, but instead of your "event beginplay" put mine (like in the ss i'm sending) and try again new beginplay

answer.png (258.6 kB)
avatar image Tommow Jul 28 '16 at 09:04 PM

Thank you so so much. I deleted all of the nodes in between event play and set timer... I really appreciate the help. I am sorry that I have lack of experience, I am trying to learn everything from youtube and google and it is hard when you can not find the answers you are looking for. I guess you have done this for a long time. If you want to add me on any of the following it would be great (I will not spam you don't worry).

Skype name: tommow.major94 Steam: Tommow1994

Thank you so much :D

avatar image veccher Jul 28 '16 at 09:27 PM

As the other guy said, you should search about the concepts of classes and Object Oriented Programation, you can add me on steam, my Nick on steam is veccher

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question