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);
}
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.