Jump to content

Subir y Bajar un objeto


vbenja.04

Recommended Posts

Posted

Hola tengo un problema, estaba intentando hacer un script para que una barrera se levante y baje por comando (use como base un script de abrir y cerrar puerta por si preguntan)

OpenClose = createObject ( 968, 1544.7001953125, -1630.7998046875, 13.10000038147, 0, -90, -90 )

function CloseOpen(player)

   moveObject (OpenClose, 968, 1544.7001953125, -1630.7998046875, 13.10000038147, 0, -90, -90 )

   moveObject (OpenClose, 968, 1544.6999511719, -1630.8000488281, 13.10000038147, 0, 90, 0 )

   end
addCommandHandler("entrar", CloseOpen)

cuando pongo /entrar se levanta la barrera todo hasta ahí todo bien,

spacer.png

 

 

pero cuando vuelvo a poner /entrar para que se baje la barrera, esta sigue girando en su direcciónspacer.png

  • Human Resources Staff
Posted

Hi, welcome to the forums!

I've moved your thread to the Spanish scripting section so you can get better assistance in your native language.
Make sure to always use English when posting outside this section!

  • 2 weeks later...
Posted

En la misma función estás moviendo el objeto 2 veces y provoca que se quede como "raro", hay varias opciones, o hace una función para abrir con su comando, y otra para cerrar con su comando. También puedes hacer esto:
 

OpenClose = createObject ( 968, 1544.7001953125, -1630.7998046875, 13.10000038147, 0, -90, -90 )

function CloseOpen(player, cmd, movimiento)
	if movimiento == "abrir" then
   		moveObject (OpenClose, 968, 1544.7001953125, -1630.7998046875, 13.10000038147, 0, -90, -90 )
	elseif movimiento == "cerrar" then
   		moveObject (OpenClose, 968, 1544.6999511719, -1630.8000488281, 13.10000038147, 0, 90, 0 )
   end
addCommandHandler("puerta", CloseOpen)

 

De forma que si escribes: /puerta abrir -> se abre, y si escribes /puerta cerrar -> se cierra.

Espero haberte ayudado, si hay cualquier error cuéntanoslo.

  • 2 months later...
Posted

Lo mejor es darle un dato al objeto, objeto:setData("Abierto",true) 
if abierto == true then
 objeto:setDATA("Abierto",false)
lo haces que se cierre
else
objeto::setData("Abierto",true)
haces que se abra
end
 

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