Akroma Posted April 28, 2014 Report Share Posted April 28, 2014 Bueno despues de analizar la quest de los oficiales de la chestbox, he visto que para cierto tipo de personas, podria resultar demasiado complicado editarla conforme que e decidido hacerla de nuevo. Aqui os lo dejo: quest cofres begin state start begin when 20030.use or 20031.use or 20032.use or 20033.use begin local box = item.vnum() box_data = { [20030] = { 1, 3}, [20031] = {10, 3}, [20032] = {20, 3}, [20033] = {30, 3} } box_objects = { [20030] = { 19, 1, 20, 1, 21, 1}, [20031] = { 19, 1, 20, 1, 21, 1}, [20032] = { 19, 1, 20, 1, 21, 1}, [20033] = { 19, 1, 20, 1, 21, 1} } ---CONDICION DE NIVEL if pc.get_level() < box_data[box][1] then syschat("Lo siento no tienes suficiente nivel requieres nivel "..box_data[box][1].." ") elseif pc.get_empty_inventory_count() < box_data[box][2] then syschat("Lo siento tienes demasiados objetos en el inventario") else for i = 1, table.getn(box_objects[box]), 2 do pc.give_item2(box_objects[box][i][1], box_objects[box][i][2]) item.remove() end end end endend Seru, LovePlay and Jeo 3 Quote Link to comment Share on other sites More sharing options...
LovePlay Posted April 28, 2014 Report Share Posted April 28, 2014 Muchas gracias tio, la necestiba Quote Link to comment Share on other sites More sharing options...
PACI Posted April 28, 2014 Report Share Posted April 28, 2014 Hay varios fallos, y no es necesario hacer dos tablas cuando puedes usar una sola. Además, la función pc.give_item2, en el caso que hayan demasiados items en el inventario, los dropea con el nombre del personaje. quest cofres begin state start begin when 20030.use or 20031.use or 20032.use or 20033.use begin local vnum = item.vnum-20029 local data = { -- nivel, id, cantidad {1, 19, 1, 20, 1, 21, 1}, {10, 19, 1, 20, 1, 21, 1}, {20, 19, 1, 20, 1, 21, 1}, {30, 19, 1, 20, 1, 21, 1} } if pc.level < data[vnum][1] then syschat("Lo siento no tienes suficiente nivel requieres nivel "..data[vnum][1]) return end for i = 2, table.getn(data)+2, 2 do pc.give_item2(data[vnum][i], data[vnum][i+1]) end end endend Akroma 1 Quote Link to comment Share on other sites More sharing options...
Akroma Posted April 28, 2014 Author Report Share Posted April 28, 2014 gracias, buscaba esto mismo tuyo en dev, pero como no lo encontre tuve k hacer esto xd. ty paci nunca e entendido el xk table.getn(data)+2, ese +2 porque si tu con el table.getn ya estas recogiendo 1 valor maximo, para que quieres sumarle 2 a ese valor maximo. Quote Link to comment Share on other sites More sharing options...
PACI Posted April 28, 2014 Report Share Posted April 28, 2014 Porque el bucle no empieza en 1, si no en 2. Si no se sumase 2 al table.getn, el ultimo valor del item, y el ultimo valor de la cantidad, nunca serian leídos. ej: LovePlay and Shogun 2 Quote Link to comment Share on other sites More sharing options...
Seru Posted April 28, 2014 Report Share Posted April 28, 2014 Bien bien Akroma, ya me extrañaba esto de ti :c Quote Link to comment Share on other sites More sharing options...
jegarba Posted May 3, 2014 Report Share Posted May 3, 2014 para que sirve esta quest Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.