Can Movers move from key to another then immediately goes back to the first key?

Tutorials and discussions about Mapping - Introduce your own ones!
User avatar
UnrealWarrior
Average
Posts: 64
Joined: Sun May 31, 2020 10:07 pm

Can Movers move from key to another then immediately goes back to the first key?

Post by UnrealWarrior »

Like the title suggests, I'm trying to make some boxes moving from key1 to key2...etc and then it immediately goes back to the first key and loop again, I tried LoopMover, but whenever it reach the last key, it finds the shortest path to go back, GradualMover gave me more trouble than anything, even if you put OpenTimes at 0, they will appear for a frame and disappear.

Is there any way for a mover to go through all the keys available then immediately goes back to the first key?

Thank you :)
"We have nothing to fear but fear of tigers"

~tiger attack survivor
User avatar
papercoffee
Godlike
Posts: 10432
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.

Re: Can Movers move from key to another then immediately goes back to the first key?

Post by papercoffee »

have you tried to move them back frame for frame?
instead of using only 4 frames you use 7 frames where the last frame is the second frame again... and then it would just go back to the first frame.
But I must say I never tried this my self.
User avatar
UnrealWarrior
Average
Posts: 64
Joined: Sun May 31, 2020 10:07 pm

Re: Can Movers move from key to another then immediately goes back to the first key?

Post by UnrealWarrior »

papercoffee wrote: Thu Nov 23, 2023 5:31 pm have you tried to move them back frame for frame?
instead of using only 4 frames you use 7 frames where the last frame is the second frame again... and then it would just go back to the first frame.
But I must say I never tried this my self.
If I move them back, it will loop back, If I understand you correctly. But I want it to go through the keys then goes back immediately.

I'm not sure, but If we go through all the keys (key7?) will the mover start from key0 again? Worth a try.
"We have nothing to fear but fear of tigers"

~tiger attack survivor
User avatar
papercoffee
Godlike
Posts: 10432
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.

Re: Can Movers move from key to another then immediately goes back to the first key?

Post by papercoffee »

How many frames do that mover have?

Oh now I get it ...I think so.
You want the mover to go from start frame to key1, key2 ect. and the immediately back to the start and not go back the whole track.
Uffz ...I think it's possible I might have seen it before. But can't remember in which map.
User avatar
UnrealWarrior
Average
Posts: 64
Joined: Sun May 31, 2020 10:07 pm

Re: Can Movers move from key to another then immediately goes back to the first key?

Post by UnrealWarrior »

papercoffee wrote: Thu Nov 23, 2023 5:54 pm How many frames do that mover have?

Oh now I get it ...I think so.
You want the mover to go from start frame to key1, key2 ect. and the immediately back to the start and not go back the whole track.
Uffz ...I think it's possible I might have seen it before. But can't remember in which map.
I've seen ones with 2 keyframes, if you use more than two, it'll appear for a frame and goes back, but with two, there's only one way back and it returns immediately.

I'm messing with it right now, I think I've got something, I'll post if I find anything. :)
"We have nothing to fear but fear of tigers"

~tiger attack survivor
User avatar
Alien3674
Novice
Posts: 7
Joined: Tue Nov 21, 2023 6:15 pm

Re: Can Movers move from key to another then immediately goes back to the first key?

Post by Alien3674 »

If you are familiar with UnrealScript, you can use the mover code from Unreal 227 ConstantLoop state.
It moves from key to key, then goes to the first one, that is, Key0 => Key1 => Key2 (no more keys) => Key0 => Key1 => further in a circle.
User avatar
Barbie
Godlike
Posts: 2769
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Can Movers move from key to another then immediately goes back to the first key?

Post by Barbie »

As far as I see you just have to overwrite function Mover.DoClose(): Instead of
InterpolateTo( Max(0,KeyNum-1), MoveTime );
use
InterpolateTo( 0, WhatEverMoveTimeYouWant);.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
Alien3674
Novice
Posts: 7
Joined: Tue Nov 21, 2023 6:15 pm

Re: Can Movers move from key to another then immediately goes back to the first key?

Post by Alien3674 »

The ConstantLoop state from Unreal 227.
Can be used by adding a MyLevel package to the level, or as a separate package.
The code is checked for UT469c.

Code: Select all

class ConstantUTMover expands Mover;

state() ConstantLoop
{
Ignores UnTrigger, Trigger;

	function DoOpen()
	{
		local byte i;
		
		if (bOpening)
		{
			i = KeyNum + 1;
			if (i >= NumKeys)
			  i = 0;
			PlaySound(OpeningSound);
		}
		else
		{
			i = PrevKeyNum;
			bOpening = true;
			PlaySound(ClosingSound);
		}
		bDelaying = false;
		InterpolateTo(i, MoveTime);
		AmbientSound = MoveAmbientSound;
	}
	function InterpolateEnd(actor Other)
	{
		if (StayOpenTime > 0.f)
			AmbientSound = None;
	}
	function BeginState()
	{
		if (OtherTime == 0.f)
			OtherTime = 1.f;
		bOpening = true;
	}
	function MakeGroupStop()
	{
//stop moving immediately
		bOpening = false;
		AmbientSound = None;
		PlaySound(OpenedSound, SLOT_None);
		GotoState('', 'Close');

		if (Follower != None)
			Follower.MakeGroupStop();
	}
	function MakeGroupReturn()
	{
//Abort move and reverse course
		bOpening = false;
		bInterpolating = false;
		GotoState('', 'Open');

		if (Follower != None)
			Follower.MakeGroupReturn();
	}

Begin:
	DoOpen();
	FinishInterpolation();
	FinishedOpening();
	Sleep(StayOpenTime);
	GoTo'Begin';//loop forever
Open:
	GoTo'Begin';
Close:
	Sleep(OtherTime);
	GoTo'Begin';
}

