ok so it sounds like you want to keep track of how many enemies have been killed then do something else(ie: spawn new wave, end level , show score) right?
if that is so then your best bet is to control that using a GAMEMODE blueprint to setup rules and then a gamestate bp to handle what happens.
The level blueprint could be used for a lot of things but mostly for level specific events like doors, lifts, keys and such.
Now the gamemode is more along the lines of Game Play such as how scoring works, number of players, who can kill who …think death match vs CTF.
GameState is another class that’s important as it usually is running all the time keeping track of score and in general what’s happening in the game.
Someone please help I cant figure this out at all
I know how to communicate between class BPs…with BP interfaces.
And I understand how to use event dispatchers to get from a class BP to the Level BP.
…but how in the world do I get the level BP to communicate wth a class BP that keeps spawning???
I have an enemy that keeps spawning every so many seconds!! After I kill so many I need to change something
in the level BP…I cant use a bp interface because I cant pull it into the level bp…at least I dony know how…and I cant use an event dispatcher because I cant select the class bp before I go into the level bp…and if I place the spawning class bp in the level an event dispatcher will only work for THAT class BP but when its spawning it does not work!!
Can anyone help me.please?!?!?!ive been trying.to figure this our for 5 days!!I
There should be two ways to get this to work
Option #1- Scan Every actor in the scene (get the list of spawned actors). Cast each Actor encountered into your monster blueprint. Get a count.
Option #2 - When a monster is spawned, it checks its’ ‘World’ (GetWorld function) and gets to the Level blueprint that way. It increments a monster count. When it dies, it needs to access the Level BP again to decrement monster count.
Option #2 would be the preferred method. I don’t have the ue4 source with me here atm. So I can’t give you the blueprint right now. Will check into this later if you like
This will give me plenty to look over. thank you!! m:)
If you have time I’d love to see a BP of how you could do it.
you would need an interface blueprint for this and you can check the method for it in the door tutorial on incrementing a counter.
Ive never really played with thw gamemode bp. Do you know of any tutoirols that would help me understand it more??
This is how the Blueprint should look like if you were to attach it to your monster blueprint. This is option #2. This is what it is doing. 1st, we get all actors of type LevelScriptActor. There should only be one in your level. This LevelScriptActor has your Level blueprint attached. The foreach loop will iterate through all the actors returned in the result. Here, you see me casting that result into a ‘LevelScriptActor’. But what you really want is to cast it into your Level blueprint. Just invoke a function on your Level BP that increments a count.
 Whoops! Option #2 actually will not work. You will not be able to save your monster asset if you attempt to link to the Level blueprint directly. Perhaps you should look into the GameMode suggestion. There appears to be some limitations to Level blueprints. I personally use GameMode BPs (never used a Level BP til now while testing this solution)
Okay here is the Blueprint for Option #1 which will work. This blueprint demonstrates a function added to the Level BP called ‘CountMobs’. It simply iterates through all of the monsters in the level and gathers a count. ‘Count’ is an Integer variable. You need to invoke CountMobs from your Event Tick or something. This method can get you by but it is not the cleanest by far
This is all new to me. Which is absolutely fantastic. Im gonna play with option #2. Thank you greatly. This should be a great help.
Well keep in mind I could not get Option #2 to work once I attempted to cast my LevelScriptActor directly into my Level blueprint. But Option #1 worked just fine. Just invoke that ‘CountMobs’ function from an Event Tick in your Level blueprint. Not ideal- because its going to be spamming it every tick. But you could clean it up by setting it on a Timer and such. Too bad Actor blueprints do not appear to have direct access to the World/Level objects. On C++ side they do
One last thing- you should check out the Game mode stuff like DJ Midknight suggests. Your monster blueprints can easily get the game mode and they could have incremented the count there
Yes ive never toyed with the game mode BP. Ill look into that as well. Thanks everyone!