Conditional touch events from another blueprint

This is in my sprite BP. This gets called every time on touch.

I want this to be called only when something is true in GameInstance BP.

I know about calling events from another BP by event dispatcher.

But this is pre-built events in sprite BP and I don’t actually have control over it from another BP.

I have grid And I want this animation to run only upto specific range of hex tiles.
(Also I already have the range checking algorithm in place inside GameInstance. So Don’t worry about it.)

I also thought about playing the animation too from GameInstance. Is it good Idea? (There is already too much complexity in GameInstance)

And Is it good Idea to put your most of the game logic in Game Instance?

The official documentation only says it is to share data between levels.

Well I only have one level. And I won’t be needing other level I think except if Main menu requires its own level. (Don’t have knowledge about it yet.)

Also Can GameMode store variable data
like GI? As I need to keep track of
the components of each Hex.

It can, sure.

But you should consider using the actor that spawned the hexes for that. This way the hexes can easily communicate with the Hex Generator and the Generator can talk to those Hexes because it spawned them - keep them in an array, for example.

This way you can isolate this communication and no one else needs to know about it.


I tried vector subtraction from both
from begin actor and Enter actor and
printed out the angle.

But I only get 90 degree and 180
degree. Rest of them zero. Most people
want this only this. But as hexagon
has more path ways how can I get those
angle in 60 degree steps?

Not really sure what you need, you may need to clarify. Do you need to find an angle in degrees between 2 touched actors? You can use Dot Product for this or even Find Look At Rotation should work well enough.

You had a cool diagram of the hexes in the other thread; perhaps you could draw an angle that you need so I can understand it better.

Is the game 2d or 3d?

I want this to be called only when
something is true in GameInstance BP.

I also thought about playing the
animation too from GameInstance. Is it
good Idea? (There is already too much
complexity in GameInstance)

I’d say no. This belongs in the actor. Much simpler to handle the way you have it now because the GI does not (and probably should not) need to know about all the actors that need some kind of animation.

Besides that, you can’t even have a Timeline (or any other component) in the Game Instance - a little known fact, actually…

And Is it good Idea to put your most
of the game logic in Game Instance?

Not really. Game logic should be in the actors / managers - that’s the whole point of OOP. I mean, you absolutely could keep top level routines in the framework classes - like world generation, point tracking system, saving data, level loading, main menu, settings - that’s their purpose. But game logic itself, I’d say no.

Technically game logic bits could sit in the Game Mode if you had multiple levels and each level had some unique yet shared functionality. Again, depends on what you really mean by game logic.

Main game loop? Sure, GI may be a good place for this. But playing animations on touched actors, I’d say not really.

The official documentation only says
it is to share data between levels.

Because it’s persistent but who’s Epic to tell you what not to do, eh? :wink:

I am trying to stop the animation if touch Enter actor is not in the direction of previous touch Enter actor.

I tried vector subtraction from both from begin actor and Enter actor and printed out the angle.

But I only get 90 degree and 180 degree. Rest of them zero. Most people want this only this. But as hexagon has more path ways how can I get those angle in 60 degree steps?

Is something I am missing about get angle function from vector?

Also Can GameMode store variable data like GI? As I need to keep track of the components of each Hex.

Its 2D and Thanks “Find Look At Rotation” rotation is what I was looking for. You saved lot of my time. I was doing sine and cosine things all day to get it working!

Also I tried casting boolean before. It didn’t work. After I finish my conditional code I will try it again.

I got the animation working from inside Grid_BP.
I have function whose return node is connected to branch.

And One thing got me wondering is Return node gets executed even if we get false from branch. This does not happens with macros. It seems like functions are self contained and will always execute return node if attached to one irrespective of what inside them. This is what differs them from macro, Did I got this Right?

Yup, you’re absolutely correct.

A function must return and always will. Even if it executes nothing. Even if you do this:

344181-screenshot-3.png

It seems disconnected but it will return, the execution chain will continue. This becomes critical when you deal with Interface functions as they will always return default values even if they’re not implemented… A nasty thing to track down.

The below macro would terminate the execution chain:

344182-screenshot-4.png

Whatever follows this macro, will not trigger.