Postado Julho 9, 2015 9 anos Olá pessoal da Tk A algum tempo venho usando um sistema de gemas, ele funciona mais ou menos assim: Você clica em um determinado item que é dividido entre vocações (Druid, Sorc, Kina e Pally), cada vocação tem a sua chamada "gema" e ao clicar nela ativa-se a sua função. Gemas > Efeito que sai ao usar (cada voc tem sua cor) > Enfim, esse sistema funciona através de uma lib e um action e é aí que entra o meu pedido: Gostaria de reproduzir esse mesmo sistema com as mesmas funções, más com um efeito diferente. O script que eu tentei usar no lugar, faz com que saiam distanceEffects em volta do char, como mostra neste vídeo: https://www.youtube.com/watch?v=m0vt9NUCuiw Eu tentei de vários modos, mas como eu não sou muito bom com scripts, não deu certo , nessas tentativas eu usei uma parte do script do xWhiteWolf do post; http://www.tibiaking.com/forum/topic/47038-gran-castle-event-854/ function onLogin(cid) if getPlayerGroupId(cid) >= 3 and isPlayer(cid) then local events = {} local sec = 0.5 local temp = getCreatureOutfit(cid) if (type(temp) == "number") then return true end local pos = getPlayerPosition (cid) local effectPositions = { {x = pos.x - 1, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y + 1, z = pos.z}, {x = pos.x +1, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y -1, z = pos.z} } doSendDistanceShoot(effectPositions[math.random(#effectPositions)], effectPositions[math.random(#effectPositions)], 31) local event = addEvent(function() if isCreature(cid) then end end, 3.0 * sec * 450) events[cid] = event end return TRUE end Ou também: function onLogin(cid) if getPlayerGroupId(cid) >= 3 and isPlayer(cid) then local tempo = 0.5 --- de quanto em quanto segundos ele solta o efeito function loop (cid) local pos = getPlayerPosition (cid) local effectPositions = { {x = pos.x - 1, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y + 1, z = pos.z}, {x = pos.x +1, y = pos.y, z = pos.z}, {x = pos.x, y = pos.y -1, z = pos.z} } if not isPlayer(cid) then stopEvent(loop) end doSendDistanceShoot(effectPositions[math.random(#effectPositions)], effectPositions[math.random(#effectPositions)], 31) addEvent(function() if isPlayer(cid) then loop(cid) end end, 1000 * tempo) return true end loop(cid) end return TRUE end O esquema seria assim: A Gema de Kina (yellow gem id 2154) irá usar o distanceEffect 24 (WHIRLWINDSWORD) A Gema de Pally (blue gem id 2158) irá usar o efeito18 (REDSTAR) A Gema de Druid (Green gem id 2155) irá usar o efeito 31 (SUDDENDEATH) A Gema de Sorc (Red gem 2156) irá usar o efeito 35 (ENERGYBALL) E aqui a lib e os scripts do sistema da Gema: Lib: gems = { id = {2156, 2155, 2158, 2154, 2156, 2155, 2158, 2154, 2156, 2155, 2158, 2154}, storage = {5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012}, interval = {600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600} } 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} } function doRemoveGemEffect(cid) local voc = getPlayerVocation(cid) if getPlayerPromotionLevel(cid) > 0 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end if getPlayerStorageValue(cid, gems.storage[voc]) == -1 then else setPlayerStorageValue(cid, gems.storage[voc], 0) end end function doUseGem(cid, item) local level = getPlayerLevel(cid) local voc = getPlayerVocation(cid) local interval = gems.interval[voc] if getPlayerPromotionLevel(cid) > 0 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end 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 isPlayer(cid) == TRUE then local pos = getThingPos(cid) local voc = getPlayerVocation(cid) local level = getPlayerLevel(cid) local color = 1 if level > 199 then if getPlayerPromotionLevel(cid) > 0 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end 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[voc]) >= 1 then addEvent(sendGemEffect, interval, cid, storage, interval) end else stopEvent(sendGemEffect) 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) if getPlayerPromotionLevel(cid) > 0 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end if getPlayerStorageValue(cid, gems.storage[voc]) > 0 then return TRUE end return FALSE end return TRUE 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) if getPlayerPromotionLevel(cid) > 0 then voc = voc - (getPlayerPromotionLevel(cid) * 4) end gem = gems.id[voc] if item.itemid == gem then if getPlayerLevel(cid) < 200 then doPlayerSendTextMessage(cid,22,"É necessário level 200 ou maior para absorver uma gema espiritual!") else if getPlayerPromotionLevel(cid) > 0 then if getPlayerStorageValue(cid,21202) == -1 then setPlayerStorageValue(cid,21202,1) doUseGem(cid, item) doPlayerSendTextMessage(cid,22,"Você absorveu uma gema espiritual!") doSendMagicEffect(getPlayerPosition(cid),65) else doPlayerSendTextMessage(cid,22,"Você ainda possui uma gema espiritual absorvida.") end else doPlayerSendTextMessage(cid,22,"Você precisa estar promovido para usar a gema.") end end else return false end return true end E a tag no login.lua: 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 @up Editado Julho 14, 2015 9 anos por eviltox (veja o histórico de edições)
Postado Julho 9, 2015 9 anos Usando meu vídeo como exemplo Hum. Ser gosta do foxworld que está on dnv. -- Voltando ao Tópico -- vou fazer as mudança e testa no meu Server. Se funcionar eu posto aqui. Se ti ajudei. Marque como Melhor Resposta e agradeça com um Rep+, clicando em Gostei!. Obrigado!
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.