Jump to content

Gate Object


GerardWay

Recommended Posts

Hey guys, the problem here is that the gate appears, but does not move when I enter the marker.

Any help please?

function gateCreate() 
gate1 = createObject (980, 135.19921875, 1943.19921875, 21.39999961853, 0, 0, 0) 
end 
addEventHandler ("onResourceStart", resourceRoot, gateCreate) 
  
function markerCreate() 
marker1 = createMarker (136, 1943.2998046875, 17.799999237061, 'Cylinder', 25, 0, 0, 0, 0) 
end 
addEventHandler ("onResourceStart", resourceRoot, markerCreate) 
  
function gateMove(thePlayer, hitElement) 
if source == marker1 then 
moveObject (gate1, 135.19999694824, 1943.1999511719, 27.200000762939) 
end 
end 
addEventHandler ("onMarkerHit", getRootElement(), gateMove) 
  
function gateBack(thePlayer, hitElement) 
if source == marker1 then 
moveObject (gate1, 135.19921875, 1943.19921875, 21.39999961853) 
end 
end 
addEventHandler ("onMarkerLeave", getRootElement(), gateBack) 

Link to comment

That's because you forgot to specify the time argument at moveObject.

function gateCreate ( ) 
    gate1 = createObject ( 980, 135.19921875, 1943.19921875, 21.39999961853, 0, 0, 0 ) 
    marker1 = createMarker ( 136, 1943.2998046875, 17.799999237061, 'cylinder', 25, 0, 0, 0, 0 ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, gateCreate ) 
  
function gateMove ( hitElement ) 
    if ( source == marker1 ) then 
        moveObject ( gate1, 2000, 135.19999694824, 1943.1999511719, 27.200000762939 ) 
    end 
end 
addEventHandler ( "onMarkerHit", getRootElement(), gateMove ) 
  
function gateBack ( hitElement ) 
    if ( source == marker1 ) then 
        moveObject ( gate1, 2000, 135.19921875, 1943.19921875, 21.39999961853 ) 
    end 
end 
addEventHandler ( "onMarkerLeave", getRootElement(), gateBack ) 

Link to comment

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