Help with blueprint communication

Hello,

I am trying to spawn and destroy characters using a spawn manager and multiple spawn volumes using blueprint communication. I can get the volumes to spawn actors all right with custom event calling. But I can not destroy them and I can not figure out what I am doing wrong. Can someone help please? I am attaching screenshots of both blueprint event graphs.

The custom event for spawning fires correctly, but the custom event for destroy doesn’t even register input (or something like that) because it never reaches ‘Branch’ from ‘R’.

I was hoping to use SpawnedGuards variable in the manager BP so I made it public.

Disclaimer: I am an artist with very limited programming knowledge. I very probably think it might be a programmer rookie mistake, but even diagnosing that is quite taxing for an artist brain. What I have done so far is go through similar threads and the following links (perhaps many more but I fail to keep track in lieu of getting things done):

https://docs.unrealengine.com/latest...mms/index.html [courtesy Jeff Wilson from another thread]
https://docs.unrealengine.com/latest...ces/index.html [courtesy Jeff Wilson from another thread]
https://docs.unrealengine.com/latest...her/index.html [courtesy Jeff Wilson from another thread]

I can not move on to event dispatchers until I am sure there’s something in this case which can not be resolved without investing anything upwards of 4-6 hours.

Please help.

I can not believe I am answering my own question!

Note: For any input related events in any kind of blueprint, make sure that the blueprint in question ‘Auto receives input’ from player 0!

Rookie mistake! Just like forgetting the semicolon after C++ statements. Still, in one of the cow spawning videos it has been mentioned that this is a hack. So what is the proper procedure for the same? We do not know at the moment.

You are correct as far as your implementation goes, but you are also correct that it is a hack, and one that will bite you later. Create an interface for your spawn manager with a function call like “SpawnGuards”. In your Project settings, create a custom input action called 'SpawnGuards" an map it to a keyboard input. Finally, in your player character, add an input action event and call your interface function from there.

Why this is better:
In your final game, you may/may not want your player being able to spawn something by pressing that key. Further, if you want any other object to spawn something using your manager you will have create more code to do it. Instead, this method isolates your Spawn manager, and allows you to process the action via an interface function call from anywhere in your program.

Hope that helps,
Tony

Thanks Tony! It cleared up much of my misunderstanding.

I am trying to wrap my head around how blueprint interface works. So far I can relate the use of same function in multiple blueprints with different definitions or parameters via blueprint interface. Or is it different objects using the same function but behaving differently? Sorry, it’s a bit confusing when it comes to understanding teething problems like these. In either cases though, is it like creating a library of functions that are independent of any actors or objects in the scene unless customised on a case-by-case basis?

Anyway, in our case, I understand the concept of spawning and destroying peeps with a key-bind event for testing purposes. But that’s not the proper way to populate the world automatically, is it? So is it okay to have the event Begin Play direct the spawning system? The spawn destruction can be bound to external events (which would again make use of interfaces I guess).

I am going to read the documentation on Blueprint Interfaces again, just in case.

Hello Tony,

I understood how it works and got your explanation as well. I did what you suggested, only for the destroy guards. I have attached the screenshots below:

So I tried it with the bound action as well as other keys and the I ran into the same problem. The input is not getting registered. More hacks? What do I do?

Edit: Forgot to mention all the while that I am using 4.6.1. Exactly how broken is it? It also crashes every time I try to copy or move something in the content browser.

I have given up on blueprint interface communication. The event gets called but nothing happens after that. I have to make do with hacks at the moment and save time. I will open up a new question specifically on blueprint interface later.