Jump to content

help me elevator script (moveObject)


SandroNL

Recommended Posts

Posted (edited)

hi,

i have scripted a elevator for race but if i go on it i go in the object how i can fix it ?????

here movie on youtube :

here the script :

--lift
 
function platformstart0 ()
setTimer ( platformstart1, 20000, 1 )
-- obj create
obj = createObject ( 14548, 3618.4912109375, -1531.7802734375, 73.440940856934, 0.0, 0.0, 242.88586425781 )
end
addEventHandler ( "onResourceStart", getRootElement(), platformstart0 )
 
--naar benede
function platformstart1 ()
moveObject ( obj, 14548, 3618.4912109375, -1531.7802734375, 206.9638671875 )
setTimer ( platformstart2, 20000, 1)
end
 
--naar boven
function platformstart2 ()
moveObject ( obj, 14548, 3618.4912109375, -1531.7802734375, 73.440940856934 )
setTimer ( platformstart1, 20000, 1)
end
 
 
-- vuur 
 
 
createFire (3226.576171875, -1374.0059814453, 4.2633757591248, 5)
createFire (3226.4548339844, -1355.01538085, 4.7059955596924, 5)

Edited by Guest
Posted

To me it looks like your elevator moves too fast. You can see the fire only when it's created close to you (streamed in).

Posted (edited)
moveObject ( obj, 14548, 3618.4912109375, -1531.7802734375, 206.9638671875 )

14548 is the speed ( i think )

NO its ID *

Edited by Guest
Posted
moveObject ( obj, 14548, 3618.4912109375, -1531.7802734375, 206.9638671875 )

14548 is the speed ( i think )

NO its ID *

It's speed (time)!

You don't have ID here, cause you are not creating object here.

obj is your object...

Posted

Fire can only be created when the position is streamed. Here are two alternatives.

Create fire on stream:

addEventHandler ( "onClientElementStreamIn", getRootElement (),
       function ( )
               if ( source == [i]streamed_in_object_goes_here[/i] ) then
                       createFire (3226.576171875, -1374.0059814453, 4.2633757591248, 5)
                       createFire (3226.4548339844, -1355.01538085, 4.7059955596924, 5)
               end
       end
)

Create an invisible torch, with fire fx. Limited flame size though :

_createFire = createFire -- MTA's createFire function transferred to _createFire
function createFire ( x, y, z, rx, ry, rz )
       local tempObj = createObject ( 3461, x, y, z - 2.5, rx, ry, rz )
       setElementAlpha( tempObj, 0 )
       setElementCollisionsEnabled ( tempObj, false )
       return tempObj -- returns an object, so it's deletable by destroyElement
end

They're untested, but should work.

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...