x

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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Need help with events; C++ and BP.

I have tried for so long to wrap my head around events but I am failing miserably and need help. So essentially I will break down what I am trying to do.

As an exercise I am trying to recreate the combat system from FF7. I have a couple different level types (Streets, forest. etc) and I created an ENum to hold these types and when combat is triggered, look at the type of level we were in to be able to know what type of map to spawn me into for the combat sequence. I had two plans for this, one of which is using my already existing function that triggers combat and pass my Enum into it determine what map to spawn but that had complications of its own.

So I decided to use events. My idea was I would have an event trigger in my c++ function I already have that begins my combat. That event would tell something in my blueprint to take a look at the enum and spawn my character in the correct level. But when it comes to declaring events, binding them to something and calling them I have no idea how it works.

I declared my event like so:

 DECLARE_DYNAMIC_MULTICAST_DELEGATE(FCombatTriggered);

here as well:

     UPROPERTY(BlueprintAssignable)
     FCombatTriggered CombatTriggered;

And I added what I thought would trigger the even in my cpp:

         CombatTriggered.Broadcast();

I can see my event in my blueprint now. But when it comes to binding and calling I can't wrap my head around how it works to actually make it work for me.

alt text

Sorry if this seem inappropriate but I have tried reading others answer questions, reading documentation on unreal's websites but sometimes it is easier to bounce ideas off someone, or get an answer for my situation so I can relate the info to something I am actively trying to accomplish and hopefully make it easier to learn because of it.

So to explain it quick once more: Trigger event in c++ -> The event will run a series of code in BP.

Product Version: UE 4.22
Tags:
untitled.png (26.2 kB)
more ▼

asked May 19 '19 at 08:14 AM in C++ Programming

avatar image

kranatos13
5 2 1 3

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

2 answers: sort voted first

You can just use the Assign/Bind Combat Triggered items in the context menu (the one from your screenshot). It will create the required nodes for binding and a new custom event node to handle the triggered event.

To make it work, you should bind the event in the beginning, then add your handler for the new custom node bound to the Combat Trigger.

Another way (which may be easier to use in your case) is to declare a UFUNCTION(BlueprintImplementableEvent) instead of the delegate. You will be able to call this event from C++ the same way as you calling a simple functions, and in the blueprint it will be just a new input node with the declared name, no need for any bindings.

more ▼

answered May 19 '19 at 03:24 PM

avatar image

norlin
425 11 18 25

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

I sort of figured it out. Since it is in my GameInstance I used the Init event to bind the event at the start of play. Still not entirely 100% sure on how it all works so I would still be ecstatic if someone could explain events to me like im a toddler, but at least this is working now!

more ▼

answered May 19 '19 at 08:43 AM

avatar image

kranatos13
5 2 1 3

(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