Download

Problem referencing StaticMesh Components in same Actor

Hello guys,

I have a (probably small) problem with my Blueprint. I’m trying to recreate a simple TicTacToe game.

What I have right now is a Blueprint with the models and every single panel in the array as Static Mesh Components inside. It looks like this:

Macro3.jpg

I got everything working so far. The first Panel (1x1) switches the material according to what owner it has (0 = none, 1 = Circle, 2 = X) so generally my Blueprint is working.
What I wanted to do know is put that functionality on every single panel in the blueprint. So I took my existing Blueprint and converted it to a macro so I can reuse it for every panel. The important parts of the macro look like this:

Macro.jpg

The yellow line represents what connection I need. It basically checks what value the panel variable (for example 1x1) has and changes the material accordingly on the panels specific mesh (in this case of course 1x1).
So the main Blueprint looks like this:

97c67211482fba7c5b532d9897ac69d7dbad2f9b.jpeg

Now, all I want to do is input the Static Mesh Component into each Macro so I can use it like I showed in the second picture. The problem is that the two types seem to be incompatible. Depending on what I set the macro input to I can either not input it into the macro at all or I can input it into the macro but the “Set Material” nodes inside the macros cannot use it.

So, how do I solve that? I’m sure it’s pretty easy but I cannot get behind it…

Thanks in advance!

What is the variable that you are looking for on the input?Perhaps you have set it as instance mesh or something of the like?

Wouldn’t the set material node simply set ‘self’ if you left it alone? And you said this is per blueprint, so isn’t it good the way you have it?

Edit:
Why don’t you set a static mesh component input? And when you execute the macro, pass the macro the static mesh from ‘get static mesh’.

Thanks guys, but I found a different solution!

I removed the panels from the playfield Blueprint. They are now seperate, own Blueprints that will be referenced via object variable in the playfield Blueprint. It works as intended now! Now I just have to find a way to make the rules actually apply on the panels. Right now I have no idea how to solve it :smiley:

tictactoe.jpg

That is the simplest way to do it sure, but you should have been able to do it within the 1 blueprint pretty easily.

Figuring out the actual “win/lose conditions” is a bit of a trickier 1. You will want to do a few loops checking what their partner is in each direction and if you get 3 in the 1 direction than you win. Which is why having them in a single blueprint would actually be easier for this but you could just pass the variables over to the level or gamemode blueprint