@John
here are two examples of what I use, stopped using animated completely.
I'm also likely to swap the code into being controlled by types, take up less space, and will change the code to test distance from door first, then do further checks if distance is within range
So whilst there is a little more code in the method i have decided on, there is now only one mesh per door, and setting it up is a lot easier
here are two examples of what I use, stopped using animated completely.
Global doorguard7 = LoadMesh(dirpath$ + "MilkShape mods\DoormsAnim.b3d", level) Global stonegateL = LoadMesh (dirpath$ + "B3D\Stone Door Left.b3d", level); is also a Right door as well ; setup guard door 7 ScaleEntity doorguard7, 7.35, 11.48, 10.5 PositionEntity doorguard7, -5646.98, 783.59, 3509.94 EntityPickMode doorguard7, 2, False RotateEntity doorguard7, 0, -90, 0 ; setup stone door keep PositionEntity stonegateL, -4608.09, 1087.2, -1120.0 EntityPickMode stonegateL, 2, False PositionEntity stonegateR, -4608.09, 1087.2, -1120.0 EntityPickMode stonegateR, 2, False ; * * * * * * * * * mouse open closes STONE Gates * * * * * * * * * If MouseLeft And ( (CameraPick( Camera , MouseX(), MouseY() ) = stonegateL) Or (CameraPick( Camera , MouseX(), MouseY() ) = stonegateR) ); open If opening4 = False And open4 = False And closing4 = False And ( (EntityDistance( playerbox , stonegateL ) < 20.01) Or (EntityDistance( playerbox , stonegateR ) < 20.01) ) doordelaytime4 = Millisecs() opening4 = True : open4 = False : closing4 = False EndIf EndIf If MouseLeft And ( (CameraPick( Camera , MouseX(), MouseY() ) = stonegateL) Or (CameraPick( Camera , MouseX(), MouseY() ) = stonegateR) ) ; close If opening4 = False And Open4 = True And closing4 = False And ( (EntityDistance( playerbox , stonegateL ) < 20.01) Or (EntityDistance( playerbox , stonegateR ) < 20.01) ) open4 = False : opening4 = False : closing4 = true EndIf EndIf ;makes sure animation has finished before allowing another action ; open if open4 = False And opening4 = True And closing4 = False gateup4 = gateup4 - 4 : gateup4b = gateup4b + 4 if gateup4 < - 255 then gateup4 = -256 : gateup4b = 255 : opening4 = False : open4 = True : closing3 = False PositionEntity stonegateL, -4608.09 + gateup4, 1087.2, -1120.0 PositionEntity stonegateR, -4608.09 + gateup4b, 1087.2, -1120.0 endif ; timed close if opening4 = False And Open4 = True And closing4 = False And Millisecs() > (doordelaytime4 + dooropenfor) gateup4 = gateup4 + 4 : gateup4b = gateup4b - 4 if gateup4 > 0 then gateup4 = 0 : gateup4b = 0 : opening4 = False : open4 = False PositionEntity stonegateL, -4608.09 + gateup4, 1087.2, -1120.0 PositionEntity stonegateR, -4608.09 + gateup4b, 1087.2, -1120.0 endif ; close if opening4 = False And Open4 = False And closing4 = True gateup4 = gateup4 + 4 : gateup4b = gateup4b - 4 if gateup4 > 0 then gateup4 = 0 : gateup4b = 0 : opening4 = False : open4 = False : closing4 = False PositionEntity stonegateL, -4608.09 + gateup4, 1087.2, -1120.0 PositionEntity stonegateR, -4608.09 + gateup4b, 1087.2, -1120.0 endif ; ********************************************************************* ; * * * * * * * * * mouse open closes Guard Door 7 * * * * * * * * * If MouseLeft And CameraPick( Camera , MouseX(), MouseY() ) = doorguard7 If opening12 = False And open12 = False And closing12 = False And EntityDistance( playerbox , doorguard7 ) < 15.01 doordelaytime12 = Millisecs() : opening12 = true : open12 = False : closing12 = False EndIf EndIf If MouseLeft And CameraPick( Camera , MouseX(), MouseY() ) = doorguard7 If opening12 = False And Open12 = True And closing12 = False And EntityDistance( playerbox , doorguard7 ) < 15.01 open12 = False : opening12 = False : closing12 = True EndIf EndIf ;makes sure animation has finished before allowing another action ; open if open12 = False And opening12 = True And closing12 = False gateup12 = gateup12 + 5 if gateup12 > 85 then gateup12 = 85 : opening12 = False : open12 = True : closing12 = False RotateEntity doorguard7, EntityPitch(doorguard7), EntityYaw(doorguard7) + 5, 0 endif ; close If opening12 = False And Open12 = False And closing12 = True gateup12 = gateup12 - 5 if gateup12 < 0 then gateup12 = 0 : opening12 = False : open12 = False : closing12 = False RotateEntity doorguard7, EntityPitch(doorguard7), EntityYaw(doorguard7) - 5, 0 EndIf ; timed close If opening12 = False And Open12 = True And closing12 = False And Millisecs() > (doordelaytime12 + dooropenfor) gateup12 = gateup12 - 5 if gateup12 < 0 then gateup12 = 0 : opening12 = False : open12 = False : closing12 = False RotateEntity doorguard7, EntityPitch(doorguard7), EntityYaw(doorguard7) - 5, 0 EndIf ; *********************************************************************
I'm also likely to swap the code into being controlled by types, take up less space, and will change the code to test distance from door first, then do further checks if distance is within range
So whilst there is a little more code in the method i have decided on, there is now only one mesh per door, and setting it up is a lot easier