Jump to content

Quest Para Cualquier Cofre . _ .


Johan™

Mensajes recomendados

Hola guaptones :$

Hoy les traigo una simple quest, se que hay algunas en el foro, :v

Cuando tenga tiempo, pondre una funcion igual a la de get_empty_inventory_count pero que compruebe el espacio por la celda no me hago entender xd, ya que el get_empty_inventory_count cuenta los espacio totales libres xd.

quest bolsafortunada begin
	state start begin
		when 30093.use or 30094.use or 30095.use or 30096.use begin
			local bols_93 = {
				{19, 1},
			}
			local bols_94 = {
				{19, 1},
			}
			local bols_95 = {
				{19, 1},
			}
			local bols_96 = {
				{19, 1},
			}
			if item.get_vnum() == 30093 then
				bolsafortunada.give_item(bols_93, item.get_vnum())
			elseif item.get_vnum() == 30094 then
				bolsafortunada.give_item(bols_94, item.get_vnum())
			elseif item.get_vnum() == 30095 then
				bolsafortunada.give_item(bols_95, item.get_vnum())
			elseif item.get_vnum() == 30096 then
				bolsafortunada.give_item(bols_96, item.get_vnum())
			else
				chat("Iten no programado.") -- En caso de error que es muy poco probable que salga.
			end
		end
		function give_item(tab, vnum)
			local longi = table.getn(tab)
			local probitemselct = number(1, longi)
			if tab[probitemselct] != NULL then
				item.select(tab[probitemselct][1])
				if pc.get_empty_inventory_count() - item.get_size() > 0 then
					pc.give_item2(tab[probitemselct][1], tab[probitemselct][2])
					pc.remove_item(vnum, 1)
				end
			end
		end
	end
end
Enlace para comentar
Compartir en otros sitios

quest bolsafortunada begin
	state start begin
		when 30093.use or 30094.use or 30095.use or 30096.use begin
			local bolsas = {
				{30039, 19, 1},
				{30094, 19, 1},
				{30095, 19, 1},
				{30096, 19, 1}
			}
			for i = 1, table.getn(bolsas), 1 do
				if item.get_vnum() == bolsas[i][1] then
					local probitemselct = number(1, table.getn(bolsas))
					pc.give_item2(bolsas[probitemselct][2], bolsas[probitemselct][3])
					pc.remove_item(bolsas[probitemselct][2], bolsas[probitemselct][3])
				end
			end
		end
	end
end

Con eso solo puede llegar a funcionar. (No lo he probado)  ^^

Enlace para comentar
Compartir en otros sitios

quest bolsafortunada begin
	state start begin
		when 30093.use or 30094.use or 30095.use or 30096.use begin
			local bolsas = {
				{30039, 19, 1},
				{30094, 19, 1},
				{30095, 19, 1},
				{30096, 19, 1}
			}
			for i = 1, table.getn(bolsas), 1 do
				if item.get_vnum() == bolsas[i][1] then
					local probitemselct = number(1, table.getn(bolsas))
					pc.give_item2(bolsas[probitemselct][2], bolsas[probitemselct][3])
					pc.remove_item(bolsas[probitemselct][2], bolsas[probitemselct][3])
				end
			end
		end
	end
end

Con eso solo puede llegar a funcionar. (No lo he probado)  ^^

 

::v al inicio no la entendi bien xd pero luego la entedi xd, pero mi mente es muy pobre y luego se confunde xd :V un array con varioab cofres :vvvvvvvv

pero mola :3

Analizando un poco creo que te eliminaria el item que no es

local probitemselct = number(1, table.getn(bolsas)) -> todo el tamaño de la tabla xd :v y en un caso raro puede que la tabla tenga mas cofres xd, por eso te diga que la seleccion no seria correcta buen hombre :$ asi es como la veo xd

Abro un cofre y me daria los items de otro :v y puede que me borre el cofrw que no es xd

Enlace para comentar
Compartir en otros sitios

puedes probar asi

 

when 30093.use or 30094.use or 30095.use or 30096.use begin
	local reward = {
		[30093] = {19, 1, 29, 1, 39, 1},
		[30094] = {19, 1, 29, 1, 39, 1},
		[30095] = {19, 1},
		[30096] = {19, 1, 29, 1, 39, 1, 49, 1},
	}
	local curBox = reward[item.get_vnum()] or nil

	if not curBox then return end

	local prob = number(1, table.getn(curBox))
	while prob%2 == 0 then
		prob = number(1, table.getn(curBox))
	end
	pc.give_item2(curBox[prob], curBox[prob+1])
	item.remove()
end
Enlace para comentar
Compartir en otros sitios

Unirse a la conversación

Puedes publicar ahora y registrarte más tarde. Si tienes una cuenta, regístrate para publicar con su cuenta.

Guest
Responder a este tema...

×   Has pegado contenido con formato .   Eliminar formato

  Only 75 emoji are allowed.

×   Tu enlace se ha incorporado automáticamente.   Mostrar un enlace en su lugar

×   Se ha restaurado el contenido anterior. .   Borrar editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recientemente navegando por este tema   0 miembros

    • No hay usuarios registrados visitando esta página.
×
×
  • Crear nuevo...