I want to report a bug in version 4.12.5 (Source Build).
I am currently working on a dedicated server build and there is a bug in the AGameMode class.
When I try to override the ReadyToStartMatch() function like so (MaxNumberOfPlayers is my variable)
I’m also searching for how to override this, because the documentation and code tells you to do so…
/** @return True if ready to Start Match. Games should override this */
UFUNCTION(BlueprintNativeEvent, Category="Game")
bool ReadyToStartMatch();
/** @return true if ready to End Match. Games should override this */
UFUNCTION(BlueprintNativeEvent, Category="Game")
bool ReadyToEndMatch();
also
/** Transition from WaitingToStart to InProgress. You can call this manually, will also get called if ReadyToStartMatch returns true */
UFUNCTION(BlueprintCallable, Category="Game")
virtual void StartMatch();
so how can we delay StartMatch (until all players have joined) if we cant override?
I wouldn’t imagine that you’d need to override it, although you are able to override it in blueprints since it is a BlueprintNativeEvent as far as I’m aware.
However, if you’re looking to delay StartMatch, you can try changing the value of bDelayedStart:
/** Whether the game should immediately start when the first player logs in. Affects the default behavior of ReadyToStartMatch */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="GameMode")
uint32 bDelayedStart : 1;
Then ReadyToStartMatch() will not be called, and you should be able to call StartMatch after whatever condition you’d like. Give that a shot and let me know if that works out or not.
bool AGameMode::ReadyToStartMatch_Implementation()
{
// If bDelayed Start is set, wait for a manual match start
if (bDelayedStart)
{
return false;
}
// By default start when we have > 0 players
if (GetMatchState() == MatchState::WaitingToStart)
{
if (NumPlayers + NumBots > 0)
{
return true;
}
}
return false;
}