Replicating Mover

Discussions about Coding and Scripting
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Re: Replicating Mover

Post by Rakiayn » Fri May 18, 2012 2:37 pm

this is really interresting!
can you tell a little bit more about the mod you are building?

JackGriffin
Godlike
Posts: 3766
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Replicating Mover

Post by JackGriffin » Fri May 18, 2012 2:55 pm

I thought this might interest people.

The OP was nice enough to let me peek at the mod and I must say that although I would do it a little differently (I think), his ideas have very real potential and I'm quite interested in how he does a release for this. It's worth staying tuned for.
So long, and thanks for all the fish

TehDevil
Novice
Posts: 5
Joined: Fri Sep 17, 2010 3:18 pm

Re: Replicating Mover

Post by TehDevil » Fri Aug 17, 2012 5:57 pm

So.. What ever happened to this mod?

User avatar
Dizzy
Experienced
Posts: 100
Joined: Tue May 21, 2013 3:57 pm
Personal rank: Oaf

Re: Replicating Mover

Post by Dizzy » Thu Oct 11, 2018 9:21 pm

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=""
}
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.

Has anyone got this to work? Why is it "native" anyway?

*Edit:* got it to compile using "ucc make -NoBind" but now I can't import it into the Editor:

Image
Image
Join our UT Discord chat server: https://www.bunnytrack.net/discord