MI

[Resolvido] Incrementar opção de mais um tipo de stone no script de orb

Por mister17, 06 de abr. de 2019 em Resolvidos

6
1.5k
mister17M
06 de abril de 2019 às 12:40

Ola.

 

Preciso de ajuda com este script, quando encontrei ele tive problemas para inserir no meu servidor como por exemplo quando usava a orb  ele sumia com os item no caso water gem  e a water stones que estivessem proximas , agora esta funcionando perfeitamente.

 

Script que estou usando  e esta funcionando perfeitamente esta no spoiler abaixo, (o que eu quero uma função que conte os item  tipo water gem exiba no look e outra função que me deixe escolher  por exemplo uma garder orb faz punch stone  ou heart stone).

Abaixo o script original feito pelo Rigby  e editado por mim.

Spoiler

-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
-- [ID DA ORB] = {ID DA STONE, QUANTIDADE{minimo, maximo},
    [12283] = {fruit = 11442, quantity = {0,1}, EmptyOrb = 12283, CommomM = 12161},
    }
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerItemCount(cid, 12161) < 175 then
        doPlayerSendTextMessage(cid,27,"Voce nao possui os materiais necessários!")
    else
        for i, k in pairs(config) do
            if (isInArray(i, item.itemid) == true) then
                random = math.random(k.quantity[1],k.quantity[2])
                doPlayerAddItem(cid,k.fruit,random)
                doPlayerAddItem(cid,k.EmptyOrb,1)
                doPlayerRemoveItem(cid,12283,1)
                doPlayerRemoveItem(cid,12161,175)
                if random > 0 then
                    doPlayerSendTextMessage(cid,27,"Parabéns! O processo de transformaçao foi realizado com sucesso, assim se transformando em "..getItemNameById(k.fruit)..".")
                else
                    doPlayerSendTextMessage(cid,27,"A orb quebrou durante o processo!")
                    doPlayerRemoveItem(cid,k.EmptyOrb,1)
                end
            end
        end
    end
return true
end

 

O meu pedido de ajuda no caso é como eu faço para que 1 orb faça mais de 1 tipo de stone  no caso do script que coloquei abaixo ele não funcionou como eu acreditava pois após ler o mesmo pude ver que quando iria executar  uma determinada função ele pedia um tipo de orb  me impossibilitando de  fazer  outro tipo de stone que seria orb diferente.

 

Abaixo o script original feito pelo Rigby e editado pelo JS Lotus

Spoiler


-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
-- [ID DA ORB] = {ID DA STONE, QUANTIDADE{minimo, maximo},
    [15061] = {fruit = 2283, quantity = {0,1}, EmptyOrb = 15166, CommomM = 2132},
    [8637] = {fruit = 14036, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8634] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8638] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8635] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8639] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8636] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8640] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
}

local tempo = 600 -- tempo em segundos
local tempoVip = 300
local stoTempo = 8120
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerItemCount(cid, 2132) < 175 then
        doPlayerSendTextMessage(cid,27,"Você nao possui os materiais necessários!")
        return false
    end
    if getPlayerStorageValue(cid, stoTempo) >= os.time() then
        doPlayerSendTextMessage(cid,27, "You have to wait "..(getPlayerStorageValue(cid, stoTempo) - os.time()).." seconds to use this item again.")
        return false
    end
    for i, k in pairs(config) do
        if (isInArray(i, item.itemid) == true) then
            random = math.random(k.quantity[1],k.quantity[2])
            doPlayerAddItem(cid,k.fruit,random)
            doPlayerAddItem(cid,k.EmptyOrb,1)
            doPlayerRemoveItem(cid,15061,1)
            doPlayerRemoveItem(cid,2132,175)
            if isPremium(cid) then
                setPlayerStorageValue(cid, stoTempo, os.time() + tempoVip)
            else
                setPlayerStorageValue(cid, stoTempo, os.time() + tempo)
            end
            if random > 0 then
                doPlayerSendTextMessage(cid,27,"Parabéns! O processo de transformaçao foi realizado com sucesso, assim se transformando em "..getItemNameById(k.fruit)..".")
            else
                doPlayerSendTextMessage(cid,27,"A orb quebrou durante o processo!")
                doPlayerRemoveItem(cid,k.fruit,1)
            end
        end
    end
return true
end

 

 

Editado Abril 6 por mister17

gabrielzikaG
08 de abril de 2019 às 01:41

@mister17 Veja se é isso:

 

