Hi,
I’ve started working on a project in Unreal 4.7. I’m trying to implement my characters within C++ using the C++ FPS example, but for some reason, the clients that join the game don’t get the same information as the listen server.
(Starting with zero pods, instead of 4.)
MyCharacter.h
/** Current number of balls in the hopper. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Ammo)
int32 Ammo;
/** Current number of balls in the hopper. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Ammo)
int32 HopperSize;
MyCharacter Blueprint
But when I enter a game, they don’t have those values. Also, when I’m calling my OnFire function, it doesn’t play any audio/animation when used for the Client. Is this because it’s being called on the Server instead? I feel like I am probably not doing this correctly.
MyCharacter.h
UFUNCTION(Reliable, Server, WithValidation)
void OnFire();
void OnFire_Implementation();
bool OnFire_Validate();
MyCharacter.cpp
void MyCharacter::OnFire_Implementation() {
// Check if ammo 0, play empty sound.
// Ammo--;
// Shoot
// Play shot sound
}
void MyCharacter::OnFire_Validate() {
return true;
}
Also, when I’m setting up my HUD, I get an error:
Error Accessed None ‘Character’ from node ReturnNode in blueprint GameHUD
I think this may be how I’m setting up the game, or something, as it seems like my clients are getting different data than the listen server.
Thanks for your help.