How to implement C++ funcions and call it in blueprints

In the header file you need to make your method a UFunction UFunctions | Unreal Engine Documentation
For example

    UFUNCTION(BlueprintCallable)
    float Level(int Xp);

I need to do something like it.

float Level( int Xp ){
    float temporary = Xp ;
    temporary = sqrt( temporary ) ;
    temporary = sqrt( temporary ) ;
    return min( 1.0f+temporary , 100.0f );
}

232485-bp-example.png

How to do it?

From the files creation until the function call.

Is needed a C++ class? Or no?

Can it be like a common C++ function library?

Note: I’d forged the image.

Can you answer about the files? How to make the function be found by the blueprint? Need to be in the same folder?

Can be only a “.h”? How to make the unreal engine editor see the “.cpp” or “.h”?

Header files contain definitions of Functions and so the UFUNCTION only needs to be in the .h file. At the top of the link it says “UFunctions are declared in the .h class header file”. Once you add the code in the above post to your header file go to your .cpp file and implement the method, compile your code then you should be able to call the method in blueprints as long as it’s in scope.

This video answered my question.