-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
--- [ID DA ORB] = {ID DAS STONES, QUANTIDADE{minimo, maximo},
	[10542] = {fruit = {11441, 11442, 11443, 11444}, quantity = {0, 1}, CommomM = {2132, 175}},
}

local tempo = 600 -- tempo em segundos
local tempoVip = 300
local stoTempo = 8120
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, stoTempo) >= os.time() then
        doPlayerSendTextMessage(cid, 27, "You have to wait "..(getPlayerStorageValue(cid, stoTempo) - os.time()).." seconds to use this item again.")
        return false
    end
    if getPlayerItemCount(cid, config[item.itemid].CommomM[1]) < config[item.itemid].CommomM[2] then
        doPlayerSendTextMessage(cid, 27, "Você nao possui os materiais necessários!")
        return false
    end
	if config[item.itemid] then
		local randomWin = math.random(config[item.itemid].quantity[1],config[item.itemid].quantity[2])
		local randomStone = math.random (1, #config[item.itemid].fruit)
		
		if randomWin > 0 then
			doPlayerAddItem(cid, config[item.itemid].fruit[randomStone], randomWin)
			doPlayerSendTextMessage(cid, 27, "Parabéns! O processo de transformaçao foi realizado com sucesso, assim se transformando em "..getItemNameById(config[item.itemid].fruit[randomStone])..".")
		else
			doPlayerSendTextMessage(cid, 27, "A orb quebrou durante o processo!")
		end
		doRemoveItem(item.uid, 1)
		doPlayerRemoveItem(cid, config[item.itemid].CommomM[1], config[item.itemid].CommomM[2])
		if isPremium(cid) then
			setPlayerStorageValue(cid, stoTempo, os.time() + tempoVip)
		else
			setPlayerStorageValue(cid, stoTempo, os.time() + tempo)
		end
	end
return true
end

 

mister17M
08 de abril de 2019 às 08:58
7 horas atrás, gabrielzika disse:

@mister17 Veja se é isso:

 

-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
--- [ID DA ORB] = {ID DAS STONES, QUANTIDADE{minimo, maximo},
	[10542] = {fruit = {11441, 11442, 11443, 11444}, quantity = {0, 1}, CommomM = {2132, 175}},
}

local tempo = 600 -- tempo em segundos
local tempoVip = 300
local stoTempo = 8120
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, stoTempo) >= os.time() then
        doPlayerSendTextMessage(cid, 27, "You have to wait "..(getPlayerStorageValue(cid, stoTempo) - os.time()).." seconds to use this item again.")
        return false
    end
    if getPlayerItemCount(cid, config[item.itemid].CommomM[1]) < config[item.itemid].CommomM[2] then
        doPlayerSendTextMessage(cid, 27, "Você nao possui os materiais necessários!")
        return false
    end
	if config[item.itemid] then
		local randomWin = math.random(config[item.itemid].quantity[1],config[item.itemid].quantity[2])
		local randomStone = math.random (1, #config[item.itemid].fruit)
		
		if randomWin > 0 then
			doPlayerAddItem(cid, config[item.itemid].fruit[randomStone], randomWin)
			doPlayerSendTextMessage(cid, 27, "Parabéns! O processo de transformaçao foi realizado com sucesso, assim se transformando em "..getItemNameById(config[item.itemid].fruit[randomStone])..".")
		else
			doPlayerSendTextMessage(cid, 27, "A orb quebrou durante o processo!")
		end
		doRemoveItem(item.uid, 1)
		doPlayerRemoveItem(cid, config[item.itemid].CommomM[1], config[item.itemid].CommomM[2])
		if isPremium(cid) then
			setPlayerStorageValue(cid, stoTempo, os.time() + tempoVip)
		else
			setPlayerStorageValue(cid, stoTempo, os.time() + tempo)
		end
	end
return true
end

 

Então bacana o script mas tipo ai você esta fazendo com que a stone seja aleatoria, o que eu queria na verdade é que seja tipo garder orb fizesse  punch e heart stone no caso da punch utilizaria banddaid que dropa de machamp e para heart stone  Ruber ball qeu dropa de clefable.

 

Serão feitas por elemento 

 

Editado Abril 8 por mister17

gabrielzikaG
08 de abril de 2019 às 09:03
Melhor resposta

@mister17 havia entendido outra coisa:

 

-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
--- [ID DA ORB] = {ID DAS STONES, QUANTIDADE{minimo, maximo},
	[10542] = {fruit = 11441, quantity = {0, 1}, CommomM = {2132, 175}},
	[10543] = {fruit = 11442, quantity = {0, 1}, CommomM = {2132, 175}},
	[10544] = {fruit = 11443, quantity = {0, 1}, CommomM = {2132, 175}},
}

local tempo = 600 -- tempo em segundos
local tempoVip = 300
local stoTempo = 8120
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, stoTempo) >= os.time() then
        doPlayerSendTextMessage(cid, 27, "You have to wait "..(getPlayerStorageValue(cid, stoTempo) - os.time()).." seconds to use this item again.")
        return false
    end
    if getPlayerItemCount(cid, config[item.itemid].CommomM[1]) < config[item.itemid].CommomM[2] then
        doPlayerSendTextMessage(cid, 27, "Você nao possui os materiais necessários!")
        return false
    end
	if config[item.itemid] then
		local randomWin = math.random(config[item.itemid].quantity[1],config[item.itemid].quantity[2])
		
		if randomWin > 0 then
			doPlayerAddItem(cid, config[item.itemid].fruit, randomWin)
			doPlayerSendTextMessage(cid, 27, "Parabéns! O processo de transformaçao foi realizado com sucesso, assim se transformando em "..getItemNameById(config[item.itemid].fruit)..".")
		else
			doPlayerSendTextMessage(cid, 27, "A orb quebrou durante o processo!")
		end
		doRemoveItem(item.uid, 1)
		doPlayerRemoveItem(cid, config[item.itemid].CommomM[1], config[item.itemid].CommomM[2])
		if isPremium(cid) then
			setPlayerStorageValue(cid, stoTempo, os.time() + tempoVip)
		else
			setPlayerStorageValue(cid, stoTempo, os.time() + tempo)
		end
	end
