Declaring function for Blueprints is very easy and be classified in two sections.
Object Specific function.
Generic Blueprint Library functions.
Object specific function have Target pin, when placed in blueprint viewport. Those function can be used outside of object specific blueprint, but you must provide valid object to Target pin.
Generic functions, can be used anywhere.
In both cases you need to add this decoration to make function usable inside blueprint:
UFUNCTION(BlueprintCallable, Category=SomeCategory) Type FunctionName(Parameters);
In case of object specific BP function, you just declare it in object you want to use function.
Blueprint Library Functions, must be declared in special class, and must be static!:
CLASS()
class URPGEffectBPLibrary : public UBlueprintFunctionLibrary
{
GENERATED_UCLASS_BODY()
public:
UFUNCTION(BlueprintCallable, Category=SomeCategory)
static void ReduceMovmentSpeed(float damageAmount, float duration, AActor* damageTarget, AActor* causer);
You get results in to files because class is declared inside header filer (.h) and implemented inside cpp file (.cpp).
Use decorations only inside header files!
Yes spliting between source between two files sucks. But that how it is in C++.
You may now ask, when declare bp function where ?
The answer is it doesn’t really matter.
Declare it where it is easiest to use from. Sometimes declaring in specific object is easier, because function make use of other functions and properties inside that object.
Sometimes, function is pretty self-contained, generic and doesn’t depend on any object specific properties. As such it’s good fit for Blueprint Library as those function are easier to use inside Blueprint.