• All, I am currently in the process of migrating domain registrations. During this time there may be some intermittent outages or slowdowns. Please contact staff if you have any questions.

teleporting bug

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.

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:
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.

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

I'll need to test to make sure, but on first sight it looks OK. Probably an issue with stage interaction. We'd need to see a video example and some level text to know for certain.

DC
 
Yep; you're right. I tried it on a variety of open maps and it's fine. There's one level that has a wall on one side that slightly limits the range.
Good to know I'm not losing my mind. Thanks!
 
Back
Top Bottom