Re: Replicating Mover
Posted: Fri May 18, 2012 2:37 pm
this is really interresting!
can you tell a little bit more about the mod you are building?
can you tell a little bit more about the mod you are building?
This isn't working/compiling for me. I had to make it "extend Mover" instead of "native" and remove the "native function SetBrush" to get it to compile. Then when it's used in a map, it crashes when a player joins.comoestas wrote:Fully replicating mover code:Code: Select all
class DynamicMover native; var vector mDesiredLocation; var rotator mDesiredRotation; var float accLocX, accLocY, accLocZ, accRotYaw, accRotPitch, accRotRoll; // replicate without loosing accuracy replication { reliable if (Role == ROLE_Authority) accLocX, accLocY, accLocZ, accRotYaw, accRotPitch, accRotRoll; } native function SetBrush(model m); event PostBeginPlay() { mDesiredLocation = Location; mDesiredRotation = Rotation; } simulated function Tick(float DeltaTime) { if(Role == ROLE_Authority) { accLocX = Location.X; accLocY = Location.Y; accLocZ = Location.Z; accRotYaw = Rotation.Yaw; accRotPitch = Rotation.Pitch; accRotRoll = Rotation.Roll; } else { mDesiredLocation.X = accLocX; mDesiredLocation.Y = accLocY; mDesiredLocation.Z = accLocZ; mDesiredRotation.Yaw = accRotYaw; mDesiredRotation.Pitch = accRotPitch; mDesiredRotation.Roll = accRotRoll; } if(Location != mDesiredLocation) SetLocation(mDesiredLocation); if(Rotation != mDesiredRotation) SetRotation(mDesiredRotation); } defaultproperties { bNoDelete=false NetPriority=1.400000 MoverEncroachType=ME_IgnoreWhenEncroach NumKeys=1 MoveTime=0.000000 StayOpenTime=0.000000 InitialState="" }