Jump to content

Elevator


Recommended Posts

Posted

Hello,

I tried creating an object that moves repeatedly apparently when I debug it and compile it on the test server the elevator does not move. It just stays frozen.

My script

local elevator = createObject ( 971, 3226.3999023438, -2897.3999023438, 15.60000038147, 89.249816894531, 180, 231.75024414063 ) 
i=0 
function () 
while i!=-1 do 
moveObject(elevator, 10000, 3226.3999023438, -2897.3999023438, 29.60000038147, 89.249816894531, 180, 231.75024414063 ) 
setTimer (moveObject, 10000, 1, elevator, 1000, 3226.3999023438, -2897.3999023438, 15.60000038147 ) 
end 
end 

P.S Was not sure for the while i integer. In Java it would work. My point was to loop the script until the map stops

Please let me know If I did something wrong with placing coordinates or something other

Here are original unedited coordinates

Elevator Down:

Elevator Up:

Thanks!

Posted
local elevator = createObject ( 971, 3226.3999023438, -2897.3999023438, 15.60000038147, 89.249816894531, 180, 231.75024414063 ) 
moveObject ( elevator, 10000, 3226.3999023438, -2897.3999023438, 29.60000038147, 89.249816894531, 180, 231.75024414063 ) 
setTimer ( moveObject, 10000, 1, elevator, 1000, 3226.3999023438, -2897.3999023438, 15.60000038147 ) 

There's no need for a "while".

Posted

Thanks for replying!

It works perfectly but the only issue is that it does move up and down once instead I wanted it to move up-down until the end of the map

Posted

What do you mean by "end of the map"? do you mean like until round ends? if so, just put that script inside your map folder and it'll stop when the map changes.

Posted

I did try but it only moves 1 time and then becames frozen

Also I have found another issue. When it starts move up it rotates automatic in a random coordinate, I'm pretty sure the rotation coordinates I wrote were correct since I deleted and rewrited the coordinates again after seeing it was bugged.

I recorded what exactly happens ( Also shows that it stucks )

Posted
  
local elevator = createObject ( 971, 3226.3999023438, -2897.3999023438, 15.60000038147, 89.249816894531, 180, 231.75024414063 ) 
moveObject ( elevator, 10000, 3226.3999023438, -2897.3999023438, 29.60000038147 ) -- the last three arguments were causing the rotation problem 
setTimer ( moveObject, 10000, 1, elevator, 1000, 3226.3999023438, -2897.3999023438, 15.60000038147 ) 
  

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...