Soren Posted April 16, 2012 Posted April 16, 2012 (edited) Hola a todos cree este sctipt que se supone que deberia hacer como una linterna pero el me da un mal argumento en el bindKey miren function linterna ( thePlayer) local x, y, z = getElementPosition (thePlayer) local luz = createMarker ( x, y, z, "corona", 5, 255, 255, 255, 150 ) attachElements ( luz, thePlayer, x, y, z) end bindKey ( thePlayer, "l", "down", linterna) que pasa? Edited April 16, 2012 by Guest
Castillo Posted April 16, 2012 Posted April 16, 2012 Me explicas que es: "attachElemts"? talvez querias poner: attachElements. Ademas, si el script es server side, necesitas usar bindKey al entrar al servidor.
Castillo Posted April 16, 2012 Posted April 16, 2012 addEventHandler ( "onResourceStart", resourceRoot, function ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "l", "down", linterna ) end end ) addEventHandler ( "onPlayerJoin", root, function ( ) bindKey ( source, "l", "down", linterna ) end ) function linterna ( thePlayer ) local x, y, z = getElementPosition ( thePlayer ) local luz = createMarker ( x, y, z, "corona", 5, 255, 255, 255, 150 ) attachElements ( luz, thePlayer, x, y, z ) end
Soren Posted April 16, 2012 Author Posted April 16, 2012 Lo testee y ahora no me dio error, pero no crea el marker ni lo pega
Castillo Posted April 16, 2012 Posted April 16, 2012 Eso ya me di cuenta, la posicion esta mal. addEventHandler ( "onResourceStart", resourceRoot, function ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "l", "down", linterna ) end end ) addEventHandler ( "onPlayerJoin", root, function ( ) bindKey ( source, "l", "down", linterna ) end ) function linterna ( thePlayer ) local x, y, z = getElementPosition ( thePlayer ) local luz = createMarker ( x, y, z, "corona", 5, 255, 255, 255, 150 ) attachElements ( luz, thePlayer, 0, 0, 0 ) end
Soren Posted April 16, 2012 Author Posted April 16, 2012 Y como puedo hacer que desaparesca cuando vuelves a precionar l? perdon esque es la primera vez que uso bindKey
Renkon Posted April 16, 2012 Posted April 16, 2012 crea una variable int funcionando = 0 y entonces haces. if funcionando == 0 entonces (lo q te paso Solid), y le pones que de valor tome 1. Y si ya vale uno le das de valor 0 devuelta destruyendo luz
Castillo Posted April 16, 2012 Posted April 16, 2012 @Renkon: El script es server side, osea la variable va a ser para todos los jugadores, no sirve tu idea. @Soren: Crea una tabla luego pones el marker dentro y el dueño del mismo, si existe al presionar la "L", lo destruyes, y si no, lo creas.
Renkon Posted April 17, 2012 Posted April 17, 2012 ahhhhh haciendo if luz then es todo mucho mas facil, pero.... y si dos personas ejecutan lo mismoooo? ya leí, una tablacon el nombre
Edikosh998 Posted April 17, 2012 Posted April 17, 2012 Como me gusto la idea, pongo lo que puse para que se apague y prenda : addEventHandler ( "onResourceStart", resourceRoot, function ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "l", "down", linterna ) setElementData(player,"tiene.Linterna",false) end end ) addEventHandler ( "onPlayerJoin", root, function ( ) bindKey ( source, "l", "down", linterna ) setElementData(player,"tiene.Linterna",false) end ) function linterna ( thePlayer ) local linternaEstado = getElementData(thePlayer,"tiene.Linterna") if linternaEstado == false then local x, y, z = getElementPosition ( thePlayer ) luz = createMarker ( x, y, z, "corona", 5, 255, 255, 255, 150 ) attachElements ( luz, thePlayer, 0, 0, 0 ) setElementData(thePlayer,"tiene.Linterna",true) else destroyElement(luz) setElementData(thePlayer,"tiene.Linterna",false) end end Espero que te sirva.
Soren Posted April 17, 2012 Author Posted April 17, 2012 Como me gusto la idea, pongo lo que puse para que se apague y prenda : addEventHandler ( "onResourceStart", resourceRoot, function ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "l", "down", linterna ) setElementData(player,"tiene.Linterna",false) end end ) addEventHandler ( "onPlayerJoin", root, function ( ) bindKey ( source, "l", "down", linterna ) setElementData(player,"tiene.Linterna",false) end ) function linterna ( thePlayer ) local linternaEstado = getElementData(thePlayer,"tiene.Linterna") if linternaEstado == false then local x, y, z = getElementPosition ( thePlayer ) luz = createMarker ( x, y, z, "corona", 5, 255, 255, 255, 150 ) attachElements ( luz, thePlayer, 0, 0, 0 ) setElementData(thePlayer,"tiene.Linterna",true) else destroyElement(luz) setElementData(thePlayer,"tiene.Linterna",false) end end Espero que te sirva. No lo e testeado pero mil gracias!!! pienso bajarle un poco el alpha y agregarle al atach element +5 en y por que es muy brilloso el jugador y prefiero que sea mas adelamnte
Alexs Posted April 17, 2012 Posted April 17, 2012 Como me gusto la idea, pongo lo que puse para que se apague y prenda : addEventHandler ( "onResourceStart", resourceRoot, function ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "l", "down", linterna ) setElementData(player,"tiene.Linterna",false) end end ) addEventHandler ( "onPlayerJoin", root, function ( ) bindKey ( source, "l", "down", linterna ) setElementData(player,"tiene.Linterna",false) end ) function linterna ( thePlayer ) local linternaEstado = getElementData(thePlayer,"tiene.Linterna") if linternaEstado == false then local x, y, z = getElementPosition ( thePlayer ) luz = createMarker ( x, y, z, "corona", 5, 255, 255, 255, 150 ) attachElements ( luz, thePlayer, 0, 0, 0 ) setElementData(thePlayer,"tiene.Linterna",true) else destroyElement(luz) setElementData(thePlayer,"tiene.Linterna",false) end end Espero que te sirva. No lo e testeado pero mil gracias!!! pienso bajarle un poco el alpha y agregarle al atach element +5 en y por que es muy brilloso el jugador y prefiero que sea mas adelamnte Men, te reco usar algun shader o algo asi, por que ahora que lo pienso un marcador no ilumina, a lo ams emularia el efecto, pero testeando el script veo lo cutre que se ve...
Edikosh998 Posted April 17, 2012 Posted April 17, 2012 Obviamente que un shade seria mejor, pero no entiendo nada de diseño de objetos 3D y esas cosas. Osea, lo mejor o es el marker, o buscar algun shade echo que pareza la luz de una linterna.
Alexs Posted April 17, 2012 Posted April 17, 2012 Obviamente que un shade seria mejor, pero no entiendo nada de diseño de objetos 3D y esas cosas. Osea, lo mejor o es el marker, o buscar algun shade echo que pareza la luz de una linterna. Se puede usar el de algun CLEO Mod Edit: Denme un momento y les dare una textura de linterna (a cambio de que luego dejes aca el script terminado)
Edikosh998 Posted April 17, 2012 Posted April 17, 2012 Si no hay problema, total puede quedar como aporte a comunidad
Alexs Posted April 17, 2012 Posted April 17, 2012 Si no hay problema, total puede quedar como aporte a comunidad Eso mismo pensaba, yo veo como crear la luz y el la acomoda... :B aunque no encuentro shaders
Alexs Posted April 17, 2012 Posted April 17, 2012 Si no hay problema, total puede quedar como aporte a comunidad Eso mismo pensaba, yo veo como crear la luz y el la acomoda... :B aunque no encuentro shaders Listo, sigo buscando shaders, pero prueba un attachElements con esta textura: http://www.mediafire.com/?bjju4is96ms5byh el Object es el "1490" que es un graffiti, dale un attach con Rotacion, deberia ser util mientras veo lo del shader...
Edikosh998 Posted April 17, 2012 Posted April 17, 2012 Si no hay problema, total puede quedar como aporte a comunidad Eso mismo pensaba, yo veo como crear la luz y el la acomoda... :B aunque no encuentro shaders Listo, sigo buscando shaders, pero prueba un attachElements con esta textura: http://www.mediafire.com/?bjju4is96ms5byh el Object es el "1490" que es un graffiti, dale un attach con Rotacion, deberia ser util mientras veo lo del shader... http://imageshack.us/photo/my-images/205/asiquedo.jpg/ Asi quedo el coso, no me gusta el objeto que digamos
Soren Posted April 18, 2012 Author Posted April 18, 2012 WTF con el objeto , creo que deberiamos hacer este recource publico como dice edi pero primero hay que darle los arreglos
Edikosh998 Posted April 18, 2012 Posted April 18, 2012 Tiene que ser si o si un shader , porque un objeto no es lo adecuado para crear luz... Voy intentar buscar uno, o encontrar una forma de hacerlo
Castillo Posted April 18, 2012 Posted April 18, 2012 http://imageshack.us/photo/my-images/205/asiquedo.jpg/Asi quedo el coso, no me gusta el objeto que digamos Sin ofender, pero eso es un huevo de dinosaurio? osea, no entiendo que intentan crear, un efecto de luz?
Edikosh998 Posted April 18, 2012 Posted April 18, 2012 Jajajajjaja si Solid, osea Alex me paso un objeto exportado y despues lo integre al script, pero quedo esa "cosa" . Esta muy dificil, tendria que usar un engine o el 3DS Max, y tengo menos idea de esas cosas.
Soren Posted April 18, 2012 Author Posted April 18, 2012 Sin ofender, pero eso es un huevo de dinosaurio? osea, no entiendo que intentan crear, un efecto de luz? Hhahgahahahahahahhahahahahahahahhahahahahahhahahahahahahahhahahahahahahhahahahahahahahahhahahahahahahhahahahahahahahahahahhahahahahahahahhahaha. Buenisimo Solid ;D Ontopic: Creo que no se , podria buscar el objeto que es ocmo una luz de disco
Alexs Posted April 18, 2012 Posted April 18, 2012 puto sea el txd, esa imagen es de un juego, pero el txd no capta bien la opacidad, creo conocer un shader, pero es paraa directx 10 (vertex shader 2 y pixel shader mayor a 2 y creo q requiere TnL)
Recommended Posts