wrenchman82
Member
Hi All,
I'm currently using the following script to make an enemy boss teleport around as a special move. The boss is flying, so the y position is always 40.
This works ok most of the time, but sometimes the enemy appears to teleport off the screen borders, and this results in a weird bug where it gains a Y position that is basically infinite and off map, and just stays frozen wherever it is it lands.
Any ideas? From the iRx and iRz values, that shouldn't happen I think.
Thanks
I'm currently using the following script to make an enemy boss teleport around as a special move. The boss is flying, so the y position is always 40.
Code:
@script
void self = getlocalvar("self");
int Screen = openborvariant("hResolution"); // Get screen width
int Width = openborvariant("PLAYER_MAX_Z") - openborvariant("PLAYER_MIN_Z"); // Get width
int XPos = openborvariant("xpos"); //Get screen edge's position
int iRx = rand()%(Screen/2) + Screen/2 ;
int iRz = rand()%(Width/2) + Width/2 ;
int iRy = 40 ;
if(frame==15){
changeentityproperty(self, "position", iRx + XPos, iRz + openborvariant("PLAYER_MIN_Z"), iRy);
}
@end_script
This works ok most of the time, but sometimes the enemy appears to teleport off the screen borders, and this results in a weird bug where it gains a Y position that is basically infinite and off map, and just stays frozen wherever it is it lands.
Any ideas? From the iRx and iRz values, that shouldn't happen I think.
Thanks
Last edited: