Blueprint Interface Event calling

Firstly, I’m not a very strong programmer so I’m assuming I’m missing something simple here.

I’m working on building a Tic Tac Toe game. Currently the player can place crosses on the board, and are informed when they place 3 in a line via the log. However I am getting stuck on triggering an end of game event.

My system includes 9 instances of a GridSquare bluepirnt which controls placing pieces onto the board. When a piece is placed it spawns an actor, then reports it’s location to the logic blueprint.

The logic blueprint checks to see if the placement has caused the game to be won. If it has been, it messages the log saying thus and calls the EndGame function via an interface message. The target is currently set to a blueprint variable defaulted to the GridSquare blueprint.

My grid square blueprint contains an EndGame event connected to a DeleteActor node targeted at the spawned actor.

However, it seems like the EndGame event happens. The end game log fires but all the pieces remain. I suspect that the target for the EndGame call in logic is wrong, however since I can’t target all 9 actors at the same time I’m not entirely sure what the best option is.

I’ve put my project up on the dropbox under ChrisMorris if my description is lacking in detail.

Thanks!

You actually can connect multiple objects to a Target pin and it will call the function on all of them! You will need to do something like that if you want to pass your ‘EndGame’ function to all the blocks.

Right now this is made much more difficult than necessary due to Blueprints being unable to communicate easily with each other (one BP cannot fire a Custom Event in another BP for example). We are working hard to get this fixed, but it may not make the next beta. In the mean time you have to use an Interface as it sounds like you have been doing.

The solution I came up with in the end was to for loop though an array of placed pieces and call a remove piece function on each one in turn. It might not be the most efficient method but it works.

As for connecting connect multiple objects to targets. I don’t quite know why it didn’t work when I tried it before posting this. Possibly had my types confused or similar, but it does indeed work.

Thanks for the help!