Postado Fevereiro 15, 2020 5 anos Como eu faço para ganhar multiplos items ao atingir certo lvl? não to conseguindo de jeito nenhum, se eu boto tudo no lvl 8 só ganha o ultimo item da lista, to querendo por para os players que saem de rook. local table = { -- [level] = type = "item", id = {ITEM_ID, QUANTIDADE}, msg = "MENSAGEM"}, -- [level] = type = "bank", id = {QUANTIDADE, 0}, msg = "MENSAGEM"}, -- [level] = type = "addon", id = {ID_ADDON_FEMALE, ID_ADDON_MALE}, msg = "MENSAGEM"}, -- [level] = type = "mount", id = {ID_MOUNT, 0}, msg = "MENSAGEM"}, [7] = {type = "item", id = {2190, 1}, msg = "Voce ganhou 1 wand of vortex por alcancar o level 8! guarde ate sair de rook se for sorcerer"}, [8] = {type = "item", id = {2182, 1}, msg = "Voce ganhou 1 snakebite rod por alcancar o level 8! guarde ate sair de rook se for druid"}, [3] = {type = "item", id = {8602, 1}, msg = "Voce ganhou 1 jagged sword por alcancar o level 8! guarde ate sair de rook se for knight"}, [6] = {type = "item", id = {2428, 1}, msg = "Voce ganhou 1 orcish axe por alcancar o level 8! guarde ate sair de rook se for knight"}, [5] = {type = "item", id = {2439, 1}, msg = "Voce ganhou 1 daramian mace por alcancar o level 8! guarde ate sair de rook se for knight"}, [4] = {type = "item", id = {2389, 1}, msg = "Voce ganhou 1 spear por alcancar o level 8! guarde ate sair de rook se for paladin"}, [8] = {type = "item", id = {10318, 1}, msg = "Voce ganhou 1 shield Nevermourn por alcancar o level 8! guarde ate sair de rook"}, [9] = {type = "bank", id = {5000, 0}, msg = "Foi depositado em seu bank 5000 gold coints!"}, [100] = {type = "addon", id = {136, 128}, msg = "Voce ganhou o addon citizen full por alcancar o level 100!"}, [10] = {type = "mount", id = {13, 0}, msg = "Voce ganhou a montaria Donkey para te ajudar nessa grande aventura!"}, } local storage = 16000 function onAdvance(player, skill, oldLevel, newLevel) if skill ~= SKILL_LEVEL or newLevel <= oldLevel then return true end for level, _ in pairs(table) do if newLevel >= level and player:getStorageValue(storage) < level then if table[level].type == "item" then player:addItem(table[level].id[1], table[level].id[2]) elseif table[level].type == "bank" then player:setBankBalance(player:getBankBalance() + table[level].id[1]) elseif table[level].type == "addon" then player:addOutfitAddon(table[level].id[1], 3) player:addOutfitAddon(table[level].id[2], 3) elseif table[level].type == "mount" then player:addMount(table[level].id[1]) else return false end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, table[level].msg) player:setStorageValue(storage, level) end end player:save() return true end
Postado Agosto 27, 2021 3 anos Em 11/02/2015 em 20:25, luanluciano93 disse: Olá pessoal, para quem não sabe esse script dá determinado item, quantidade / bank / addon / mount em determinado level. Crie um arquivo com o nome recompensa.lua em creaturescripts/scripts e coloque isso dentro: local table = { -- [level] = type = "item", id = {ITEM_ID, QUANTIDADE}, msg = "MENSAGEM"}, -- [level] = type = "bank", id = {QUANTIDADE, 0}, msg = "MENSAGEM"}, -- [level] = type = "addon", id = {ID_ADDON_FEMALE, ID_ADDON_MALE}, msg = "MENSAGEM"}, -- [level] = type = "mount", id = {ID_MOUNT, 0}, msg = "MENSAGEM"}, [20] = {type = "item", id = {2160, 2}, msg = "Voce ganhou 2 crystal coins por alcancar o level 20!"}, [30] = {type = "bank", id = {20000, 0}, msg = "Foi depositado em seu bank 20000 gold coints!"}, [40] = {type = "addon", id = {136, 128}, msg = "Voce ganhou o addon citizen full por alcancar o level 40!"}, [60] = {type = "mount", id = {2, 0}, msg = "Voce ganhou a montaria x!"}, } local storage = 15000 function onAdvance(player, skill, oldLevel, newLevel) if skill ~= SKILL_LEVEL or newLevel <= oldLevel then return true end for level, _ in pairs(table) do if newLevel >= level and player:getStorageValue(storage) < level then if table[level].type == "item" then player:addItem(table[level].id[1], table[level].id[2]) elseif table[level].type == "bank" then player:setBankBalance(player:getBankBalance() + table[level].id[1]) elseif table[level].type == "addon" then player:addOutfitAddon(table[level].id[1], 3) player:addOutfitAddon(table[level].id[2], 3) elseif table[level].type == "mount" then player:addMount(table[level].id[1]) else return false end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, table[level].msg) player:setStorageValue(storage, level) end end player:save() return true end E em creaturescripts.xml adcione a tag: <event type="advance" name="Recompensa" script="recompensa.lua"/> Caso queira colocar outro basta colocar usar os exemplos que coloquei como comentário (--) e adicionar a linha inteira novamente ... Dúvidas postem aqui! Abraços VEEEY VC TERIA ESSE SCRIPT " EM REVSCRIPT " MEU TFS E 1.4 .... QUERIA MUITO ELE . VALENDO + REP
Postado Outubro 22, 2022 2 anos muito bom, fiz uma pequena adaptação para funcionar em tfs 1.0x que não usa o arquivo xml e funcionou bem, obrigado!! mas infelizmente parou de funcionar não sei pq '-'kk afe Editado Novembro 11, 2022 2 anos por kleytonbm (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.