Seamless Map Transitions: Part 2

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
User avatar
ReX
Posts: 1578
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Seamless Map Transitions: Part 2

Post by ReX »

In this thread I had asked a question about seamless map transitions. I have used the suggested code there, and have had mixed results. First, a little on what I'm trying to do and how I've set it up:
  • 1. I want the player to exit Map04 and enter Map08 at the exact coordinates s/he left Map04 and facing the exact direction. [The maps are set up to have identical sectors, so that the transition will appear seamless.]
    2. I want the player to exit Map08 and enter Map04 at the exact coordinates s/he left Map08 and facing the exact direction. [This exit is not far from the entry point in Item 1, above, but I don't think that has any relevance to the problem at hand.]
    3. The maps "join" together at the same coordinates. This means that if the two maps were one, the "transition" areas on the two maps would exactly overlap.
What's happening is that when I go from Map04 to Map08, I find myself in the void in a far corner of the map. The linedef that triggers the exit script is at around (x=3972, y=9040), but I end up at (x=12632, y=9920) on Map08.

When I go from Map08 to Map04, on the other hand, I end up exactly at the proper coordinates.

First, the scripts for Map04:
Spoiler:
Now, the scripts for Map08:
Spoiler:
I'm guessing that I'm not assigning proper values to setactorposition and getactorx & getactory TIDs. On Map04 the player is playing as Player 1, argument = 0, and enters Map08 as Player 1, argument = 0. When returning from Map08 to Map04, the player enters Map08 as Player 1, argument = 1. Does this make any difference, and does it affect the way I set up my scripts?
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Seamless Map Transitions: Part 2

Post by Enjay »

Heh, I semi-had your maps in mind when I requested this:

http://forum.zdoom.org/viewtopic.php?f=18&t=25234

but, as I noted in that thread, I never really expected the request to fly.
User avatar
ReX
Posts: 1578
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Re: Seamless Map Transitions: Part 2

Post by ReX »

What you had asked for would be ideal for seamless map transitions. However, what I'm going for is a lot simpler (if only it would work properly. Heh.)
User avatar
ReX
Posts: 1578
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Re: Seamless Map Transitions: Part 2

Post by ReX »

Okay, so let me ask this same question slightly differently. One set of my scripts is working perfectly, while another set that uses the same variables is messing up. I'm guessing it has to do with the actor's ID, and I had checked the wiki for SetActorPosition and for GetActorX & Y. They specifically reference the TID of the actor, which in this case is the player, and there is no TID.

So what do getactorx(0) & getactorx(1) represent? And will these variables change when traveling one way from one map to another, and another way when traveling back?
User avatar
NeuralStunner
 
 
Posts: 12326
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Seamless Map Transitions: Part 2

Post by NeuralStunner »

ReX wrote:I'm guessing it has to do with the actor's ID, and I had checked the wiki for SetActorPosition and for GetActorX & Y. They specifically reference the TID of the actor, which in this case is the player, and there is no TID.
Not sure if a TID given to a Player is persistent or not. You'd have to set it in Enter/Respawn scripts, regardless. Player# + 1000 is a commonly used convention, I think.
ReX wrote:So what do getactorx(0) & getactorx(1) represent? And will these variables change when traveling one way from one map to another, and another way when traveling back?
Uh, no, they would work the same. :? The only argument to those is the TID of what you're checking. If you have the TID of each Player, it should be really simple. (Might want to check and set Z also, BTW.)
User avatar
Isle
Posts: 687
Joined: Fri Nov 21, 2003 1:30 am
Location: Arizona, USA

Re: Seamless Map Transitions: Part 2

Post by Isle »

well i tested the code in a pair of blank maps and it worked fine, so theres nothing wrong with the code you provided. so we need to check other parts of the maps. is there more than one thing with a tid of 1 in either map? are the map spots placed correctly? is there anything else running that messes with the player position?
User avatar
ReX
Posts: 1578
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Re: Seamless Map Transitions: Part 2

Post by ReX »

Isle wrote:is there more than one thing with a tid of 1 in either map?
Here's the thing - Map04 has several sparks that have been assigned TID = 1. But this is the map that works fine when the player teleports there from Map08.

Map08 has no things with TID = 1, and this is the map that causes a problem when the player teleports there from Map04.

So from what you're saying, it sounds like the problem will occur when teleporting to a map with multiple things with TID = 1. Does this mean that on Map04 I should find (or create) a thing with a unique TID, then use that value for getactorx(1) & getactory(1) in the lines:

Code: Select all

   int x = getactorx(0) - getactorx(1);
   int y = getactory(0) - getactory(1);

and

   setactorposition(0, getactorx(1)+x, getactory(1)+y, 0, 0);
are the map spots placed correctly?
Yes, both maps have proper player starts with proper arguments. [Unless you're asking about the script trigger - I'm using linedefs to trigger the teleport_newmap scripts, and they are both properly assigned.
is there anything else running that messes with the player position?
There's nothing that would obstuct the player's teleport destination on either map.

[EDIT: I just re-read your original post, and noticed something you said: "use acs to get the player's offset from a mapspot then use setactorposition to restore the offset". Now I understand what you were trying to say - use a fixed point (designated by an unmovable thing, such as a mapspot) as an anchor, assign it a TID = 1, then apply the code. Let me try this out, with a different TID for a mapspot.]

[EDIT2: I tried it with a mapspot assigned a TID = 100 on each map, then modified the code as follows:

Code: Select all

   int x = getactorx(0) - getactorx(100);
   int y = getactory(0) - getactory(100);

and

   setactorposition(0, getactorx(100)+x, getactory(100)+y, 0, 0);
and it works perfectly now. Many thanks.]
Locked

Return to “Editing (Archive)”