# How to program custom BlueprintNativeEvent?

**URL:** <https://forums.unrealengine.com/t/how-to-program-custom-blueprintnativeevent/321157>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE4, CPP, Blueprint, question\
**Created:** [June 9, 2015, 12:55pm UTC](https://forums.unrealengine.com/t/how-to-program-custom-blueprintnativeevent/321157 "2015-06-09T12:55:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_590cb5931](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_590cb5931](https://forums.unrealengine.com/u/anonymous_user_590cb5931)\
**Post date:** [June 9, 2015, 12:55pm UTC](https://forums.unrealengine.com/t/how-to-program-custom-blueprintnativeevent/321157/1 "2015-06-09T12:55:02Z")

</div>

Hi.

I’m trying to program my custom BlueprintNativeEvent.

My code is:  
.h file

```
#pragma once

#include "Kismet/BlueprintFunctionLibrary.h"
#include "MyBlueprintFunctionLibrary.generated.h"

/**
 * 
 */
UCLASS()
class UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

public:
	UFUNCTION(BlueprintNativeEvent, meta = (FriendlyName = "My First Custom Event", CompactNodeTitle = "MyFirstCustomEvent", Keywords = "My First Custom Event"), Category = Events)
		FText TakeDmg(int32 Damage);

private:
		UFUNCTION(BlueprintPure, meta = (DisplayName = "Hello World2", CompactNodeTitle = "HelloWorld2", Keywords = "String Hello World2"), Category = Game)
		static FText HelloWorld2();	
}; 

```

.cpp file:

```
#include "Walls.h"
#include "MyBlueprintFunctionLibrary.h"

FText UMyBlueprintFunctionLibrary::HelloWorld2()
{
	return FText::FromString("Hello World 2");
}

FText UMyBlueprintFunctionLibrary::TakeDmg_Implementation(int32 Damage)
{
	return FText::FromString("Hello TakeDmg_Implementation");
}

```

After compilation I can find BlueprintPure HelloWorld2

[http://s6.postimg.org/up1tn08s1/screenshot\_122.png](http://s6.postimg.org/up1tn08s1/screenshot_122.png)

…But I can’t find BlueprintNativeEvent MyFirstCustomEvent :

[http://s6.postimg.org/5x27frrld/screenshot\_123.png](http://s6.postimg.org/5x27frrld/screenshot_123.png)

What I do wrong?

I need to implement in C++ some Events, like “On mouse Move” and “Ctrl+Z”…

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_590cb5931](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_590cb5931](https://forums.unrealengine.com/u/anonymous_user_590cb5931)\
**Post date:** [June 9, 2015, 1:50pm UTC](https://forums.unrealengine.com/t/how-to-program-custom-blueprintnativeevent/321157/2 "2015-06-09T13:50:39Z")

</div>

Solution found here: [link text][1]

As result, my new code is:

```
#pragma once

#include "GameFramework/PlayerController.h"
#include "MyPlayerController.generated.h"

/**
 * 
 */
UCLASS()
class WALLS_API AMyPlayerController : public APlayerController
{
	GENERATED_BODY()

public:

	UFUNCTION(BlueprintNativeEvent)
		FText Foo();

	UFUNCTION(BlueprintNativeEvent)
		FText FooOneParam(float MyFloat);

	/** Player's Health is Currently Above 50! Returns
	player's exact current health for convenience. This
	function runs every tick that the player's health
	is high enough! Play healthy sounds here. */
	UFUNCTION(BlueprintImplementableEvent, meta = (FriendlyName = "Player Health ~ Player Is Healthy Tick"))
		virtual void PlayerIsHealthyTick(float CurrentHealth);
	

	void PlayerTick(float DeltaTime);
	
	
	
};

```

and .h file

```
#include "Walls.h"
#include "MyPlayerController.h"

FText AMyPlayerController::Foo_Implementation()
{
	return FText::FromString("Hello Foo_Implementation");
}
FText AMyPlayerController::FooOneParam_Implementation(float MyFloat)
{
	return FText::FromString("Hello FooOneParam_Implementation");
}

void AMyPlayerController::PlayerTick(float DeltaTime)
{
	Super::PlayerTick(DeltaTime);

	//========================
	// BP Interface

	if (this->IsInputKeyDown(EKeys::LeftShift))
	{
		if (this->IsInputKeyDown(EKeys::E))
		{
			this->PlayerIsHealthyTick(75);
		}
		
	}
	
	//========================
}

```

After that create BluePrint Class from your C++ class

[http://s6.postimg.org/qhc3bddo1/screenshot\_125.png](http://s6.postimg.org/qhc3bddo1/screenshot_125.png)

After that in new created BluePrint Class Event Player Health will be accessible:

[http://s6.postimg.org/rxnltigkx/screenshot\_128.png](http://s6.postimg.org/rxnltigkx/screenshot_128.png)

---

<div class="post-metadata">

**Author:** ![SyMutex](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SyMutex](https://forums.unrealengine.com/u/SyMutex)\
**Post date:** [June 9, 2015, 1:51pm UTC](https://forums.unrealengine.com/t/how-to-program-custom-blueprintnativeevent/321157/3 "2015-06-09T13:51:19Z")

</div>

Have you tried searching for “Take Dmg” instead of “My First Custom Event”?
