I have written a player c++ script, with movement, and I am going to script a ragdoll function. I’ve implemented the inputs already, but instead of scripting the ragdoll function in c++, can I make an empty function called Ragdoll(); and expose it to blueprint, where I then script the function? Sorry if this is a dumb question.
Hello @Defaults_Is_AGod ,
Yes you sure can do this by adding UFUNCTION for that function.
.h
// Example
UFUNCTION(BlueprintNativeEvent)
void Ragdoll();
.cpp
void AYourClass::Ragdoll_Implementation()
{
}
After that, you can call it in your BP. Note that UFUNCTION BlueprintNativeEvent in cpp need _Implementation on it (It maybe shown as error but its fine, if you build it there will be no error regarding that in output log).
UFunctions | Unreal Engine Documentation
Edit (Addition):
You can also combine the script in Blueprint and C++, I give you my simple usage example.
.h
/** Show Coin Anim HUD */
UFUNCTION(BlueprintNativeEvent)
void ShowCoinBox();
.cpp
void UPlayerHUDWidget::ShowCoinBox_Implementation()
{
bCoinBoxShown = true;
}
then in my BP
Hope this help you, if you need anymore help feel free to do!
1 Like
this is so helpful thank you
1 Like