Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Fire event between class blueprints

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 ![alt text

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

alt text

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

Product Version: Not Selected
more ▼

asked Jun 21 '14 at 11:55 AM in Blueprint Scripting

avatar image

156 10 13 17

avatar image Shadowriver Jun 21 '14 at 02:49 PM

You sure "Main Game" variable is ok? Also why dont you ry using functions?

avatar image KillerSneak Jun 21 '14 at 10:16 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Fixed it finally -> the MainGame pin above from the SpawnActor node needed a reference to it (self)

more ▼

answered Jun 22 '14 at 11:34 AM

avatar image

156 10 13 17

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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

more ▼

answered Jun 21 '14 at 08:09 PM

avatar image

1k 42 28 65

avatar image KillerSneak Jun 21 '14 at 10:31 PM

1) Hit evens are enabled and working. I'm able to pop the balloons it's just that I can't seem to get the points counting to work

2) If I drop both blueprints into the viewport (PIE) the first time it works. After that it seems the event doesn't get fired anymore when the Balloons are spawned from within BP_Maingame_C with the **Spawn Actor>** node and the class set to Balloon_C 3) Really no idea (have seen the answer several times) It's not a reference - It has **BP_MainGame** as variable type. MainGame (Details) ![alt text

avatar image dissonanceint Jun 21 '14 at 11:20 PM

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: alt text

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.

getreference.jpg (405.1 kB)
avatar image KillerSneak Jun 22 '14 at 11:31 AM

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

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. ![alt text

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?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question