Postado Julho 22, 2018 6 anos Diga em poucas palavras a base utilizada (Nome do servidor ou nome do website). Ex. TFS 1.3; Base: TFS 0.4 Qual erro está surgindo/O que você procura? Boa tarde a todos, vocês podem me ajudar nesse script que venho desenvolvendo? queria saber o que posso melhorar nele e corrigir um pequeno bug que toda vez que ele passa um turno ele gera o level novamente, queria que gerasse só uma vez. OBS: O script em si é uma função. Você tem o código disponível? Se tiver publique-o aqui: function onUse(cid, item, fromPosition, itemEx, toPosition) function CorruptedBau(Bau, minimo, maximo, monstro, items, quantidade, minlvl, maxlvl) local itembau = bau local charges = math.random(minimo+1, maximo) local PRESENT_BLUE = monstro local randomChance = math.random(1, #PRESENT_BLUE) if item.actionid == 500 then local DIAMONDITEMS = items randomChance4 = math.random(1, #DIAMONDITEMS) item4 = DIAMONDITEMS[randomChance4] doCreateItem(item4, quantidade,toPosition) local tabelar = math.random(minlvl*7, maxlvl*12) doPlayerAddExp(cid, tabelar) doSendAnimatedText(getPlayerPosition(cid), ""..tabelar.."", 215) doSendMagicEffect(toPosition, 22) doRemoveItem(item.uid,1) end if item.actionid >= 1 then return true end doItemSetAttribute(item.uid, "description", "This is a Corrupted Chest protected by ".. charges .." " .. PRESENT_BLUE[randomChance] .. " (Level: "..math.random(minlvl,maxlvl) ..".") local birita = doCreateMonster(PRESENT_BLUE[randomChance], toPosition, false, false, false) doItemSetAttribute(item.uid, "aid", charges) --action ID da key que vc ganha na quest doCreatureSay(cid, "The curse will be actived.", TALKTYPE_ORANGE_1) doSendMagicEffect(toPosition, 65) local function CheckBau() addEvent (function () sona = getThingfromPos(toPosition).uid if getItemAttribute(sona, "description") == "This is a Corrupted Chest protected by 0 (Level: "..math.random(minlvl,maxlvl) .."." or getItemAttribute(sona, "aid") <= 2 then doItemSetAttribute(sona, "description", "This is a Corrupted Chest protected by 0 " .. PRESENT_BLUE[randomChance] .. " (Level: "..math.random(minlvl,maxlvl) ..".") doItemSetAttribute(sona, "aid", 500) --action ID da key que vc ganha na quest doSendMagicEffect(toPosition, 5) else local birita = doCreateMonster(PRESENT_BLUE[randomChance], toPosition, false, false, false) doItemSetAttribute(sona, "aid", getItemAttribute(sona, "aid")-1) --action ID da key que vc ganha na quest doItemSetAttribute(sona, "description", "This is a Corrupted Chest protected by ".. getItemAttribute(sona, "aid")-1 .." " .. PRESENT_BLUE[randomChance] .. " (Level: "..math.random(minlvl,maxlvl) ..".") doSendMagicEffect(toPosition, 65) addEvent(CheckBau, 1000) end end, 1000) end CheckBau() return true end CorruptedBau(13208, 1, 15, {"Rat", "Cave Rat"}, {2160, 2148, 2152}, math.random(1,30),2, 5) return true end Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. Editado Julho 22, 2018 6 anos por esnio12 nda (veja o histórico de edições)
Postado Julho 23, 2018 6 anos Usa storage mano... local function CheckBau() addEvent (function --cade o nome da função?() Editado Julho 23, 2018 6 anos por kiinho (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.