Jump to content

Movable gate problem! HELP!


Dzsipszi

Recommended Posts

Someone tell me this script works

   phq1 = createObject ( 968, 1544.699, -1630.798, 13.100, 0, 88.9, 90 ) 
   phq1col = createColCircle ( 1542.699, -1630.798, 13.100, 7 ) 
    
function openphq1(thePlayer) 
if getElementModel( thePlayer ) == 0 then 
       moveObject (phq1, 968, 1544.699, -1630.798, 13.100, 0, 0, 90 ) 
end 
end 
addEventHandler( "onColShapeHit", phq1col, openphq1 ) 
  
function closephq1(thePlayer) 
if getElementModel( thePlayer ) == 0 then 
       moveObject (phq1, 968, 1544.699, -1630.798, 13.100, 0, 88.9, 90 ) 
end 
end 
addEventHandler( "onColShapeLeave", phq1col, closephq1 ) 

Hmm, i think he is lie check this out:

https://www.youtube.com/watch?v=-aWLZ2NyFeA

Link to comment

The script doesn't know if the gate is moving or not. This should work, not tested though.

phq1 = createObject(968, 1544.699, -1630.798, 13.100, 0, 88.9, 90) 
phq1col = createColCircle(1542.699, -1630.798, 13.100, 7) 
moving = false 
movetime = 968 
  
addEventHandler("onColShapeHit", phq1col, 
    function(hitElement, matchingDimension) 
        if getElementType(hitElement) == "player" and matchingDimension then 
            if getElementModel(hitElement) == 0 then 
                if moving == false then 
                    moveObject(phq1, movetime, 1544.699, -1630.798, 13.100, 0, 0, 90) 
                    moving = true 
                    setTimer(function() 
                        moving = false 
                    end, movetime, 1) 
                end 
            end 
        end 
    end 
) 
  
addEventHandler("onColShapeLeave", phq1col, 
    function(hitElement, matchingDimension) 
        if getElementType(hitElement) == "player" and matchingDimension then 
            if getElementModel(hitElement) == 0 then 
                if moving == false then 
                    moveObject (phq1, movetime, 1544.699, -1630.798, 13.100, 0, 88.9, 90) 
                    moving = true 
                    setTimer(function() 
                        moving = false 
                    end, movetime, 1) 
                end 
            end 
        end 
    end 
) 

Link to comment
  phq1 = createObject ( 968, 1544.699, -1630.798, 13.100, 0, 90, 90 ) 
   phq1col = createColCircle ( 1542.699, -1630.798, 13.100, 7 ) 
    
function openphq1(thePlayer) 
if getElementModel( thePlayer ) == 0 then 
       moveObject(phq1, 968, 1544.699, -1630.798, 13.100, 0, -90) 
end 
end 
addEventHandler( "onColShapeHit", phq1col, openphq1 ) 
  
function closephq1(thePlayer) 
if getElementModel( thePlayer ) == 0 then 
       moveObject(phq1, 968, 1544.699, -1630.798, 13.100, 0, 90) 
end 
end 
addEventHandler( "onColShapeLeave", phq1col, closephq1 ) 

Link to comment
Dzsipszi said:
Amm... looks like its worked but... if i go closer i see 2 gate... 1 is your going up normally and 1 gate is stay in the

( 968, 1544.699, -1630.798, 13.100, 0, 90, 90 ) 
 

how can be made it to coded gate? like: /nyit 45612 for unlock & /zár for lock

i guess you have the other gate from map file/map editor.

About the command, you can use addCommandHandler and make sure the script knew if the gate is moving or not, as myonlake told you.

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