My teleport isn't always accurate.

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.
User avatar
Enjay
 
 
Posts: 26539
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

My teleport isn't always accurate.

Post by Enjay »

Can anyone suggest a reason why this might be happening?

I am using Teleport_NoFog in a script and 99% of the time it works as intended - the player teleports to a teleport destination and the script does some other stuff.

However, occasionally, it doesn't quite work - the player teleports to a location near, but not exactly on the teleport landing spot - somewhere within, I guess, a 192 map unit radius of the spot.

I have checked and checked - there is nothing else on the map with the same tid as the teleport landing and there aren't even any other actors particularly near the teleport landing.

The script really is nothing special:

Code: Select all

script 412 (void)
{
    //an attempt to fix the teleport inaccuracy 
    Thing_Stop(0);

    //clear messages
    hudmessagebold (s:""; HUDMSG_PLAIN, 43, CR_RED, 320.4, 340.0, 5.0);
    hudmessage (s:""; HUDMSG_PLAIN, 44, CR_RED, 320.4, 340.0, 5.0);

    FadeTo (0, 0, 0, 1.0, 0.5);

    delay(18);

    SetHUDSize (640, 480, 0);
    hudmessagebold (s:"P r e s s   [ u s e ]  t o  b e g i n.";
        HUDMSG_PLAIN, 2, CR_GRAY, 320.4, 440.0, 0.0);

    Teleport_NoFog (16, 1, 0);

    fadeto (0, 0, 0, 0.0, 0.5);
}
It is activated by the player crossing a line and I have set the line to trigger from the front side only because I know that teleports in scripts can fail if the line is activated from the back.

Since the above, I have resorted to putting duplicate teleport instructions into the script separated by 1 tic. so far I have always ended up at the exact destination when running that modification - but the script had been working most of the time (the 99% that I mentioned actually seems about right) so it could just be that I haven't triggered the problem.

The only thing I can think of is that the teleport carries the player quite a long distance across the map but I don't really see why that should affect things. The map gets a clean bill of health from UDB's error checker and I can't see anything wrong with it anywhere. It's not even a particularly complicated map.

Return to “Mapping”