return true
end

 

mister17M
08 de abril de 2019 às 11:30
3 horas atrás, gabrielzika disse:

@mister17 havia entendido outra coisa:

 

-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
--- [ID DA ORB] = {ID DAS STONES, QUANTIDADE{minimo, maximo},
	[10542] = {fruit = 11441, quantity = {0, 1}, CommomM = {2132, 175}},
	[10543] = {fruit = 11442, quantity = {0, 1}, CommomM = {2132, 175}},
	[10544] = {fruit = 11443, quantity = {0, 1}, CommomM = {2132, 175}},
}

local tempo = 600 -- tempo em segundos
local tempoVip = 300
local stoTempo = 8120
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, stoTempo) >= os.time() then
        doPlayerSendTextMessage(cid, 27, "You have to wait "..(getPlayerStorageValue(cid, stoTempo) - os.time()).." seconds to use this item again.")
        return false
    end
    if getPlayerItemCount(cid, config[item.itemid].CommomM[1]) < config[item.itemid].CommomM[2] then
        doPlayerSendTextMessage(cid, 27, "Você nao possui os materiais necessários!")
        return false
    end
	if config[item.itemid] then
		local randomWin = math.random(config[item.itemid].quantity[1],config[item.itemid].quantity[2])
		
		if randomWin > 0 then
			doPlayerAddItem(cid, config[item.itemid].fruit, randomWin)
			doPlayerSendTextMessage(cid, 27, "Parabéns! O processo de transformaçao foi realizado com sucesso, assim se transformando em "..getItemNameById(config[item.itemid].fruit)..".")
		else
			doPlayerSendTextMessage(cid, 27, "A orb quebrou durante o processo!")
		end
		doRemoveItem(item.uid, 1)
		doPlayerRemoveItem(cid, config[item.itemid].CommomM[1], config[item.itemid].CommomM[2])
		if isPremium(cid) then
			setPlayerStorageValue(cid, stoTempo, os.time() + tempoVip)
		else
			setPlayerStorageValue(cid, stoTempo, os.time() + tempo)
		end
	end
return true
end

 esta dando erro script dizendo que tem um simbolo errdo, estou convertendo como ANSI mesmo assim o erro continua

 

Esta dando erro de simbolo mas chequei apaguei os erro converti para ANSI e continua a dar erro, porem é agora te a função que eu preciso que é check  commom 1 e check commom 2, será que como preciso que ele compare se tem os item 1 e item 2 n preciso do commom 1 e commom 2?

Ainda continua fazendo check de um 1 item só no caso snowball que faz a ice stone utilizando a mesma orb.

 

