Postado Novembro 26, 2021 3 anos Autor 19 minutos atrás, Vodkart disse: gems = { id = {8635, 8636, 8633, 8634, 8635, 8636, 8633, 8634, 8635, 8636, 8633, 8634}, storage = {5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012}, interval = {800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800} } gemMsg = { rnd = {"´ . ,", ". ´ ,", "` . ,", ", ´ ."}, class_color = { [1] = {180,180}, [2] = {30,215}, [3] = {251,10}, [4] = {204,212}, [5] = {180,180}, [6] = {30,215}, [7] = {251,10}, [8] = {204,212}, [9] = {180,180}, [10] = {30,215}, [11] = {251,10}, [12] = {204,212} } } function doRemoveGemEffect(cid) local voc = getPlayerVocation(cid) setPlayerStorageValue(cid, gems.storage[voc], 0) end function doUseGem(cid, item) local level = getPlayerLevel(cid) local voc = getPlayerVocation(cid) local interval = gems.interval[voc] if item.itemid ~= gems.id[voc] or getPlayerStorageValue(cid, gems.storage[voc]) > 0 then return false end setPlayerStorageValue(cid, gems.storage[voc], 1) sendGemEffect(cid, gems.storage[voc], gems.interval[voc]) doRemoveItem(item.uid, 1) return true end function sendGemEffect(cid, storage, interval) if not isCreature(cid) then return LUA_ERROR end local pos = getThingPos(cid) local voc = getPlayerVocation(cid) local color = 1 local var = gemMsg.class_color[voc] if getPlayerLevel(cid) < 200 or not var then return true -- ja para o effect end local color = var[math.random(1,#var)] doSendAnimatedText(pos, gemMsg.rnd[math.random(1,#gemMsg.rnd)], color) if isGemActivated(cid) then addEvent(sendGemEffect, interval, cid, storage, interval) end end function doRemoveAllGemEffect(cid) for i = 1, table.maxn(gms.storage) do setPlayerStorageValue(cid, gems.storage[i], 0) end return true end function isGemActivated(cid) local voc = getPlayerVocation(cid) return getPlayerStorageValue(cid, gems.storage[voc]) > 0 and true or false end Aconteceu 2 coisas, O efeito da gema só funciona quando eu relogo o personagem gostaria de quando já desse use no crystal já começaria a sair o efeito... Há já ia me esquecendo o sistema possui uma checagem em login.lua Spoiler -- Gema System if getPlayerStorageValue(cid, 21202) > 0 then local voc = getPlayerVocation(cid) if getPlayerPromotionLevel(cid) > 0 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end if getPlayerStorageValue(cid, gems.storage[voc]) > 0 then sendGemEffect(cid, gems.storage[voc], gems.interval[voc]) end end Outra erro é que quando dou use com a vocação novas (9,10,11,12) retorna a mensagem da actions Você precisa estar promovido para usar a gema! Já para as outras vocações está funcionando... Acredito que seja na parte da action do scripts... Spoiler function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerGroupId(cid) > 2 and getPlayerGroupId(cid) < 5 then return true end local voc = getPlayerVocation(cid) if getPlayerPromotionLevel(cid) > 1 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end gem = gems.id[voc] if item.itemid == gem then if getPlayerLevel(cid) < 350 then doCreatureSay(cid,"É necessário level 350 ou maior para absorver uma gema espiritual!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) else if getPlayerPromotionLevel(cid) > 0 then if getPlayerStorageValue(cid,21202) == -1 then setPlayerStorageValue(cid,21202,1) doUseGem(cid, item) doCreatureSay(cid,"Você absorveu uma gema espiritual!",TALKTYPE_ORANGE_1) doSendMagicEffect(getPlayerPosition(cid),65) else doCreatureSay(cid,"Você ainda possui uma gema espiritual absorvida!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) end else doCreatureSay(cid,"Você precisa estar promovido para usar a gema!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) end end else doCreatureSay(cid,"Ops!! Crystal errado, procure da sua vocação!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) return false end return true end
Postado Novembro 26, 2021 3 anos Exato, como eu alterei a lib eu teria que alterar os demais códigos... enfim... LIB gems = { id = {8635, 8636, 8633, 8634, 8635, 8636, 8633, 8634, 8635, 8636, 8633, 8634}, storage = {5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012}, interval = {800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800} } gemMsg = { rnd = {"´ . ,", ". ´ ,", "` . ,", ", ´ ."}, class_color = { [1] = {180,180}, [2] = {30,215}, [3] = {251,10}, [4] = {204,212}, [5] = {180,180}, [6] = {30,215}, [7] = {251,10}, [8] = {204,212}, [9] = {180,180}, [10] = {30,215}, [11] = {251,10}, [12] = {204,212} } } function doRemoveGemEffect(cid) local voc = getPlayerVocation(cid) setPlayerStorageValue(cid, gems.storage[voc], 0) end function doUseGem(cid, item) local voc = getPlayerVocation(cid) local interval = gems.interval[voc] sendGemEffect(cid, gems.storage[voc], gems.interval[voc]) doRemoveItem(item.uid, 1) return true end function sendGemEffect(cid, storage, interval) if not isCreature(cid) then return LUA_ERROR end local pos = getThingPos(cid) local voc = getPlayerVocation(cid) local color = 1 local var = gemMsg.class_color[voc] if getPlayerLevel(cid) < 200 or not var or not isGemActivated(cid) then return true -- ja para o effect end local color = var[math.random(1,#var)] doSendAnimatedText(pos, gemMsg.rnd[math.random(1,#gemMsg.rnd)], color) if isGemActivated(cid) then addEvent(sendGemEffect, interval, cid, storage, interval) end end function doRemoveAllGemEffect(cid) for i = 1, table.maxn(gms.storage) do setPlayerStorageValue(cid, gems.storage[i], 0) end return true end function isGemActivated(cid) local voc = getPlayerVocation(cid) return getPlayerStorageValue(cid, gems.storage[voc]) > 0 and true or false end LOGIN -- Gema System if getPlayerStorageValue(cid, 21202) > 0 then local voc = getPlayerVocation(cid) if getPlayerStorageValue(cid, gems.storage[voc]) > 0 then sendGemEffect(cid, gems.storage[voc], gems.interval[voc]) end end ACTION function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerGroupId(cid) > 2 and getPlayerGroupId(cid) < 5 then return true end local voc = getPlayerVocation(cid) local gem = gems.id[voc] if item.itemid == gem then if getPlayerLevel(cid) < 350 then doCreatureSay(cid,"É necessário level 350 ou maior para absorver uma gema espiritual!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) return true elseif getPlayerStorageValue(cid,21202) > 0 then doCreatureSay(cid,"Você ainda possui uma gema espiritual absorvida!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) return true end setPlayerStorageValue(cid, 21202,1) setPlayerStorageValue(cid, gems.storage[voc], 1) doUseGem(cid, item) doCreatureSay(cid,"Você absorveu uma gema espiritual!",TALKTYPE_ORANGE_1) doSendMagicEffect(getPlayerPosition(cid),65) return true else doCreatureSay(cid,"Ops!! Crystal errado, procure da sua vocação!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) return true end return true end [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Novembro 26, 2021 3 anos Autor 43 minutos atrás, Vodkart disse: Exato, como eu alterei a lib eu teria que alterar os demais códigos... enfim... LIB gems = { id = {8635, 8636, 8633, 8634, 8635, 8636, 8633, 8634, 8635, 8636, 8633, 8634}, storage = {5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012}, interval = {800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800} } gemMsg = { rnd = {"´ . ,", ". ´ ,", "` . ,", ", ´ ."}, class_color = { [1] = {180,180}, [2] = {30,215}, [3] = {251,10}, [4] = {204,212}, [5] = {180,180}, [6] = {30,215}, [7] = {251,10}, [8] = {204,212}, [9] = {180,180}, [10] = {30,215}, [11] = {251,10}, [12] = {204,212} } } function doRemoveGemEffect(cid) local voc = getPlayerVocation(cid) setPlayerStorageValue(cid, gems.storage[voc], 0) end function doUseGem(cid, item) local voc = getPlayerVocation(cid) local interval = gems.interval[voc] sendGemEffect(cid, gems.storage[voc], gems.interval[voc]) doRemoveItem(item.uid, 1) return true end function sendGemEffect(cid, storage, interval) if not isCreature(cid) then return LUA_ERROR end local pos = getThingPos(cid) local voc = getPlayerVocation(cid) local color = 1 local var = gemMsg.class_color[voc] if getPlayerLevel(cid) < 200 or not var or not isGemActivated(cid) then return true -- ja para o effect end local color = var[math.random(1,#var)] doSendAnimatedText(pos, gemMsg.rnd[math.random(1,#gemMsg.rnd)], color) if isGemActivated(cid) then addEvent(sendGemEffect, interval, cid, storage, interval) end end function doRemoveAllGemEffect(cid) for i = 1, table.maxn(gms.storage) do setPlayerStorageValue(cid, gems.storage[i], 0) end return true end function isGemActivated(cid) local voc = getPlayerVocation(cid) return getPlayerStorageValue(cid, gems.storage[voc]) > 0 and true or false end LOGIN -- Gema System if getPlayerStorageValue(cid, 21202) > 0 then local voc = getPlayerVocation(cid) if getPlayerStorageValue(cid, gems.storage[voc]) > 0 then sendGemEffect(cid, gems.storage[voc], gems.interval[voc]) end end ACTION function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerGroupId(cid) > 2 and getPlayerGroupId(cid) < 5 then return true end local voc = getPlayerVocation(cid) local gem = gems.id[voc] if item.itemid == gem then if getPlayerLevel(cid) < 350 then doCreatureSay(cid,"É necessário level 350 ou maior para absorver uma gema espiritual!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) return true elseif getPlayerStorageValue(cid,21202) > 0 then doCreatureSay(cid,"Você ainda possui uma gema espiritual absorvida!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) return true end setPlayerStorageValue(cid, 21202,1) setPlayerStorageValue(cid, gems.storage[voc], 1) doUseGem(cid, item) doCreatureSay(cid,"Você absorveu uma gema espiritual!",TALKTYPE_ORANGE_1) doSendMagicEffect(getPlayerPosition(cid),65) return true else doCreatureSay(cid,"Ops!! Crystal errado, procure da sua vocação!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) return true end return true end Funcionou perfeito, muito obrigado! Só mais uma alteração que gostaria Quando o player usar o crystal da sua vocação falaria o nome da magia da vocação dele. Segue abaixo. magias = { [1] = {zesshou hachimon}, [2] = {jukai kousan}, [3] = {mugen shiki}, [4] = {yahumuki}, [5] = {zesshou hachimon}, [6] = {jukai kousan}, [7] = {mugen shiki}, [8] = {yahumuki}, [9] = {zesshou hachimon}, [10] = {jukai kousan}, [11] = {mugen shiki}, [12] = {yahumuki} } Exemplo Você absorveu uma gema espiritual (zesshou hachimon)! Teria como fazer essa alteração, valeuu
Postado Novembro 26, 2021 3 anos Solução local magias = { [1] = "zesshou hachimon", [2] = "jukai kousan", [3] = "mugen shiki", [4] = "yahumuki", [5] = "zesshou hachimon", [6] = "jukai kousan", [7] = "mugen shiki", [8] = "yahumuki", [9] = "zesshou hachimon", [10] = "jukai kousan", [11] = "mugen shiki", [12] = "yahumuki" } function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerGroupId(cid) > 2 and getPlayerGroupId(cid) < 5 then return true end local voc = getPlayerVocation(cid) local gem = gems.id[voc] if item.itemid == gem then if getPlayerLevel(cid) < 350 then doCreatureSay(cid,"É necessário level 350 ou maior para absorver uma gema espiritual!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) return true elseif getPlayerStorageValue(cid,21202) > 0 then doCreatureSay(cid,"Você ainda possui uma gema espiritual absorvida!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) return true end setPlayerStorageValue(cid, 21202,1) setPlayerStorageValue(cid, gems.storage[voc], 1) doUseGem(cid, item) doCreatureSay(cid,"Você absorveu uma gema espiritual ("..magias[voc]..")!",TALKTYPE_ORANGE_1) doSendMagicEffect(getPlayerPosition(cid),65) return true else doCreatureSay(cid,"Ops!! Crystal errado, procure da sua vocação!",TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 2) return true end return true end [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
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.