using teleports stacked with 3D floors-how?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
exaca18det
Posts: 5
Joined: Tue Dec 24, 2013 4:00 am

using teleports stacked with 3D floors-how?

Post by exaca18det »

Ok, here's my delima: I have a structure with multiple floors using 3d floors. each floor has a teleporter in the middle of the floor. Since using linedefs or actor enter sector things isnt really applicable for this, I thought of having a teleport orb generator thing that A_spawnitemex the orb thing that once picked up will teleport you accordingly. I have the two actors in decorate and can make the orb teleport the player, but not using the TID of the generator. I would like to assign a TID to the generator you place in the map, then a teleport destination with the the TID of the generator+1. For example, if I place a generator with a TID of 200, then place a teleport destination with a TID of 201, then all the player has to do is touch one of the generated orbs to teleport. Am I going about this problem incorrectly cause I cannot figure it out?

In decorate The orb actor has a spawn and pickup state and no use state so that it will automatically activate upon touching it. Then the pickup state calls acs_execute to teleport the player, but I cannot get the TID of the generator to be used in this script. I've looked on the wiki and here in the forums and just can't find the answer I need! Anyone know what I'm missing? Or a better way to do this? Thank you
User avatar
Enjay
 
 
Posts: 27140
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: using teleports stacked with 3D floors-how?

Post by Enjay »

You can use [wiki]GetActorZ[/wiki] to find the height that the player is at when he activates a script and then teleport him to the correct location based on the result of which height range he is in. Here's one that I use to ensure that a script isn't activated from the wrong height:

Code: Select all

if(GetActorZ(0) < 96.0)  //so player can't use the switch from above
	{
		do stuff();
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: using teleports stacked with 3D floors-how?

Post by cocka »

Since using linedefs or actor enter sector things isnt really applicable for this
Why not? It can be solved easily.

What I haven't understood here is, upon what depends on which floor the player will be teleported?
exaca18det
Posts: 5
Joined: Tue Dec 24, 2013 4:00 am

Re: using teleports stacked with 3D floors-how?

Post by exaca18det »

enjay - yes that would work, but is there a way to make it more flexible? meaning applicable to any map you want to use this on without having to structure your map around the script. that's why I was thinking the custom inventory reading a TID or something from the generator to "transfer/translate" into the objective teleport destination tag.
I can use that getactorz to get a script to run using an actor enter or linedef crossing as the activator, but it would be very handy instead of having to know z heights on everything to just place a thing on the map, slap a TID to it and let the TID or argument or code pointer or something tell the script/decorate where to teleport.

cocka - the player would travel to the teleporters on each level, then get teleported elsewhere in the map

sorry guys, forgot to mention how flexible i would like the code... thanks for your responses!
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49238
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: using teleports stacked with 3D floors-how?

Post by Graf Zahl »

No. All you propose is a hack. Hacks tend to break sooner or later. Enjay's method is really the only reliable way to make height sensitive triggers.
exaca18det
Posts: 5
Joined: Tue Dec 24, 2013 4:00 am

Re: using teleports stacked with 3D floors-how?

Post by exaca18det »

Graf - ya it is a backwards way of going about it, and i'm sure there's a few ways of doing it, but like you say, its a hackjob where it's not absolutely needed...
exaca18det
Posts: 5
Joined: Tue Dec 24, 2013 4:00 am

Re: using teleports stacked with 3D floors-how?

Post by exaca18det »

so using enjay's method of getactorz does work just fine, but you have to make sure you bit shift. I was at first only able to get one z reading to work right, the one at zero. any other height was not working at all, so then I recalled fixed and grid units and how they are completely different. when you use getactor for an axis, it outputs to fixed units and NOT grid units. so when using the if statement and not putting in the bit convertion nothing works right. example:

if(getactorz(0)>=200)
{do stuff}
if(getactorz(0)>=300)
{do otherstuff}

the above code will only perform the otherstuff and not stuff, even if z height is between 200 and 300. this is due to fixed units

if(getactorz(0)>=(200<<16))
{do stuff}
if(getactorz(0)>=(300<<16))
{do otherstuff}

this code will do what is needed.

enjay - will your code work with the decimal point (96.0) the same way as bit convertioning? in other words putting the number with a decimal make the code read it as a fixed value?
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: using teleports stacked with 3D floors-how?

Post by cocka »

in other words putting the number with a decimal make the code read it as a fixed value?
Yes. Example: 4.0 means 4*65536 or 4 >> 16
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: using teleports stacked with 3D floors-how?

Post by Gez »

A small problem with using scripted lines is that they will not be teleporter-colored on the automap. You might not care about that at all, of course; but if you do a workaround is possible. Make a normal teleport, but give a line ID to its lines. Use [wiki=Classes:SecActEnter]this[/wiki] in the surrounding sector. Make it run a script that uses [wiki]SetLineSpecial[/wiki] to change the [wiki]teleport[/wiki] lines' destination, depending on the player's vertical position.

This, however, is not compatible with multiplayer.
User avatar
edward850
Posts: 5890
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: using teleports stacked with 3D floors-how?

Post by edward850 »

cocka wrote:4 >> 16
4 << 16.
4 >> 16 is 0. ;)
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

Re: using teleports stacked with 3D floors-how?

Post by cocka »

:lol: Misspelled

I meant shifting to the left. :)
exaca18det
Posts: 5
Joined: Tue Dec 24, 2013 4:00 am

Re: using teleports stacked with 3D floors-how?

Post by exaca18det »

Thanks for your help everyone.

Gez - another workaround to the linedef not showing up correctly on the automap could be to create another teleporter inside of the original one that is a "dummy" teleport. this one would show up on the map and who care where it teleports since you can't get to it. maybe either 4 or 8 grid units smaller and the linedefs facing inward. Then make your actual teleporter linedefs not seen on automap and problem solved, and works on multiplayer :)
Locked

Return to “Editing (Archive)”