Download

Networking BlueprintImplementableEvent and BeginPlay

Hello!

I am doing a Multiplayer RPG game.

We have skill actors scripted in Blueprints. And all the functionality is in the BeginPlay. So… I need to separate the functionality because the BeginPlay is called by Client and Server (replicated actor).
To help designers, I need to separate the BeginPlay in “3” BlueprintImplementableEvent Functions. Buuuut after many tests I did:

BeginPlay()
{
__if(!Client)
__{
____ReplicatedCaster = Caster; // Replicated
__}

__BeginPlay_Multiplayer(); //No RPC

}

BeginPlay_Multiplayer()
{
__if(!Client)
__{
____BeginPlay_Server(); //No RPC (BlueprintImplementableEvent)
____if(IsLocallyControlled())
____{
______OnlyCaster = true; //No replicated
____}
__}
__else
__{
____if(IsValid(ReplicatedCaster))
____{
______if(IsLocallyControlled())
______{
________OnlyCaster = true; //No replicated
______}
____}
__}

__BeginPlay_Client(); //No RPC (BlueprintImplementableEvent)
}

(( Inside BeginPlay_Client() I use the variable OnlyCaster with a branch to separate functionality because there are functions only called by the CASTER of the skill (1client is the correct one) ))

I have many questions: WHY THIS WORKS?

  • Where there is a variable with name OnlyCaster I used BeginPlay_Caster() (BlueprintImplementableEvent) BUT Unreal never call the scripted part (I mean, the code is correct, but the Blueprint part was never called!!!). WHY?
  • Where you can see the variable ReplicatedCaster in BeginPlay, I used to have it in BeginPlay_Multiplayer() BUT the variable didnt initialize good. WHY works ONLY inside the BeginPlay()??
  • Where you can see the function BeginPlay_Multiplayer(), I used to have it in BeginPlay() BUT it didnt work. WHY?