Hi,
i want to replicate my enemy health variable to all clients, but don’t work.
My code : ***
I call the “make damage” function from client when shooting at an enemy, but the health only change on the client who shot.
Thanks,
Hi,
i want to replicate my enemy health variable to all clients, but don’t work.
My code : ***
I call the “make damage” function from client when shooting at an enemy, but the health only change on the client who shot.
Thanks,
Replication wont show on other clients because they dont know what other clients do, and as far as i can tell, your server is telling each client to MakeDamage. so the change is pretty much local. why dont you pass the actor to be damaged to the server and apply damage, using the server? that way 1. server takes care of applying damage and avoid cheating (client could, somehow, block that makedamage, since its locally) and 2. variable would replicate to all since its the server making the change.
i mainly use BP, but from what i see is that you are calling client side functions from the server. that doesnt means every client will execute that, it means its telling that client to execute the function. im sure the local variables on each client recieving damage are working fine, but the other clients dont know about other variables since the change was made locally. have you tried accessing those variables inside your character from the server? in theory, that would replicate for other clients to see it.
void ABasicEnemyActor::ServerMakeDamage_Implementation(AMyPlayerCharacter* _MyChar)
{
_Mychar->health -= MyEnemyDamageFloat;
}