ELmarcoS. Posted September 18, 2012 Posted September 18, 2012 function boss ( ) if ( isElement ( slothbot ) ) then destroyElement ( slothbot ) end if ( isElement ( myBlip ) ) then destroyElement ( myBlip ) end slothBot = exports [ "slothBot" ]:spawnBot ( 249.16796875, -1822.9938964844, 3.3400845527649, 90, 287, 0, 0, Nemesis, 22, "hunting", true ) exports.extra_health:setElementExtraHealth ( slothBot, 1000 ) outputChatBox ( "Zombie Boss has been generated!!, run!", root, 255, 0, 0, true ) end setTimer ( boss, 300000, 0 ) addEventHandler ( "onResourceStart", resourceRoot, boss ) Tengo este script que crea un bot en la playa de los santos, pero quiero que aparesca cerca de todos los jugadores, osea que obtenga las coordenadas del jugador y se spawnee cerca de el Visit us at: http://www.mini-missions.org
Matty Posted September 18, 2012 Posted September 18, 2012 Que se Spawnee serca de todos los jugadores, no se si sea posible. Pero que se spawnee serca de cualquier jugador si, usando: getRandomPlayer ...Learning Scripting... State: Rookie, Noob [AP3]=Matty!= My Skype: mattias.netz
ELmarcoS. Posted September 18, 2012 Author Posted September 18, 2012 function boss ( ) if ( isElement ( slothbot ) ) then destroyElement ( slothbot ) end if ( isElement ( myBlip ) ) then destroyElement ( myBlip ) end slothBot = exports [ "slothBot" ]:spawnBot ( getRandomPlayer ( ), 90, 287, 0, 0, Nemesis, 22, "hunting", true ) exports.extra_health:setElementExtraHealth ( slothBot, 1000 ) outputChatBox ( "Zombie Boss has been generated!!, run!", root, 255, 0, 0, true ) end setTimer ( boss, 300000, 0 ) addEventHandler ( "onResourceStart", resourceRoot, boss ) Así? Visit us at: http://www.mini-missions.org
Renkon Posted September 18, 2012 Posted September 18, 2012 Usa un bucle for for index, player in ipairs getElementsByType("players") do -- Bucleamos la lista de jugadores. local x, y, z = getElementPosition(player) -- Conseguimos la posición --[[ Aca ponemos todo lo que queres que pase para cada jugador ]] end
ELmarcoS. Posted September 18, 2012 Author Posted September 18, 2012 No entendí ._.' soy novato en esto Visit us at: http://www.mini-missions.org
Renkon Posted September 18, 2012 Posted September 18, 2012 Si usas egtRandomPlayer, será solo a un jugador, en cambio con el bucle, revisas TODOS
ELmarcoS. Posted September 18, 2012 Author Posted September 18, 2012 function boss ( ) if ( isElement ( slothbot ) ) then destroyElement ( slothbot ) end if ( isElement ( myBlip ) ) then destroyElement ( myBlip ) end slothBot = exports [ "slothBot" ]:spawnBot ( for index, player in ipairs getElementsByType("players") do local x, y, z = getElementPosition(player), 90, 287, 0, 0, Nemesis, 22, "hunting", true ) exports.extra_health:setElementExtraHealth ( slothBot, 1000 ) outputChatBox ( "Zombie Boss has been generated!!, run!", root, 255, 0, 0, true ) end setTimer ( boss, 300000, 0 ) addEventHandler ( "onResourceStart", resourceRoot, boss ) Asi quedaria? Visit us at: http://www.mini-missions.org
Matty Posted September 18, 2012 Posted September 18, 2012 Vos queres que aparezca 1 nemesis para cada jugador o 1 para todos ?. ...Learning Scripting... State: Rookie, Noob [AP3]=Matty!= My Skype: mattias.netz
ELmarcoS. Posted September 18, 2012 Author Posted September 18, 2012 Sólo que aparesca cerca de los jugadores Visit us at: http://www.mini-missions.org
NodZen Posted September 18, 2012 Posted September 18, 2012 Probaste Con getElementPosition--aca pones para que sea el jugador spawnBot ( x , y, z + 15 )--Algo asi ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
ELmarcoS. Posted September 18, 2012 Author Posted September 18, 2012 function boss ( ) if ( isElement ( slothbot ) ) then destroyElement ( slothbot ) end if ( isElement ( myBlip ) ) then destroyElement ( myBlip ) end getElementPosition ( player ) slothBot = exports [ "slothBot" ] spawnBot ( x, y, z + 15, 90, 287, 0, 0, Nemesis, 22, "hunting", true ) exports.extra_health:setElementExtraHealth ( slothBot, 1000 ) outputChatBox ( "Zombie Boss has been generated!!, run!", root, 255, 0, 0, true ) end setTimer ( boss, 300000, 0 ) addEventHandler ( "onResourceStart", resourceRoot, boss ) Nose si esta bien ;s Visit us at: http://www.mini-missions.org
Matty Posted September 18, 2012 Posted September 18, 2012 function boss ( ) if ( isElement ( slothbot ) ) then destroyElement ( slothbot ) end if ( isElement ( myBlip ) ) then destroyElement ( myBlip ) end slothBot = exports [ "slothBot" ]:spawnBot ( x + 15, y, z, 90, 287, 0, 0, Nemesis, 22, "hunting", true ) exports.extra_health:setElementExtraHealth ( slothBot, 1000 ) outputChatBox ( "Zombie Boss has been generated!!, run!", root, 255, 0, 0, true ) end setTimer ( boss, 300000, 0 ) addEventHandler ( "onResourceStart", resourceRoot, boss ) function SpawnOnPlayer() local randomPlayer = getRandomPlayer () local x, y, z = getElementPosition ( randomPlayer ) end addEventHandler ( "onResourceStart", getRootElement(), SpawnOnPlayer ) ...Learning Scripting... State: Rookie, Noob [AP3]=Matty!= My Skype: mattias.netz
ELmarcoS. Posted September 18, 2012 Author Posted September 18, 2012 Error: nemesis/nemesis.lua:10: attempt to perform arithmetic on global 'x' (a nil value ) Visit us at: http://www.mini-missions.org
Matty Posted September 18, 2012 Posted September 18, 2012 function boss ( ) if ( isElement ( slothbot ) ) then destroyElement ( slothbot ) end if ( isElement ( myBlip ) ) then destroyElement ( myBlip ) end slothBot = exports [ "slothBot" ]:spawnBot ( x, y, z, 90, 287, 0, 0, Nemesis, 22, "hunting", true ) exports.extra_health:setElementExtraHealth ( slothBot, 1000 ) outputChatBox ( "Zombie Boss has been generated!!, run!", root, 255, 0, 0, true ) end setTimer ( boss, 300000, 0 ) addEventHandler ( "onResourceStart", resourceRoot, boss ) function SpawnOnPlayer() local randomPlayer = getRandomPlayer () local x, y, z = getElementPosition ( randomPlayer ) x = x + 15 end addEventHandler ( "onResourceStart", getRootElement(), SpawnOnPlayer ) Proba. ...Learning Scripting... State: Rookie, Noob [AP3]=Matty!= My Skype: mattias.netz
ELmarcoS. Posted September 18, 2012 Author Posted September 18, 2012 Pues al parecer no tiene ningun error, pero no aparece el bot ._., le quite lo de +15 y nada Visit us at: http://www.mini-missions.org
Renkon Posted September 19, 2012 Posted September 19, 2012 pone resourceRoot en lugar de getRootElement
Plate Posted September 19, 2012 Posted September 19, 2012 prova haci function boss ( ) if ( isElement ( slothbot ) ) then destroyElement ( slothbot ) end if ( isElement ( myBlip ) ) then destroyElement ( myBlip ) end x,y,z = getElementPosition(source) slothBot = exports [ "slothBot" ]:spawnBot ( x + 15, y, z, 90, 287, 0, 0, Nemesis, 22, "hunting", true ) exports.extra_health:setElementExtraHealth ( slothBot, 1000 ) outputChatBox ( "Zombie Boss has been generated!!, run!", root, 255, 0, 0, true ) end setTimer ( boss, 300000, 0 ) addEventHandler ( "onResourceStart", resourceRoot, boss ) haci te tiene que andar Visita Full GameZ DayZ Mod Server IP: mtasa://158.69.125.144:29015
ELmarcoS. Posted September 19, 2012 Author Posted September 19, 2012 No funciona ;/, creo que lo dejaré como estaba Visit us at: http://www.mini-missions.org
Plate Posted September 19, 2012 Posted September 19, 2012 creo que el error no esta en nel getElementPosition() sino que en el if ( isElement ( slothbot ) ) then destroyElement ( slothbot ) end if ( isElement ( myBlip ) ) then destroyElement ( myBlip ) end sacaselo y prova Visita Full GameZ DayZ Mod Server IP: mtasa://158.69.125.144:29015
ELmarcoS. Posted September 20, 2012 Author Posted September 20, 2012 x,y,z = getElementPosition(source) slothBot = exports [ "slothBot" ]:spawnBot ( x + 15, y, z, 90, 287, 0, 0, Nemesis, 22, "hunting", true ) exports.extra_health:setElementExtraHealth ( slothBot, 1000 ) outputChatBox ( "Zombie Boss has been generated!!, run!", root, 255, 0, 0, true ) end setTimer ( boss, 300000, 0 ) addEventHandler ( "onResourceStart", resourceRoot, boss ) WARNING: Loading script failed nemesis/nemesis.lua:5: '' expected near 'end' ._.? Visit us at: http://www.mini-missions.org
Renkon Posted September 20, 2012 Posted September 20, 2012 function bot() for index, player in ipairs getElementsByType("player") do local x, y, z = getElementPosition(player) slothBot = exports [ "slothBot" ]:spawnBot ( x, y, z+10, 90, 287, 0, 0, Nemesis, 22, "hunting", true ) exports.extra_health:setElementExtraHealth ( slothBot, 1000 ) end outputChatBox ( "Zombie Bosses have been generated!!, run!", root, 255, 0, 0, true ) end addCommandHandler("crearbots", bot) Prueba el comando /crearbots Creará un NEMESIS al lado de cada jugador online
ELmarcoS. Posted September 20, 2012 Author Posted September 20, 2012 'do' expected near getElementsByType Si es muy dificil lo que estoy pidiendo mejor lo hago con las coordenadas para no molestarlos más Visit us at: http://www.mini-missions.org
Renkon Posted September 20, 2012 Posted September 20, 2012 Pero si el DO esta a la derecha, lo copiaste bien?
ELmarcoS. Posted September 20, 2012 Author Posted September 20, 2012 Lo copié tal cual , lo copié denuevo y sale lo mismo Visit us at: http://www.mini-missions.org
Recommended Posts