**'s Multiplayer Game Mode Solution
Find Player Start
Choose Player Start
Can Player Restart
These Core Multiplayer Functions are Fully Implementable/Overridable in Blueprints!**
I have found a solution for the issue of implementing FindPlayerStart, ChoosePlayerStart, and CanPlayerRestart in Blueprints!
And I’ve tested it as working!
**You can now implement core network coding of choosing player starts entirely in Blueprints!
**
**How To Use**
In my picture below I show how to use my Game Mode overrides!
1. **First make a new BP and select my VictoryGameMode class** which comes with my Victory BP Library (make sure you have the latest download https://wiki.unrealengine.com/File:VictoryPlugin.zip)
2. Setup the Victory Game Mode BP the same as my picture below!
3. Celebrate! You can now implement core multiplayer logic in Blueprints!
![VictoryGameMode.jpg|1280x960](upload://9IpVbBoysg8W1JaL94JHYMxDeVQ.jpeg)
CPP Override and CPP Override Var
Please note the notation I am using, any variable that has CPPOverride Var in its name is used only with the corresponding event. This is how I enabled you to override core Game Mode functions via my Victory BP plugin!
**Simple Data Types**
Please note that for the function that is designed to return a boolean value, CanPlayerRestart, you must pass the boolean and also a special variable, **CPPOverride SelfReference**, this is how you tell the CPP that you are implementing a BP override
Non Destructive Solution
My solution is entirely optional and if you do not implement the event in Blueprints, and your programmer does it in C++, my solution will not interfere at all with your existing code base!
**Log Message**
If you do implement my solution in BP, I am printing log information to indicate this, so you/your programmer knows you are using a BP override and any C++ code will not be run.
C++ Code
is my C++ code for FindPlayerStart which shows how I worked around the issue of overriding FindPlayerStart via Blueprints!
Again I’ve tested this as entirely working in PIE and commandline games!
.h
//Find Player Start
:
/** Use this var inside the body of CPP Override ~ Find Player Start event to override the C++ functionality! */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Victory Game Mode")
AActor* CPPOverrideVar_FindPlayerStart;
/**
* Use CPPOverrideVar_FindPlayerStart inside of this event to implement FindPlayerStart in BP ! <3
*
* Return the 'best' player start for this player to start from.
* @param Player - is the AController for whom we are choosing a playerstart
* @param IncomingName - specifies the tag of a Playerstart to use
* @returns Actor chosen as player start (usually a PlayerStart)
*/
UFUNCTION(BlueprintImplementableEvent, meta=(FriendlyName = "CPP Override ~ Find Player Start"))
virtual void CPPOverride_FindPlayerStart();
virtual class AActor* FindPlayerStart( AController* Player, const FString& IncomingName = TEXT("") ) override;
.cpp
//Find
AActor* AVictoryGameMode::FindPlayerStart( AController* Player, const FString& IncomingName )
{
//Clear any previous to indicate whether BP did an override
CPPOverrideVar_FindPlayerStart = NULL;
//=======================
//BP Hook by
this->CPPOverride_FindPlayerStart();
//=======================
if(CPPOverrideVar_FindPlayerStart) //Did BP user set the var?
{
//Indicate that the BP override was found and is being used.
UE_LOG(VictoryGameModeLog, Log, TEXT("
"));
UE_LOG(VictoryGameModeLog, Log, TEXT("FindPlayerStart: CPP override found in %s and used instead of C++ implementation"), *GetName());
UE_LOG(VictoryGameModeLog, Log, TEXT("
"));
return CPPOverrideVar_FindPlayerStart;
}
//Default C++ Implementation
return Super::FindPlayerStart(Player,IncomingName);
}
**Enjoy!**