Move/slide an object up and down
This script should be attached to an activator to move the object up or down each time the activator is activated.
The activator may be the object itself.
Change the numbers for speed and max displacement to fit your needs.
Can be easily adapted to sliding sideways or a continuous movement.
scn SlidingObjectSCRIPT ref xObject short xStdSpeed short xSpeed short xMaxDisplacement float xPosZ float xPosMin float xPosMax begin onactivate if xObject == 0 ; First time only: set vars ;====================== ; xStdSpeed positive: Object will initially go up ; xStdSpeed negative: Object will initially go down ;====================== set xObject to aaqqActivator; aaqqPlatform ; aaqqPaint set xStdSpeed to 5 ; <<< Change to your liking (units per second) set xMaxDisplacement to 100 ; <<< Displacement limit set xPosZ to xObject.getstartingpos z if xStdSpeed > 0 set xPosMin to xPosZ set xPosMax to xPosZ + xMaxDisplacement else set xPosMax to xPosZ set xPosMin to xPosZ - xMaxDisplacement set xStdSpeed to -xStdSpeed endif endif if xPosZ <= xPosMin set xSpeed to xStdSpeed else set xSpeed to -xStdSpeed endif end begin gamemode if xSpeed == 0 return endif set xPosZ to xObject.getpos Z + xSpeed * getsecondspassed if xPosZ > xPosMax set xPosZ to xPosMax set xSpeed to 0 endif if xPosZ < xPosMin set xPosZ to xPosMin set xSpeed to 0 endif xObject.setpos Z xPosZ xObject.reset3Dstate end