PDA

View Full Version : Replicating pawn material change to clients



BetaNium
03-19-2011, 02:09 PM
Hello, I have been trying to replicate pawn's material change to clients without success.

This is my code structure:


class BOBPawn extends UTPawn;


var repnotify bool bAdrenalineMaterialOn;

replication
{

if(bNetDirty)
bAdrenalineMaterialOn;


}


simulated event ReplicatedEvent(name VarName)
{
if( VarName == 'bAdrenalineMaterialOn' )
{
if (bAdrenalineMaterialOn == true)
{
ChangeTheMaterial();
`log("bAdrenalineMaterialOn = true");
}


}
else
super.ReplicatedEvent(VarName);
}

exec function ChangeTheMaterial()
{
Mesh.SetMaterial(0, AdrenalineMaterial);
bAdrenalineMaterialOn = true;

if(Role < ROLE_Authority)
ServerChangeTheMaterial();
}



reliable server function ServerChangeTheMaterial()
{
ChangeTheMaterial();
}

This shows the material change on the server but on clients it does not change :(

Thanks in advance.

BetaNium
03-20-2011, 09:54 AM
Bump. Anyone got any tips about this?

he3117
03-20-2011, 11:14 AM
you should define your function as simulated for client.