Hi there. I’m quite new to the answer hub so please bare with me. I’m making a small game for my little daugher
that uses the Tappy Chicken as base (won’t be a clone)
It’s a simple game where balloons fly up and once you touch them it should give you points. Now this is where it’s getting to complicated for me. The Tappy Chicken code has an event called [Score> in the main BP_Maingame blueprint
Now i want to call this event from another class blueprint called Balloon as you can see on the second picture. For some reason it doesn’t fire the event from within the Balloon blueprint. I’m used to working with UDK where (imho) you could fire events anywhere (same as sharing values anywhere) so I just can’t seem to figure out why it’s not firing
I hope some one can point me in the right direction. I’m not doing anything with the level_blueprint as it’s based on the Tappy Chicken base code/template
You sure “Main Game” variable is ok? Also why dont you ry using functions?
There are several reasons why this could be happening and it’d be easier if you explained your method of obtaining a reference to the other blueprint and how you are testing the functionality.
These are the reasons I could think of:
1)Your actual balloon doesn’t have a collision to generate the event (maybe you should put a prnt string or something to check if it gets through that point)
2)You haven’t use an “Enable input” node in your balloon class for inputs to work
3)You created a variable reference to MainGame but never actually set it. You can do this by making it public/editable and then choosing the blueprint as target in the details panel
Main Game It’s not a variable it’s a variable name → with the type of the BP_Maingame_C this way you should be able to set all public values in BC_MainGame_C including firing events.
Point 3) is definitely your problem them. When you create a variable, that is all it is. It is a variable of type MainGame that can be any MainGame in your game so you need to specify which instance of MainGame it points to.
You have different ways to do it. The simplest way is the following:
Now, this wouldn’t exactly work in your case ,since the spawned objects don’t exist in the scene, and you have different options depending where you spawn them. Iterators or expose on spawn pins are some options.
This is exactly how I have set it up. Like I said when I drag the Balloon blueprint into the viewport that balloon will work → it pops on touch and adds a point.
![alt text][1]
The problem is that in BP_MainGame → I have setup spawnpoints that spawn the balloon actors. Those balloons spawned don’t activate the [Score> event.
The MainGame is editable (green eye). It’s just that when an actor gets spawned [Spawn actor From Class> node the event doesn’t get fired.
Is there anything I can make a screenshot from to make things more clear?
Fixed it finally → the MainGame pin above from the SpawnActor node needed a reference to it (self)