Tonnzza Posted October 14, 2014 Posted October 14, 2014 I'm trying to do the gate. What is wrong with this code? --gate-- gate1 = createObject(980, -1980.5789794922, 283.62588500977, 37, 0,0,90) gate2 = createObject(980, -1980.5789794922, 293.22588500977, 37, 0,0,90) -- Markers -- hitMarker1 = createMarker(-1985.8018798828, 288.45, 33.54, 'cylinder', 3, 255, 0, 0, 150) hitMarker2 = createMarker(-1976.7435302734, 288.45, 33.54, 'cylinder', 3, 255, 0, 0, 150) function moveGateUpA( hitElement, matchingDimension ) moveObject(gate1, 5000, -1980.5789794922, 283.62588500977, 40, 0,0,90) end addEventHandler( "onMarkerHit", hitMarker1, moveGateUpA ) function moveGateDownA( leaveElement, matchingDimension ) setTimer ( timerReady, 10000, 1 ) end addEventHandler( "onMarkerLeave", hitMarker1, moveGateDownA ) function timerReady() moveObject(gate1, 5000, -1980.5789794922, 283.62588500977, 37, 0,0,90) end addEventHandler( "onMarkerLeave", hitMarker1) function moveGateUpB( hitElement, matchingDimension) moveObject(gate2, 5000, -1980.5789794922, 293.22588500977, 40, 0,0,90) end addEventHandler( "onMarkerHit", hitMarker2, moveGateUpB ) function moveGateDownB( leaveElement, matchingDimension ) setTimer ( timerReady, 10000, 1 ) end addEventHandler( "onMarkerLeave", hitMarker2, moveGateDownB ) function timerReady() moveObject(gate2, 5000, -1980.5789794922, 293.22588500977, 37, 0,0,90) end addEventHandler( "onMarkerLeave", hitMarker2)
Anubhav Posted October 14, 2014 Posted October 14, 2014 I belive, moveObject's rotation's are bugged. I was fixing it, it goes on other rotation. o_O is it! Then without rotation arguments worked fine! --gate-- gate1 = createObject(980, -1980.5789794922, 283.62588500977, 37, 0,0,90) gate2 = createObject(980, -1980.5789794922, 293.22588500977, 37, 0,0,90) -- Markers -- hitMarker1 = createMarker(-1985.8018798828, 288.45, 33.54, 'cylinder', 3, 255, 0, 0, 150) hitMarker2 = createMarker(-1976.7435302734, 288.45, 33.54, 'cylinder', 3, 255, 0, 0, 150) function moveGateUpA( hitElement, matchingDimension ) local x1, y1 = getElementPosition( gate1 ) local x, y = getElementPosition( gate2 ) moveObject( gate1, 5000, x1, y1, 40) moveObject( gate2, 5000, x, y, 40) outputChatBox("You moved the gate!") end addEventHandler( "onMarkerHit", hitMarker1, moveGateUpA ) function timerReady(s) local x, y = getElementPosition( gate1 ) local x2, y2 = getElementPosition ( gate2 ) outputChatBox("You moved the gate!") moveObject(gate1, 5000, x, y, 37 ) moveObject(gate2, 5000, x2, y2, 37 ) end function moveGateDownA( leaveElement, matchingDimension ) setTimer ( timerReady, 10000, 1, source ) end addEventHandler( "onMarkerLeave", hitMarker2, moveGateDownA )
Anubhav Posted October 14, 2014 Posted October 14, 2014 Not working? Are you seeing dreams? I tested it, IT WORKS 100%!
Tonnzza Posted October 14, 2014 Author Posted October 14, 2014 Oh now it's working. the fault was in meta.xml. Thx.
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