Soren Posted April 6, 2012 Author Share Posted April 6, 2012 Te refieres al de Alex o al tuyo? Link to comment
Soren Posted April 6, 2012 Author Share Posted April 6, 2012 Client: addEventHandler("onClientResourceStart",root, function() triggerServerEvent("onSpawnSlothBot",localPlayer) -- ahi el source es el localPlayer end ) Server: function onSpawnSlothBot() local x, y, z = getElementPosition (source) local rot = 0 local int = getElementInterior(source) local dim = getElementDimension(source) local weapon = 0 local skin = math.random(math.floor(21,23)) -- Entre 21 y 23 el skin for i = 1,10 do call ( getResourceFromName ( "slothbot" ), "spawnBot", x+i, y+i, z, rot, skin, int, dim, nil, weapon) end end addEvent("onSpawnSlothBot",true) addEventHandler("onSpawnSlothBot",getRootElement(),onSpawnSlothBot) <meta> <info author="iSoRen" name="Zday script" version="3.0.1" type="script" description="Zombie Infestation script" /> <script src="server.lua" type="server" /> <script src="client.lua" type="client" /> </meta> Link to comment
Edikosh998 Posted April 6, 2012 Share Posted April 6, 2012 Ambos andan bien... Alex lo ordeno. Tanto LUA, C++, C#, Basic...no importa si esta ordenado, lo leen igual (es espacio igual siempre sirve para prolijidad, y entender el codigo) EDIT : el meta esta bien, pusiste en marcha el script de SlothBot? Link to comment
Soren Posted April 6, 2012 Author Share Posted April 6, 2012 Se me olvido comenzar el recurso de slothbot , ya sirve pero los veo en fila dandose golpes unos a otros algun fix para eso? Link to comment
Edikosh998 Posted April 6, 2012 Share Posted April 6, 2012 A mi me pasaba lo mismo ...Nunca use el SlothBot, seguramente si estan todos el mismo team no se pegan (pones friendlyfire,false) Fijate con esto (no estoy seguro) : local teamZombie = createTeam("Zombies") function onSpawnSlothBot() local x, y, z = getElementPosition (source) local rot = 0 local int = getElementInterior(source) local dim = getElementDimension(source) local weapon = 0 local skin = math.random(math.floor(21,23)) -- Entre 21 y 23 el skin setTeamFriendlyFire(teamZombie,false) for i = 1,10 do call ( getResourceFromName ( "slothbot" ), "spawnBot", x+i, y+i, z, rot, skin, int, dim, teamZombie, weapon) end end addEvent("onSpawnSlothBot",true) addEventHandler("onSpawnSlothBot",getRootElement(),onSpawnSlothBot) Link to comment
Soren Posted April 6, 2012 Author Share Posted April 6, 2012 Uh, otra cosa que vi es que cuando los mate a todos no respawnearon, algun fix para eso tambien? Gracias por toda su ayuda Link to comment
Soren Posted April 6, 2012 Author Share Posted April 6, 2012 A mi me pasaba lo mismo ...Nunca use el SlothBot, seguramente si estan todos el mismo team no se pegan (pones friendlyfire,false)Fijate con esto (no estoy seguro) : local teamZombie = createTeam("Zombies") function onSpawnSlothBot() local x, y, z = getElementPosition (source) local rot = 0 local int = getElementInterior(source) local dim = getElementDimension(source) local weapon = 0 local skin = math.random(math.floor(21,23)) -- Entre 21 y 23 el skin setTeamFriendlyFire(teamZombie,false) for i = 1,10 do call ( getResourceFromName ( "slothbot" ), "spawnBot", x+i, y+i, z, rot, skin, int, dim, teamZombie, weapon) end end addEvent("onSpawnSlothBot",true) addEventHandler("onSpawnSlothBot",getRootElement(),onSpawnSlothBot) Funciono perfecto!! eres todo un genio!! solo hace falta lograr arreglar lo dde los respawns de los slothbots Link to comment
Castillo Posted April 6, 2012 Share Posted April 6, 2012 Estan spawneando los zombies cuando ellos spawnean? no tienen mucho sentido eso para mi. Link to comment
Edikosh998 Posted April 6, 2012 Share Posted April 6, 2012 Es que pensa que el evento solamente se hace cuando empieza el resource...Si queres que respawneen tendrias que usar el evento "onBotWasted" local teamZombie = createTeam("Zombies") function onSpawnSlothBot() local x, y, z = getElementPosition (source) local rot = 0 local int = getElementInterior(source) local dim = getElementDimension(source) local weapon = 0 setTeamFriendlyFire(teamZombie,false) local skin = math.random(math.floor(21,23)) -- Entre 21 y 23 el skin for i = 1,10 do call ( getResourceFromName ( "slothbot" ), "spawnBot", x+i, y+i, z, rot, skin, int, dim, teamZombie, weapon) end end addEvent("onSpawnSlothBot",true) addEventHandler("onSpawnSlothBot",getRootElement(),onSpawnSlothBot) function onBotWasted(attacker,weapon,bodypart) local x,y,z = getElementPosition(attacker) local rot = 0 local int = getElementInterior(attacker) local dim = getElementDimension(attacker) local weapon = 0 local skin = math.random(math.floor(21,23)) call ( getResourceFromName ( "slothbot" ), "spawnBot", x+i, y+i, z, rot, skin, int, dim, teamZombie, weapon) end addEventHandler("onBotWasted",getRootElement(),onBotWasted) EDIT : Castillo, pera no entiendo...lo que quizo el era que cuando empezaba el recurso aparezcan los zombies, y entonces aparecen 10 en fila Link to comment
Edikosh998 Posted April 6, 2012 Share Posted April 6, 2012 El tema es esto : no se como hacer para llamar el evento "onBotWasted"... Porque es un evento hecho por el script, debe ser un call Habra que preguntarle a otro (castillo seguro que lo sabe :) ) porque no tengo idea. Link to comment
Castillo Posted April 6, 2012 Share Posted April 6, 2012 El evento "onSpawnSlothBot" seguro se ejecuta cuando un bot spawnea, entonces vos estas creando los bots cuando otro bot spawnea. P.D: Para usar un evento creado por el script tambien tenes que usar addEvent. Link to comment
Edikosh998 Posted April 6, 2012 Share Posted April 6, 2012 El evento "onSpawnSlothBot" seguro se ejecuta cuando un bot spawnea, entonces vos estas creando los bots cuando otro bot spawnea.P.D: Para usar un evento creado por el script tambien tenes que usar addEvent. No , lo cree yo el "onSpawnSlothBot" jaja. Soy muy malo poniendo nombres a eventos. Mira el full code Client addEventHandler("onClientResourceStart",root, function() triggerServerEvent("onSpawnSlothBot",localPlayer) -- ahi el source es el localPlayer end ) Server local teamZombie = createTeam("Zombies") function onSpawnSlothBot() local x, y, z = getElementPosition (source) local rot = 0 local int = getElementInterior(source) local dim = getElementDimension(source) local weapon = 0 setTeamFriendlyFire(teamZombie,false) local skin = math.random(math.floor(21,23)) -- Entre 21 y 23 el skin for i = 1,10 do call ( getResourceFromName ( "slothbot" ), "spawnBot", x+i, y+i, z, rot, skin, int, dim, teamZombie, weapon) end end addEvent("onSpawnSlothBot",true) addEventHandler("onSpawnSlothBot",getRootElement(),onSpawnSlothBot) function onBotWasted(attacker,weapon,bodypart) local x,y,z = getElementPosition(attacker) local rot = 0 local int = getElementInterior(attacker) local dim = getElementDimension(attacker) local weapon = 0 local skin = math.random(math.floor(21,23)) call ( getResourceFromName ( "slothbot" ), "spawnBot", x+i, y+i, z, rot, skin, int, dim, teamZombie, weapon) end addEvent("onBotWasted",true) addEventHandler("onBotWasted",getRootElement(),onBotWasted) Fijate que lo cambie ahora y le puse el onBotWasted Link to comment
Castillo Posted April 7, 2012 Share Posted April 7, 2012 Oh, fue mi error, tendria que haber leido el resto del tema . Link to comment
Edikosh998 Posted April 7, 2012 Share Posted April 7, 2012 De ultima proba poniendo el de function onBotWasted(attacker,weapon,bodypart) local x,y,z = getElementPosition(attacker) local rot = 0 local int = getElementInterior(attacker) local dim = getElementDimension(attacker) local weapon = 0 local skin = math.random(math.floor(21,23)) call ( getResourceFromName ( "slothbot" ), "spawnBot", x+i, y+i, z, rot, skin, int, dim, teamZombie, weapon) end addEvent("onBotWasted",true) addEventHandler("onBotWasted",getRootElement(),onBotWasted) Eso en el script de "slothbot" (osea lo pegas adentro del lado server). Se que no es lo mejor, pero no se como exportarlo. Link to comment
Soren Posted April 8, 2012 Author Share Posted April 8, 2012 Sigue sin server D:, Solid me puedes ayudar? Link to comment
Recommended Posts