Teleporting to a 3D floor - and back

Ask about mapping, UDMF, using DoomBuilder/editor of choice, etc, here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
PixelWAD
Posts: 188
Joined: Sun Jun 10, 2018 7:01 pm

Teleporting to a 3D floor - and back

Post by PixelWAD »

So I got a grip on how to use a teleport destination thing together with sector tags etc. It does work both ways. However, I can't get to teleport to a 3D floor, I always spawn at the bottom of the map.

What is the easiest way to point final destination? My thing is already located in the right place, but I get teleported to the bottom.
User avatar
Enjay
 
 
Posts: 26571
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Teleporting to a 3D floor - and back

Post by Enjay »

Try using a thing type 9044 - a teleport landing that does not respond to gravity, so it will stay at whatever height you set it.

[wiki]Classes:TeleportDest2[/wiki]

[edit] Or I think that you could use a type 9043, place it above the 3D floor and it will fall on to it when the maps starts.

[wiki]Classes:TeleportDest3[/wiki] [/edit]
PixelWAD
Posts: 188
Joined: Sun Jun 10, 2018 7:01 pm

Re: Teleporting to a 3D floor - and back

Post by PixelWAD »

Thank you, that did the trick, but now the teleport is functioning at all heights, despite me setting the thing on the top floor only.
I tried it with both 9043 and 9044 but the result is still the same.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49182
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Teleporting to a 3D floor - and back

Post by Graf Zahl »

The teleport is controlled by the linedef and that covers the full height of the containing sector. You will have to add some scripted height checks to limit it to the floor you want it to.
User avatar
Enjay
 
 
Posts: 26571
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Teleporting to a 3D floor - and back

Post by Enjay »

Example attached.

The teleporters at the sides of the room are just regular ones. The ones on the platforms use a script to check that the player is above height 120. If he is, the teleport happens, if he isn't, the teleport does not happen. So, you can only teleport of you are above the 3D floors. If you walk under the floors, you will not teleport (the script runs, but the height conditions are not met, so the teleport never happens.

Code: Select all

Script 1 (void)
{
	if(GetActorZ(0) > 120.0)
	{
	Teleport (2);
	}
}
If you had a many-floored structure with the teleports on one of the floors in the middle, you would probably need to have your script make sure that the player is above a certain lower height and below a certain upper height before doing the teleport, but the principle is the same.
PixelWAD
Posts: 188
Joined: Sun Jun 10, 2018 7:01 pm

Re: Teleporting to a 3D floor - and back

Post by PixelWAD »

Thank you. I'm going to have a look.
PixelWAD
Posts: 188
Joined: Sun Jun 10, 2018 7:01 pm

Re: Teleporting to a 3D floor - and back

Post by PixelWAD »

I don't really get how it's done. I have multiple 3D floors and I get lost in all the numbers now.
I have 2 teleports that don't work as they should, would you mind having a look at my map file?

I was able to figure out pretty much everything else, but this still remains a mystery to me how to use it properly.
Builder_2018-08-12_20-02-40.jpg
Builder_2018-08-12_20-02-32.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
Enjay
 
 
Posts: 26571
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Teleporting to a 3D floor - and back

Post by Enjay »

PixelWAD wrote:I don't really get how it's done. I have multiple 3D floors and I get lost in all the numbers now.
Did you look at the example I posted?

Basically, you do not use a teleport line, you use a script. So, don't make the activation line a type 70, make it a type 80 and set it to run whatever script number is the correct one in your own ACS code.

The script should check the height of the actor who started the script and, if the actor is within a suitable height range, it would also run the teleport command. If the actor is outwith the suitable height range, the teleport part is skipped over and the script just finishes with no teleport happening.

In plain English, the script I posted reads:
If the activator of the script (typically the player) is at a height greater than 120, teleport him to the teleport landing with tid #2.

If you have multiple floors, you might want something more like:
If the activator is at a height greater than 120 and less than 256, teleport him to the teleport landing with tid #2.

That might look something a bit like this:

Code: Select all

Script 1 (void)
{
   if(GetActorZ(0) > 120.0 && GetActorZ(0) < 256.0)
   {
   Teleport (2);
   }
}
There really aren't that many numbers. ;)

I did already download you map from the other thread that you posted about the under water base (or whatever) it in but I was a little confused by the map and what you were looking for, so I didn't reply.
PixelWAD
Posts: 188
Joined: Sun Jun 10, 2018 7:01 pm

Re: Teleporting to a 3D floor - and back

Post by PixelWAD »

Partial success!
I have made my script look like this:

Code: Select all

Script 3 (void)
{
   if(GetActorZ(0) > -62.0 && GetActorZ(0) < 8.0)
   {
   Teleport (34);
   }
}

Script 4 (void)
{
   if(GetActorZ(0) > 120.0 && GetActorZ(0) < 184.0)
   {
   Teleport (8);
   }
}
The teleport works as desired, but only one way.

I have followed your example wad in gzdoom builder, and to my eye, it looks everything is proper. Obviously is not. I'll keep on trying!
User avatar
Enjay
 
 
Posts: 26571
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Teleporting to a 3D floor - and back

Post by Enjay »

How do you mean "but only one way"? You mean that you can only get to one of the teleport spots, or it only works once or...?
PixelWAD
Posts: 188
Joined: Sun Jun 10, 2018 7:01 pm

Re: Teleporting to a 3D floor - and back

Post by PixelWAD »

Success! I have somehow managed to get it to work.
One of the problems was my bottom height - it had to be actually a little longer than I wanted to in order to get triggered each time.

THANKS A LOT!
User avatar
Enjay
 
 
Posts: 26571
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Teleporting to a 3D floor - and back

Post by Enjay »

Glad you got it working. :)

I'm pretty sure the height of the player obtained from GetActorZ is the height of his feet so if the player was standing on a floor of height 128 and you used >128, that means greater than 128 - i.e. 129 and above. So, if the player is standing on the floor, he's not high up enough to trigger the teleport. Could that be what the problem was?

You'll notice in my example, the big squares have a floor height of 128 and the teleport pad itself is 136 but I used 120 as my check height (which is actually inside the 3D floor and unreachable. So, if the player is on that floor he's definitely above 120.

Of course, you could use >= (greater than or equal to) and <= instead of just > and < and that would include the value in the script.
PixelWAD
Posts: 188
Joined: Sun Jun 10, 2018 7:01 pm

Re: Teleporting to a 3D floor - and back

Post by PixelWAD »

Yes, that was the problem + my messed up tags. My map shall be ready to publish somewhat soon!

Return to “Mapping”