Ir para conteúdo

[Action] Potion System Sem Bugs.


MatheusGlad

Posts Recomendados

Bem eu tava jogando um ot, ai eu usava potion e adicionava umas 300 mana fluid separadas na minha bp e dava pra eu usar potion de mage em um kina, ai eu fiz um sistema de potion pra nao dar mais esse bug pra postar ai:

 

Vá em data/actions/scripts/liquids, abra o script potions.lua, e mude para esse script:

local all = {1,2,3,4,5,7,6,8} -- All Vocations.

local potions = {
[7620] = {vocations = all, emptypotion = 7636, mana = {70, 130}},
[7589] = {level = 50, vocations = {1, 2, 3, 5, 6, 7}, emptypotion = 7634, mana = {110, 190}},
[7590] = {level = 80, vocations = {1, 2, 5, 6}, emptypotion = 7635, mana = {200, 300}},
[8704] = {vocations = all, emptypotion = 7636, health = {50, 100}},
[7618] = {vocations = all, emptypotion = 7636, health = {100, 200}},
[7588] = {level = 50, vocations = {3, 4, 7, 8}, emptypotion = 7634, health = {200, 400}},
[7591] = {level = 80, vocations = {4, 8}, emptypotion = 7635, health = {500, 700}},
[8473] = {level = 130, vocations = {4, 8}, emptypotion = 7635, health = {800, 1000}},
[8472] = {level = 80, vocations = {3, 7}, emptypotion = 7635, health = {200, 400}, mana = {110, 190}},
}

local potionc = "transform" -- Use "transform" to transform into a empty potion, "remove" to remove the potion, "infinty" to infinit potion.

function getVocNames(tab)
   function getVocName(v)
       return isInArray({1, 5}, v) and "sorcerers" or isInArray({2, 6}, v) and "druids" or isInArray({3,7}, v) and "paladins" or isInArray({4,8}, v) and "knights" or ""
   end
   for i = 1, #tab do
       if not string.find((a == nil and "" or a), getVocName(tab[i])) then
           a = a and a .. " and " .. getVocName(tab[i]) or getVocName(tab[i])
       end
   end
return a
end

function onUse(cid, item, fromPosition, itemEx, toPosition) 
   if isPlayer(itemEx.uid) then
       if getPlayerAccess(cid) >= 4 or isInArray(potions[item.itemid].vocations, getPlayerVocation(itemEx.uid)) and getPlayerLevel(itemEx.uid) >= (potions[item.itemid].level == nil and 0 or potions[item.itemid].level) and getPlayerLevel(cid) >= (potions[item.itemid].level == nil and 0 or potions[item.itemid].level) then
           if potions[item.itemid].mana then
               doCreatureAddMana(itemEx.uid, math.random(potions[item.itemid].mana[1], potions[item.itemid].mana[2]))
           end

           if potions[item.itemid].health then
               doCreatureAddHealth(itemEx.uid, math.random(potions[item.itemid].health[1], potions[item.itemid].health[2]))
           end

           if potionc == "transform" then
               if getPlayerItemById(cid, TRUE, potions[item.itemid].emptypotion).uid ~= 0 then
                   if getPlayerItemById(cid, TRUE, potions[item.itemid].emptypotion).type < 100 then 
                       doTransformItem(getPlayerItemById(cid, TRUE, potions[item.itemid].emptypotion).uid, potions[item.itemid].emptypotion, getPlayerItemById(cid, TRUE, potions[item.itemid].emptypotion).type+1)
                       doRemoveItem(item.uid, 1)
                   else
                       doPlayerAddItem(cid, potions[item.itemid].emptypotion, 1)
                       doRemoveItem(item.uid, 1)
                   end
               else
                   doPlayerAddItem(cid, potions[item.itemid].emptypotion, 1)
                   doRemoveItem(item.uid, 1)
               end
           elseif potionc == "remove" then
               doRemoveItem(item.uid, 1)
           end

           doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
       else
           return doCreatureSay(itemEx.uid, "Only " .. getVocNames(potions[item.itemid].vocations) .. (potions[item.itemid].level and " of level " .. potions[item.itemid].level .. " or above " or " ") .. "may drink this fluid.", TALKTYPE_ORANGE_1)
       end
   end
return TRUE
end

 

Bem é so isso mesmo, kkk a configuraçao eh bem facilzinha de fazer e voce pode adicionar pra healar mana e health nos potions tranquilo.

 

Nao da rep nao, aperta o botao do Eu recomendo! que eh melhor :D

Link para o comentário
Compartilhar em outros sites

  • 8 months later...
  • 4 months later...
×
×
  • Criar Novo...