I've been using this teleporting function I found in another topic here for a ghosted Wizzrobe and it teleports fine... until it hangs the game.
The script will usually run for some time before it hangs the game, usually when Link is at an angle away from the Wizzrobe.
void teleport(npc ghost){
int teleX;
int teleY;
bool reroll = true;
while(reroll){
teleX = GridX(Rand(32,224));
teleY = GridY(Rand(32,112));
TraceB(reroll);
reroll = false;
if(Screen->isSolid(teleX,teleY) || Abs(teleX - Link->X) < 48 || Abs(teleY - Link->Y) < 48){
reroll = true;
}
}
Ghost_X = teleX;
Ghost_Y = teleY;
}
I made some edits and I found exactly this section of code to be the culprit, as when removed, stops the crashes:
Abs(teleX - Link->X) < 48 || Abs(teleY - Link->Y) < 48
However, removing this also allows the Wizzrobes to teleport close to Link or sometimes even right on top of him.
Can somebody help?