defaultproperties
{
	InitialState="ConstantLoop"
}
To be used in MyLevel, you need to delete the top row and the defaultproperties block.
You do not have the required permissions to view the files attached to this post.
Red_Fist
Godlike
Posts: 2163
Joined: Sun Oct 05, 2008 3:31 am

Re: Can Movers move from key to another then immediately goes back to the first key?

Post by Red_Fist »

It's an odd concept, not sure if I am full of crap, but !!

You need to fake it, like starting the mover out on a different frame and using a tiny move at the end to simulate it going to zero. Sort of like using the ,going back to zero against itself, so starting at a different frame and using a min of 3 frames, then messing with the "ends" like a far distance or a 2 unit distance.
Like in your mind make the open door frame one, but call it frame zero, but have the door open on key 1 from game start.
Probably only good for one round after it's forced to go to zero.

I always get lost on this theory of mine so I just FEEL things can be done in a sneaky way.
Binary Space Partitioning
User avatar
UnrealWarrior
Average
Posts: 64
Joined: Sun May 31, 2020 10:07 pm

Re: Can Movers move from key to another then immediately goes back to the first key?

Post by UnrealWarrior »

Alien3674 wrote: Thu Nov 23, 2023 11:25 pm The ConstantLoop state from Unreal 227.
Can be used by adding a MyLevel package to the level, or as a separate package.
The code is checked for UT469c.

Code: Select all

class ConstantUTMover expands Mover;

state() ConstantLoop
{
Ignores UnTrigger, Trigger;

	function DoOpen()
	{
		local byte i;
		
		if (bOpening)
		{
			i = KeyNum + 1;
			if (i >= NumKeys)
			  i = 0;
			PlaySound(OpeningSound);
		}
		else
		{
			i = PrevKeyNum;
			bOpening = true;
			PlaySound(ClosingSound);
		}
		bDelaying = false;
		InterpolateTo(i, MoveTime);
		AmbientSound = MoveAmbientSound;
	}
	function InterpolateEnd(actor Other)
	{
		if (StayOpenTime > 0.f)
			AmbientSound = None;
	}
	function BeginState()
	{
		if (OtherTime == 0.f)
			OtherTime = 1.f;
		bOpening = true;
	}
	function MakeGroupStop()
	{
//stop moving immediately
		bOpening = false;
		AmbientSound = None;
		PlaySound(OpenedSound, SLOT_None);
		GotoState('', 'Close');

		if (Follower != None)
			Follower.MakeGroupStop();
	}
	function MakeGroupReturn()
	{
//Abort move and reverse course
		bOpening = false;
		bInterpolating = false;
		GotoState('', 'Open');

		if (Follower != None)
			Follower.MakeGroupReturn();
	}

Begin:
	DoOpen();
	FinishInterpolation();
	FinishedOpening();
	Sleep(StayOpenTime);
	GoTo'Begin';//loop forever
Open:
	GoTo'Begin';
Close:
	Sleep(OtherTime);
	GoTo'Begin';
}

defaultproperties
{
	InitialState="ConstantLoop"
}
To be used in MyLevel, you need to delete the top row and the defaultproperties block.
Even though I have little bit of knowledge when it comes to programming, I never got into UnrealScript unfortunately. BeyondUnreal looks like a good start but what editor do you guys use?

@Red_Fist The only I think it can be done (at least in my case) is to put "two doors" and whenever the mover goes back, the doors close, as
if a new box is in the line but no one can see that one annoying frame of the mover going back.

I didn't quite get what you meant but I'd rather move on because I can spend days on it without doing anything productive. Best way like you said is to fake it, like I said above, creating these doors will prevent the player from seeing these boxes going back.

Thanks guys :)
"We have nothing to fear but fear of tigers"

~tiger attack survivor
User avatar
Alien3674
Novice
Posts: 7
Joined: Tue Nov 21, 2023 6:15 pm

Re: Can Movers move from key to another then immediately goes back to the first key?

Post by Alien3674 »

UnrealWarrior wrote: Mon Nov 27, 2023 10:46 pmEven though I have little bit of knowledge when it comes to programming, I never got into UnrealScript unfortunately. BeyondUnreal looks like a good start but what editor do you guys use?
I use a VSCode editor with the UnrealScript extension.
Try to do this: open my test level in the editor with a ready-made movie, open your level without doing anything here.
This script should be available in it, right-click on Add Moder Brush and ConstantUTMover and my test level should be available in this list.
Add a mover and save your level, as long as this mover is present at the level, then the script will remain stored in the level.
But before that, make a backup of your level.
User avatar
UnrealWarrior
Average
Posts: 64
Joined: Sun May 31, 2020 10:07 pm

Re: Can Movers move from key to another then immediately goes back to the first key?

Post by UnrealWarrior »

Alien3674 wrote: Tue Nov 28, 2023 8:04 pm
UnrealWarrior wrote: Mon Nov 27, 2023 10:46 pmEven though I have little bit of knowledge when it comes to programming, I never got into UnrealScript unfortunately. BeyondUnreal looks like a good start but what editor do you guys use?
I use a VSCode editor with the UnrealScript extension.
Try to do this: open my test level in the editor with a ready-made movie, open your level without doing anything here.
This script should be available in it, right-click on Add Moder Brush and ConstantUTMover and my test level should be available in this list.
Add a mover and save your level, as long as this mover is present at the level, then the script will remain stored in the level.
But before that, make a backup of your level.
Nice! Just what I needed! Thank you! This is gonna make a lot easier :D
"We have nothing to fear but fear of tigers"

~tiger attack survivor