Nicolas ECM Posted January 14, 2015 Posted January 14, 2015 Hola a todos tengo una duda se puede hacer que se cree una explosion con la rotacion que tiene el que usa el comando function asdfg(sourcePlayer) local x, y, z = getElementPosition ( sourcePlayer ) local xx, yy, zz = getElementRotation ( sourcePlayer ) setElementRotation ( explo, xx, yy, zz ) explo = createExplosion ( x , y + 3, z, 11 ) end addCommandHandler("a", asdfg) intente hacerlo asi pero no pude me manda error quien me puede ayudar porfavor.
AlFA# Posted January 14, 2015 Posted January 14, 2015 Hola a todos tengo una duda se puede hacer que se cree una explosion con la rotacion que tiene el que usa el comandofunction asdfg(sourcePlayer) local x, y, z = getElementPosition ( sourcePlayer ) local xx, yy, zz = getElementRotation ( sourcePlayer ) setElementRotation ( explo, xx, yy, zz ) explo = createExplosion ( x , y + 3, z, 11 ) end addCommandHandler("a", asdfg) intente hacerlo asi pero no pude me manda error quien me puede ayudar porfavor. ¿Donde defines la posición?
Nicolas ECM Posted January 14, 2015 Author Posted January 14, 2015 como asi?, tengo eso echo y eso crea una explosion cerca a mi pero quiero que sea como un objeto function add(sourcePlayer) local x, y, z = getElementPosition ( sourcePlayer ) local xxx, yyy, zzz = getElementRotation ( sourcePlayer ) objeto = createObject( 2419, x, y, z + 5, xxx , yyy , zzz + 90) end addCommandHandler("a", add) que le pueda colocar la rotacion que tiene el que usa el comando
Tomas Posted January 15, 2015 Posted January 15, 2015 No entendí, quizás es esto. function add(sourcePlayer) local x, y, z = getElementPosition ( sourcePlayer ) local xxx, yyy, zzz = getElementRotation ( sourcePlayer ) objeto = createObject( 2419, x, y, z + 5, xxx , yyy , zzz + 90) setElementRotation(objeto,xxx,yyy,zzz) end addCommandHandler("a", add)
Castillo Posted January 15, 2015 Posted January 15, 2015 Como va a tener rotacion una explosion? no tiene el menor sentido lo que decis.
Nicolas ECM Posted January 15, 2015 Author Posted January 15, 2015 Entonces lo que quiero es que cuando use un comando se cree una explosion que aparesca hacia donde yo este mirando con una distancia
Castillo Posted January 15, 2015 Posted January 15, 2015 Osea queres que aparezca enfrente del jugador? Podes utilizar las funciones de matrices, las cuales facilitan esto muchisimo.
Nicolas ECM Posted January 15, 2015 Author Posted January 15, 2015 si eso es lo que quiero me puedes dar un ejemplo porfavor
Nicolas ECM Posted January 15, 2015 Author Posted January 15, 2015 Me sigue apareciendo hacia un solo lado , no hacia donde yo estoy mirando.
Castillo Posted January 15, 2015 Posted January 15, 2015 addCommandHandler ( "explosion", function ( thePlayer ) local x, y, z = getElementPosition ( thePlayer ) -- Obtengo la posicion del jugador local rx, ry, rz = getElementRotation ( thePlayer ) -- Obtengo la rotacion del jugador local mat = Matrix.create ( x, y, z, rx, ry, rz ) -- Creo la matrix usando la posicion y la rotacion local forward = Matrix.getForward ( mat ) -- Obtengo la posicion en frente del jugador local pos = ( Matrix.getPosition ( mat ) + forward ) -- Sumo ambos vectores createExplosion ( pos, 11 ) end )
Nicolas ECM Posted January 15, 2015 Author Posted January 15, 2015 Gracias solid, me colaboras con el otro post de como hacer para que no se borren los datos cuando reconecte gracias.
Nicolas ECM Posted January 15, 2015 Author Posted January 15, 2015 solid pero hay un problema, como hago para alejar la explosion de donde yo estoy.
Tomas Posted January 15, 2015 Posted January 15, 2015 solid pero hay un problema, como hago para alejar la explosion de donde yo estoy. addCommandHandler ( "explosion", function ( thePlayer ) local x, y, z = getElementPosition ( thePlayer ) -- Obtengo la posicion del jugador local rx, ry, rz = getElementRotation ( thePlayer ) -- Obtengo la rotacion del jugador local mat = Matrix.create ( x, y, z, rx, ry, rz ) -- Creo la matrix usando la posicion y la rotacion local forward = Matrix.getForward ( mat ) -- Obtengo la posicion en frente del jugador local pos = ( Matrix.getPosition ( mat ) + forward+3 ) -- Sumo ambos vectores createExplosion ( pos, 11 ) end )
Tomas Posted January 15, 2015 Posted January 15, 2015 no sirvio tomas me sale error D: Puto OOP Prueba con eso addCommandHandler ( "explosion", function ( thePlayer ) local x, y, z = getElementPosition ( thePlayer ) -- Obtengo la posicion del jugador local rx, ry, rz = getElementRotation ( thePlayer ) -- Obtengo la rotacion del jugador local mat = Matrix.create ( x, y, z, rx, ry, rz ) -- Creo la matrix usando la posicion y la rotacion local forward = Matrix.getForward ( mat ) +3 -- Obtengo la posicion en frente del jugador local pos = ( Matrix.getPosition ( mat ) + forward ) -- Sumo ambos vectores createExplosion ( pos, 11 ) end )
Castillo Posted January 15, 2015 Posted January 15, 2015 local forward = ( Matrix.getForward ( mat ) * 2 )
Nicolas ECM Posted January 15, 2015 Author Posted January 15, 2015 Gracias,Solid me puedes terminar de ayudar con este post viewtopic.php?f=145&t=84250 porfavor
Recommended Posts