DYNAMO Posted July 30, 2013 Share Posted July 30, 2013 function createTheElevator () Elevator = createObject ( 3885, 1525.546875, -1352.9073486328, 328.25183105469, 0 , 0 , 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheElevator ) function moveElevator ( ) moveObject ( Elevator, 6000, -3252.2414550781, 699.95812988281, 118.09313201904, 0 , 0 , 0 ) setTimer ( movingElevatorBack, 20000, 1 ) end addCommandHandler("swat3",moveElevator) Link to comment
iMr.3a[Z]eF Posted July 30, 2013 Share Posted July 30, 2013 What points are you talking about? Link to comment
papam77 Posted July 30, 2013 Share Posted July 30, 2013 He mean Floor 1, Floor 2 and Floor 3 Elevator with 3 Floors and every Floor any other Y Link to comment
Baseplate Posted July 30, 2013 Share Posted July 30, 2013 Yeah, try using setElementData and getElementData.. Link to comment
iMr.3a[Z]eF Posted July 30, 2013 Share Posted July 30, 2013 setElementData?, he have just to use setElementPosition for z coordinate. Link to comment
Baseplate Posted July 30, 2013 Share Posted July 30, 2013 Yes, setElementData, when it reachs certain level, it sets the elevator element data, then it will go to the next level and so on. Link to comment
PaiN^ Posted July 30, 2013 Share Posted July 30, 2013 @ abxf : I don't think that element data is the best way to do it . @ iMr.3a[Z]eF : Why use "setElementPosition" while you have "moveObject" ? @ DYNAMO : Not tested, But Try this : local Elevator = createObject( 3885, 1525.546875, -1352.9073486328, 328.25183105469, 0 , 0 , 0 ) local level = 0 local levels = { [ 0 ] = { x, y, z }, [ 1 ] = { x, y, z }, [ 2 ] = { x, y, z } } function checkTheLevel( ) if level and tonumber( level ) then if level >= #levels - 1 then level = 0 else level = level + 1 end return level end return false end function moveElevator( ) local nextLevel = checkTheLevel( ) if nextLevel then local x, y, z = unpack( levels[ nextLevel ] ) moveObject( Elevator, 6000, x, y, z ) end end addCommandHandler( "swat3", moveElevator ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now