# Creating UE4 events, opposed to c++ \_event?

**URL:** <https://forums.unrealengine.com/t/creating-ue4-events-opposed-to-c-event/311336>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [March 17, 2015, 7:23am UTC](https://forums.unrealengine.com/t/creating-ue4-events-opposed-to-c-event/311336 "2015-03-17T07:23:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Belven](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Belven](https://forums.unrealengine.com/u/Belven)\
**Post date:** [March 17, 2015, 7:23am UTC](https://forums.unrealengine.com/t/creating-ue4-events-opposed-to-c-event/311336/1 "2015-03-17T07:23:55Z")

</div>

Hey, so I’ve got to the point where I need to be able to create listeners and notifiers within a lot of my classes. Currently I’m use c++ to do this with **\_raise** and **\_event** :

> <https://github.com/belven/The_Battle_Of_Maldon/blob/master/The_Battle_Of_Maldon/Public/EventSource.h>

> <https://github.com/belven/The_Battle_Of_Maldon/blob/master/The_Battle_Of_Maldon/Public/EventReceiver.h>

It’s easy to use but I’d like to use UE4s way of doing this as well, providing that it will work in c++ just as well as blueprints.

I’ve noticed this:

**CollisionComp-\>OnComponentHit.AddDynamic(this, &AThe\_Battle\_Of\_MaldonProjectile::OnHit); // set up a notification for when this component hits something blocking**

which appears to be like this in my code:

**\_\_hook(&EventSource::AttackActionEvent, pSource, &EventReceiver::AttackActionEvent);**

Where the method of **OnComponentHit** , the notifier/event, is run from the **CollisionComp** and also passed into the method **OnHit** , the listner, of **AThe\_Battle\_Of\_MaldonProjectile**.

What what I have to do to set this up? Does ‘AddDynamic’, automatically hook **OnComponentHit** to **OnHit** or do I need to change something in **OnComponentHit**?

---

<div class="post-metadata">

**Author:** ![staticvoidlol](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@staticvoidlol](https://forums.unrealengine.com/u/staticvoidlol)\
**Post date:** [March 17, 2015, 10:26am UTC](https://forums.unrealengine.com/t/creating-ue4-events-opposed-to-c-event/311336/2 "2015-03-17T10:26:03Z")

</div>

These links should be helpful:

[Official Documentation](https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Delegates/index.html)

[Forum Post](https://forums.unrealengine.com/showthread.php?61599-C-Event-dispatchers-How-do-we-implement-them&p=239845#post239845)

---

<div class="post-metadata">

**Author:** ![Belven](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Belven](https://forums.unrealengine.com/u/Belven)\
**Post date:** [March 17, 2015, 4:47pm UTC](https://forums.unrealengine.com/t/creating-ue4-events-opposed-to-c-event/311336/3 "2015-03-17T16:47:11Z")

</div>

Thanks, I’ll look into it. lots of stuff to do for such a simple thing…

---

<div class="post-metadata">

**Author:** ![Belven](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Belven](https://forums.unrealengine.com/u/Belven)\
**Post date:** [March 17, 2015, 5:40pm UTC](https://forums.unrealengine.com/t/creating-ue4-events-opposed-to-c-event/311336/4 "2015-03-17T17:40:03Z")

</div>

So i’ve got the idea but the compiler won’t compile. All I have is:

DECLARE\_DELEGATE\_OneParam(SuppliesGivenEvent, ASupply\*);

UCLASS(Blueprintable, BlueprintType)  
class THE\_BATTLE\_OF\_MALDON\_API AVillageVolume : public ABaseVolume  
{

…  
UPROPERTY(BlueprintAssignable, Category = “Events”)

```
	SuppliesGivenEvent OnSuppliesGivenEvent;

```

}

It just doesn’t know what SuppliesGivenEvent is, Unrecognized type ‘SuppliesGivenEvent’ etc?