Tentei ajustar o script em que eu estava trabalhando, agora esta utilizando snowball e water gem para fazer ice stone, preciso descobrir como separar 1 faz ice com snowball e outra water stone com water gem.

script abaixo

Spoiler

-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
-- [ID DA ORB] = {ID DA STONE, QUANTIDADE{minimo, maximo},
    [12283] = {fruit = 11441, quantity = {0, 1}, EmptyOrb = 12283, CommomM = {2132},
    [12283] = {fruit = 11442, quantity = {0, 1}, EmptyOrb = 12283, CommomM = {2132},
    }
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, stoTempo) >= os.time() then
        doPlayerSendTextMessage(cid, 27, "You have to wait "..(getPlayerStorageValue(cid, stoTempo) - os.time()).." seconds to use this item again.")
        return false
    else
        for i, k in pairs(config) do
            if (isInArray(i, item.itemid) == true) then
                random = math.random(k.quantity[1],k.quantity[2])
                doPlayerAddItem(cid,k.fruit,random)
                doPlayerAddItem(cid,k.EmptyOrb,1)
                doPlayerRemoveItem(cid,k.EmptyOrb,1)
                doPlayerRemoveItem(cid,12161,175)
                doPlayerAddItem(cid,k.fruit,random)
                doPlayerAddItem(cid,k.EmptyOrb,1)
                doPlayerRemoveItem(cid,k.EmptyOrb,1)
                doPlayerRemoveItem(cid,13794,175)
                if random > 0 then
                    doPlayerSendTextMessage(cid,27,"Parabéns! O processo de transformaçao foi realizado com sucesso, assim se transformando em "..getItemNameById(k.fruit)..".")
                else
                    doPlayerSendTextMessage(cid,27,"A orb quebrou durante o processo!")
                    doPlayerRemoveItem(cid,k.EmptyOrb,1)
                end
            end
        end
    
return true
end
end

 

11 horas atrás, gabrielzika disse:

@mister17 Veja se é isso:

 

-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
--- [ID DA ORB] = {ID DAS STONES, QUANTIDADE{minimo, maximo},
	[10542] = {fruit = {11441, 11442, 11443, 11444}, quantity = {0, 1}, CommomM = {2132, 175}},
}

local tempo = 600 -- tempo em segundos
local tempoVip = 300
local stoTempo = 8120
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, stoTempo) >= os.time() then
        doPlayerSendTextMessage(cid, 27, "You have to wait "..(getPlayerStorageValue(cid, stoTempo) - os.time()).." seconds to use this item again.")
        return false
    end
    if getPlayerItemCount(cid, config[item.itemid].CommomM[1]) < config[item.itemid].CommomM[2] then
        doPlayerSendTextMessage(cid, 27, "Você nao possui os materiais necessários!")
        return false
    end
	if config[item.itemid] then
		local randomWin = math.random(config[item.itemid].quantity[1],config[item.itemid].quantity[2])
		local randomStone = math.random (1, #config[item.itemid].fruit)
		
		if randomWin > 0 then
			doPlayerAddItem(cid, config[item.itemid].fruit[randomStone], randomWin)
			doPlayerSendTextMessage(cid, 27, "Parabéns! O processo de transformaçao foi realizado com sucesso, assim se transformando em "..getItemNameById(config[item.itemid].fruit[randomStone])..".")
		else
			doPlayerSendTextMessage(cid, 27, "A orb quebrou durante o processo!")
		end
		doRemoveItem(item.uid, 1)
		doPlayerRemoveItem(cid, config[item.itemid].CommomM[1], config[item.itemid].CommomM[2])
		if isPremium(cid) then
			setPlayerStorageValue(cid, stoTempo, os.time() + tempoVip)
		else
			setPlayerStorageValue(cid, stoTempo, os.time() + tempo)
		end
	end
return true
end

 

Ola quero lhe agradecer, você simplificou muito o script que eu queria, de inicio não havia visto isto, mas ao começar a o estudo cima do seu script notei que ele simplificou  a minha ideia pois eu teria que criar um script para cada clan e agora necessito apenas esse, atendeu alem  a minha expectativa  parabéns pelo seu trabalho e muito obrigado por me ajudar.

Editado Abril 8 por mister17

Yan LiimaY
13 de abril de 2019 às 18:47
A questão neste tópico de suporte foi respondida e/ou o autor do tópico resolveu o problema. Este tópico está fechado e foi movido para Suporte - Resolvidos. Se você tiver outras dúvidas, crie um novo tópico.