baiakizicksz 3 Postado Janeiro 27, 2012 Share Postado Janeiro 27, 2012 (editado) Bom resolvi fazer este tutorial por que eu procurava muito ate que baixei um ot e nele contia a sistema inteiro bom ele e comprido então vamos começar! Vá na pasta do seu ot entre em data/lib copie e cole qualquer arquivo .lua e renomeie ele para gems.lua dentro adicione isto: function onUse(cid, item, fromPosition, itemEx, toPosition) gem = gems.id[getPlayerVocation(cid)] if item.itemid == gem then doUseGem(cid, item, getPlayerVocation(cid)) end return TRUE end ainda na pasta lib copie e cole outro arquivo .lua e renomeie para pivi.lua dentro adicione isto: function doUseGem(cid, item) 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) local pos = getThingPos(cid) local voc = getPlayerVocation(cid) local color = 1 if voc == 1 then color = gemMsg.colorDruid[math.random(1,#gemMsg.colorElderDruid)] elseif voc == 2 then color = gemMsg.colorSorcerer[math.random(1,#gemMsg.colorMasterSorcerer)] elseif voc == 3 then color = gemMsg.colorPaladin[math.random(1,#gemMsg.colorRoyalPaladin)] elseif voc == 4 then color = gemMsg.colorKnight[math.random(1,#gemMsg.colorEliteKnight)] end doSendAnimatedText(pos, gemMsg.rnd[math.random(1,#gemMsg.rnd)], color) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) >= 1 then addEvent(sendGemEffect, interval, cid, storage, interval) end end function doRemoveGemEffect(cid) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) < 1 then return FALSE end setPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)], 0) return TRUE end function doRemoveAllGemEffect(cid) for i = 1, table.maxn(gms.storage) do setPlayerStorageValue(cid, gems.storage[i], 0) end return TRUE function isGemActivated(cid) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) > 0 then return TRUE end return FALSE end Ainda em lib copie otro arquivo cole e renomeie ele para pivi_const.lua detro adicione isto: gems = { id = {2156, 2155, 2158, 2154, 2156, 2155, 2158, 2154}, storage = {5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008}, interval = {750, 750, 750, 750, 750, 750, 750, 750}, -- Intervalo dos efeitos } gemMsg = { rnd = {"´ . ,", ". ´ ,", "` . ,", ", ` ."}, colorDruid = {180,180}, colorSorcerer = {30,215}, colorPaladin = {251,10}, colorKnight = {204,212}, colorElderDruid = {180,180}, colorMasterSorcerer = {30,215}, colorRoyalPaladin = {251,10}, colorEliteKnight = {204,212} } pronto agora vamos na pasta data/actions/scripte copie e cole qualquer arquivo.lua e renomeie ele para gems.lua adicione isto dentro: local config = { minLevel = 200, -- Level mínimo para adquirir a gema. } function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) >= config.minLevel then gem = gems.id[getPlayerVocation(cid)] if item.itemid == gem then doUseGem(cid, item, getPlayerVocation(cid)) doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você adquiriu uma gema espíritual.") doSendMagicEffect(getCreaturePosition(cid), 65) end else doPlayerSendCancel(cid, "Voc\ê precisa ser level "..config.minLevel.." para adquirir a gema esp\íritual.") end return TRUE end feito isto va no seu actions.xml e adicione os seguintes tags : <action itemid="2156" script="gems.lua" /> <action itemid="2155" script="gems.lua" /> <action itemid="2154" script="gems.lua" /> <action itemid="2158" script="gems.lua" /> feche e salve. Agora vamos na pasta data\creaturescripts\scripts copie e cole qualquer arquivo lua renomeie para logingema.lua dentro adicione isto: function onLogin(cid) setPlayerStorageValue(cid, 47112120, 2) local voc = getPlayerVocation(cid) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) > 0 then sendGemEffect(cid, gems.storage[voc], gems.interval[voc]) end return TRUE end feito isto abra o creaturescripts.xml e adicione este tag: <event value="logingema.lua" event="script" name="gema" type="login"/> agora na ultima parte va na pasta data/talkactions/scripts copie e cole qualquer arquivo lua e renomeie para gemasorc.lua dentro adicione isto: function onSay(cid, words, param) if(words == "!buygemasorcerer") then if(doPlayerRemoveMoney(cid, 1000000) == TRUE) then doPlayerAddItem(cid,2156,1) doSendMagicEffect(getCreaturePosition(cid),tmp, CONST_ME_MAGIC_RED) else doPlayerSendCancel(cid, "Você não tem o dinheiro suficiente.") return TRUE end elseif(words == "!sellaol") then if doPlayerRemoveItem(cid,2173,1) == TRUE then doPlayerAddMoney(cid, 10000) doSendMagicEffect(getCreaturePosition(cid),tmp, CONST_ME_MAGIC_RED) else doPlayerSendCancel(cid, "Você não tem o Amulet of Loss(AoL)") end end return TRUE end ainda em scripts copie e cole otro arquivo.lua e renomeie para gemapally.lua dentro adicione isto: function onSay(cid, words, param) if(words == "!buygemapally") then if(doPlayerRemoveMoney(cid, 1000000) == TRUE) then doPlayerAddItem(cid,2158,1) doSendMagicEffect(getCreaturePosition(cid),tmp, CONST_ME_MAGIC_RED) else doPlayerSendCancel(cid, "Você não tem o dinheiro suficiente.") return TRUE end elseif(words == "!sellaol") then if doPlayerRemoveItem(cid,2173,1) == TRUE then doPlayerAddMoney(cid, 10000) doSendMagicEffect(getCreaturePosition(cid),tmp, CONST_ME_MAGIC_RED) else doPlayerSendCancel(cid, "Você não tem o Amulet of Loss(AoL)") end end return TRUE end copie e cole qualquer arquivo.lua e renomeie para gemakina.lua dentro adicione isto: function onSay(cid, words, param) if(words == "!buygemakina") then if(doPlayerRemoveMoney(cid, 1000000) == TRUE) then doPlayerAddItem(cid,2154,1) doSendMagicEffect(getCreaturePosition(cid),tmp, CONST_ME_MAGIC_RED) else doPlayerSendCancel(cid, "Você não tem o dinheiro suficiente.") return TRUE end elseif(words == "!sellaol") then if doPlayerRemoveItem(cid,2173,1) == TRUE then doPlayerAddMoney(cid, 10000) doSendMagicEffect(getCreaturePosition(cid),tmp, CONST_ME_MAGIC_RED) else doPlayerSendCancel(cid, "Você não tem o Amulet of Loss(AoL)") end end return TRUE end ainda em scripts copie e cole qualquer arquivo.lua e renomeie para gemadruid.lua dentro adicione isto: function onSay(cid, words, param) if(words == "!buygemadruid") then if(doPlayerRemoveMoney(cid, 1000000) == TRUE) then doPlayerAddItem(cid,2155,1) doSendMagicEffect(getCreaturePosition(cid),tmp, CONST_ME_MAGIC_RED) else doPlayerSendCancel(cid, "Você não tem o dinheiro suficiente.") return TRUE end elseif(words == "!sellaol") then if doPlayerRemoveItem(cid,2173,1) == TRUE then doPlayerAddMoney(cid, 10000) doSendMagicEffect(getCreaturePosition(cid),tmp, CONST_ME_MAGIC_RED) else doPlayerSendCancel(cid, "Você não tem o Amulet of Loss(AoL)") end end return TRUE end agora para finalizar va no se talkactions.xml e adicione estas tags: <talkaction words="!buygemasorcerer" script="gemasorc.lua"/> <talkaction words="!buygemapally" script="gemapally.lua"/> <talkaction words="!buygemadruid" script="gemadruid.lua"/> <talkaction words="!buygemakina" script="gemakina.lua"/> e pronto e so vc ter 1kk ser level 200 e falar !buygema e sua vocaçao e voce ganhara uma gema ai e so clicar com o botao direito e vc vai começar a brilhar é isso pessoal caso ajudei rep+ se tiverem duvidas postem aqui que eu ajudo Editado e pronto para usar vlw por reportarem ^^ Editado Abril 27, 2012 por baiakizicksz Link para o comentário https://xtibia.com/forum/topic/179313-sistema-de-gema-espiritual-igual-do-foxworld/ Compartilhar em outros sites More sharing options...
Mythusz 10 Postado Fevereiro 26, 2012 Share Postado Fevereiro 26, 2012 Obrigado pelo conteúdo, apesar de não gostar do FoxWorld. REP + Link para o comentário https://xtibia.com/forum/topic/179313-sistema-de-gema-espiritual-igual-do-foxworld/#findComment-1206461 Compartilhar em outros sites More sharing options...
Alicq 0 Postado Fevereiro 28, 2012 Share Postado Fevereiro 28, 2012 Interessante. :XTibia_smile: Link para o comentário https://xtibia.com/forum/topic/179313-sistema-de-gema-espiritual-igual-do-foxworld/#findComment-1207586 Compartilhar em outros sites More sharing options...
Beeki 284 Postado Abril 7, 2012 Share Postado Abril 7, 2012 Muito bom cara, da uma revisada em alguns codes que estão bugados, e outra seria bem mais aproveitador ter postado esse sistema na sessão scripts, Abraços. Link para o comentário https://xtibia.com/forum/topic/179313-sistema-de-gema-espiritual-igual-do-foxworld/#findComment-1234120 Compartilhar em outros sites More sharing options...
Gabriel Couto 293 Postado Abril 15, 2012 Share Postado Abril 15, 2012 Aprovado, Parabéns, Continue Assim! Mostrou um bom conteúdo, que, com certeza, deverá ajudar muita gente. Movido para a Seção Correta! Link para o comentário https://xtibia.com/forum/topic/179313-sistema-de-gema-espiritual-igual-do-foxworld/#findComment-1241024 Compartilhar em outros sites More sharing options...
Sofft 5 Postado Abril 17, 2012 Share Postado Abril 17, 2012 (editado) @baiakizicksz, como o Beeki disse, bom script, mas precisa de revisão, (Toda vez que o players desloga tem muitos erros), to meio sem tempo agora para arrumar esses erros, se você puder arrumar a comunidade agradeceria. Sei que você copiou do seu OT, mas identação e bom né. Fora isso, Muito bom script! EDITED: Errado if voc == 1 then color = gemMsg.colorDruid[math.random(1,#gemMsg.colorElderDruid)] elseif voc == 2 then color = gemMsg.colorSorcerer[math.random(1,#gemMsg.colorMasterSorcerer)] elseif voc == 3 then color = gemMsg.colorPaladin[math.random(1,#gemMsg.colorRoyalPaladin)] elseif voc == 4 then color = gemMsg.colorKnight[math.random(1,#gemMsg.colorEliteKnight)] end Certo if voc == 1 or voc == 5 then color = gemMsg.colorSorcerer[math.random(1,#gemMsg.colorMasterSorcerer)] elseif voc == 2 voc == 6 then color = gemMsg.colorDruid[math.random(1,#gemMsg.colorElderDruid)] elseif voc == 3 voc == 7 then color = gemMsg.colorPaladin[math.random(1,#gemMsg.colorRoyalPaladin)] elseif voc == 4 voc == 8then color = gemMsg.colorKnight[math.random(1,#gemMsg.colorEliteKnight)] end e apos isto mude as cores do efeito ao seu gosto em pivi_const Editado Abril 17, 2012 por Sofft Link para o comentário https://xtibia.com/forum/topic/179313-sistema-de-gema-espiritual-igual-do-foxworld/#findComment-1243124 Compartilhar em outros sites More sharing options...
baiakizicksz 3 Postado Abril 24, 2012 Autor Share Postado Abril 24, 2012 Sim SIm foi erro na hora do post muito obrigado por reportar estarei arumando duvidas tamo aew Link para o comentário https://xtibia.com/forum/topic/179313-sistema-de-gema-espiritual-igual-do-foxworld/#findComment-1248079 Compartilhar em outros sites More sharing options...
Sofft 5 Postado Abril 24, 2012 Share Postado Abril 24, 2012 @baiakizicksz, arrumei todos os bugs, menos o bug quando o player desloga, porque, antes do player deslogar já foi criado um Event que ainda vai acontecer. provavelmente terá que ser feito um onPlayerLogout... não estou conseguindo, por favor ajude. Link para o comentário https://xtibia.com/forum/topic/179313-sistema-de-gema-espiritual-igual-do-foxworld/#findComment-1248084 Compartilhar em outros sites More sharing options...
baiakizicksz 3 Postado Abril 27, 2012 Autor Share Postado Abril 27, 2012 Sofft eu dei uma olhada nos scripts e tinha mais uns bugs eu arrumei teste de novo com esses! mais nao precisa de escript logout nao! Link para o comentário https://xtibia.com/forum/topic/179313-sistema-de-gema-espiritual-igual-do-foxworld/#findComment-1249897 Compartilhar em outros sites More sharing options...
Sofft 5 Postado Abril 28, 2012 Share Postado Abril 28, 2012 (editado) @baiakizicksz, testarei, jaja edito EDITED: A função PIVI ta faltando um end, o certo seria assim: function doUseGem(cid, item) 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) local pos = getThingPos(cid) local voc = getPlayerVocation(cid) local color = 1 if voc == 1 then color = gemMsg.colorDruid[math.random(1,#gemMsg.colorElderDruid)] elseif voc == 2 then color = gemMsg.colorSorcerer[math.random(1,#gemMsg.colorMasterSorcerer)] elseif voc == 3 then color = gemMsg.colorPaladin[math.random(1,#gemMsg.colorRoyalPaladin)] elseif voc == 4 then color = gemMsg.colorKnight[math.random(1,#gemMsg.colorEliteKnight)] end doSendAnimatedText(pos, gemMsg.rnd[math.random(1,#gemMsg.rnd)], color) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) >= 1 then addEvent(sendGemEffect, interval, cid, storage, interval) end end function doRemoveGemEffect(cid) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) < 1 then return FALSE end setPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)], 0) return TRUE 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) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) > 0 then return TRUE end return FALSE end e continua dando erros apos o player deslogar, mas nada que atrapalhe o server, (somente porque o avento ocorre em um player que não está mais online). Editado Abril 28, 2012 por Sofft Link para o comentário https://xtibia.com/forum/topic/179313-sistema-de-gema-espiritual-igual-do-foxworld/#findComment-1250035 Compartilhar em outros sites More sharing options...
andretoprox 3 Postado Abril 28, 2012 Share Postado Abril 28, 2012 @baiakizicksz, testarei, jaja edito Aproveita e posta SS? Link para o comentário https://xtibia.com/forum/topic/179313-sistema-de-gema-espiritual-igual-do-foxworld/#findComment-1250055 Compartilhar em outros sites More sharing options...
Sofft 5 Postado Abril 28, 2012 Share Postado Abril 28, 2012 (editado) Vou postar aqui minha versão desse script, eu peguei aqui com o baiakizicksz e editei, os créditos são do criador do script, que até então não conheço. Esta versão é usado no meu otserv da seguinte forma, player colocou vip ele brilha acabou a vip para de brilhar.=/ GEMS BY VIP. Pasta Lib { gems.lua function onUse(cid, item, fromPosition, itemEx, toPosition) gem = gems.id[getPlayerVocation(cid)] if item.itemid == gem then doUseGem(cid, item, getPlayerVocation(cid)) end return TRUE end pivi.lua function doUseGem(cid, item)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) local pos = getThingPos(cid) local voc = getPlayerVocation(cid) local color = 1 if voc == 9 then color = gemMsg.colorSorcerer[math.random(1,#gemMsg.colorMasterSorcerer)] elseif voc == 10 then color = gemMsg.colorDruid[math.random(1,#gemMsg.colorElderDruid)] elseif voc == 11 then color = gemMsg.colorPaladin[math.random(1,#gemMsg.colorRoyalPaladin)] elseif voc == 12 then color = gemMsg.colorKnight[math.random(1,#gemMsg.colorEliteKnight)] end doSendAnimatedText(pos, gemMsg.rnd[math.random(1,#gemMsg.rnd)], color) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) >= 1 then addEvent(sendGemEffect, interval, cid, storage, interval) end end function doRemoveGemEffect(cid) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) < 1 then return FALSE end setPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)], 0) return TRUE 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) if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) > 0 then return TRUE end return FALSE end pivi_const.lua gems = { id = {2156, 2155, 2158, 2154, 2156, 2155, 2158, 2154}, storage = {5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008}, interval = {750, 750, 750, 750, 750, 750, 750, 750}, -- Intervalo dos efeitos } gemMsg = { rnd = {"´ . ,", ". ´ ,", "` . ,", ", ` ."}, colorDruid = {30,215}, colorSorcerer = {180,200}, colorPaladin = {251,10}, colorKnight = {204,212}, colorElderDruid = {30,215}, colorMasterSorcerer = {180,200}, colorRoyalPaladin = {251,10}, colorEliteKnight = {204,212} } } Pasta CreatureScripts { abra o arquivo login.lua, e antes do ultimo Return TRUE adicione isso: if (vip.hasVip(cid) == TRUE) then setPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)], 1) sendGemEffect(cid, gems.storage[getPlayerVocation(cid)], 750) end } Editado Abril 28, 2012 por Sofft Link para o comentário https://xtibia.com/forum/topic/179313-sistema-de-gema-espiritual-igual-do-foxworld/#findComment-1250068 Compartilhar em outros sites More sharing options...
ewertonsilva157 5 Postado Outubro 15, 2012 Share Postado Outubro 15, 2012 poo, to dando use na gema e nao ta funfando, até pede lvl 200.. mais n ta funfando. tb pra comprar n funfou, fiz direitinho pa.. estranho isso.. preciso desse script aqui no meu ot.. n sei pq n ta funfando, e por incrivel que pareça nao tem nenhum bug no distro! Link para o comentário https://xtibia.com/forum/topic/179313-sistema-de-gema-espiritual-igual-do-foxworld/#findComment-1364156 Compartilhar em outros sites More sharing options...
KrownOT 0 Postado Novembro 9, 2019 Share Postado Novembro 9, 2019 (editado) @Sofftpoderia atualizar esse script para TFS 1.3? Editado Novembro 10, 2019 por KrownOT Link para o comentário https://xtibia.com/forum/topic/179313-sistema-de-gema-espiritual-igual-do-foxworld/#findComment-1754640 Compartilhar em outros sites More sharing options...
Posts Recomendados