Ir para conteúdo
  • Cadastre-se

(Resolvido)[Ajuda]Pots infinitos


Ir para solução Resolvido por crupie,

Posts Recomendados

Fala galera tudo bem?

 

Eu criei um server recentemente e estou tendo um probleminha, venho procurando isso a um tempo e nao acho nenhuma soluçao para o meu problema.

 

 

Meu servidor esta com poçoes infinitas, eu ja mudei o meu potions para remover ao usar.

deem uma olhada no meu potions.lua

 

 

local config = {

removeOnUse = "yes",
usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
splashable = "no",
realAnimation = "yes", -- make text effect visible only for players in range 1x1
healthMultiplier = 1.4,
manaMultiplier = 1.7
}
 
config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)
 
local POTIONS = {
[8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion
[7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion
[7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 1, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, -- strong health potion
[7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 1, vocations = {4, 8}, vocStr = "knights"}, -- great health potion
[8473] = {empty = 7635, splash = 2, health = {950, 1250}, level = 1, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion
 
[7620] = {empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion
[7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 1, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
[7590] = {empty = 7635, splash = 7, mana = {600, 675}, level = 1, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion
 
[8472] = {empty = 7635, splash = 3, health = {550, 850}, mana = {450, 550}, level = 1, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}
 
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = POTIONS[item.itemid]
if(not potion) then
return false
end
 
if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
if(not config.splashable) then
return false
end
 
if(toPosition.x == CONTAINER_POSITION) then
toPosition = getThingPos(item.uid)
end
 
doDecayItem(doCreateItem(2016, potion.splash, toPosition))
doTransformItem(item.uid, potion.empty)
return true
end
 
if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return true
end
 
if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
then
doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
return true
end
 
local health = potion.health
if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
return false
end
 
local mana = potion.mana
if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
return false
end
 
if isInArray({8704, 7618, 7588, 7591, 8473}, item.itemid) then
doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...", 180)
elseif isInArray({7620, 7589, 7590, 8472}, item.itemid) then
doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...", 17)
end
doSendMagicEffect(getThingPos(itemEx.uid), 30)
if realAnimation then
for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
if(isPlayer(tid)) then
end
end
end
 
doAddCondition(cid, exhaust)
if(not potion.empty or config.removeOnUse) then
doRemoveItem(item.uid, 1)
return true
end
end

 

Se alguem souber onde que eu possa mudar para remover as pots infinitas, favor me indicar.

 

Obrigado

Editado por crupie (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Tenta este.

 

 

 

local config = {
removeOnUse = "yes",
usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
splashable = "no",
realAnimation = "no", -- make text effect visible only for players in range 1x1
healthMultiplier = 1.0,
manaMultiplier = 1.0
}
 
config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)
 
local POTIONS = {
[8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion
[7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion
[7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
[7591] = {empty = 7635, splash = 2, health = {450, 550}, level = 80, vocations = {4, 8, 12}, vocStr = "knights"}, -- great health potion
[8473] = {empty = 7635, splash = 2, health = {860, 890}, level = 130, vocations = {4, 8, 12}, vocStr = "knights"}, -- ultimate health potion
 
[7620] = {empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion
[7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7, 9, 10, 11}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
[7590] = {empty = 7635, splash = 7, mana = {350, 410}, level = 80, vocations = {1, 2, 5, 6, 9, 10}, vocStr = "sorcerers and druids"}, -- great mana potion
 
[8472] = {empty = 7635, splash = 3, health = {360, 450}, mana = {350, 390}, level = 80, vocations = {3, 7, 11}, vocStr = "paladins"} -- great spirit potion
}
 
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = POTIONS[item.itemid]
if(not potion) then
return false
end
 
if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
if(not config.splashable) then
return false
end
 
if(toPosition.x == CONTAINER_POSITION) then
toPosition = getThingPos(item.uid)
end
 
doDecayItem(doCreateItem(2016, potion.splash, toPosition))
doTransformItem(item.uid, potion.empty)
return true
end
 
if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return true
end
 
if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
then
doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
return true
end
 
local health = potion.health
if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
return false
end
 
local mana = potion.mana
if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
return false
end
 
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
if(not realAnimation) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
else
for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
if(isPlayer(tid)) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
end
end
end
 
doAddCondition(cid, exhaust)
if(not potion.empty or config.removeOnUse) then
doRemoveItem(item.uid, 1)
return true
end
doRemoveItem(item.uid, 1)
     doPlayerAddItem(cid, potion.empty, 1)
return true
end

Editado por igorcbc (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
esse tbn nao funcionou...

 

Tenta este.

 

 

 

local config = {
removeOnUse = "yes",
usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
splashable = "no",
realAnimation = "no", -- make text effect visible only for players in range 1x1
healthMultiplier = 1.0,
manaMultiplier = 1.0
}
 
config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)
 
local POTIONS = {
[8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion
[7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion
[7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
[7591] = {empty = 7635, splash = 2, health = {450, 550}, level = 80, vocations = {4, 8, 12}, vocStr = "knights"}, -- great health potion
[8473] = {empty = 7635, splash = 2, health = {860, 890}, level = 130, vocations = {4, 8, 12}, vocStr = "knights"}, -- ultimate health potion
 
[7620] = {empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion
[7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7, 9, 10, 11}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
[7590] = {empty = 7635, splash = 7, mana = {350, 410}, level = 80, vocations = {1, 2, 5, 6, 9, 10}, vocStr = "sorcerers and druids"}, -- great mana potion
 
[8472] = {empty = 7635, splash = 3, health = {360, 450}, mana = {350, 390}, level = 80, vocations = {3, 7, 11}, vocStr = "paladins"} -- great spirit potion
}
 
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = POTIONS[item.itemid]
if(not potion) then
return false
end
 
if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
if(not config.splashable) then
return false
end
 
if(toPosition.x == CONTAINER_POSITION) then
toPosition = getThingPos(item.uid)
end
 
doDecayItem(doCreateItem(2016, potion.splash, toPosition))
doTransformItem(item.uid, potion.empty)
return true
end
 
if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return true
end
 
if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
then
doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
return true
end
 
local health = potion.health
if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
return false
end
 
local mana = potion.mana
if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
return false
end
 
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
if(not realAnimation) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
else
for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
if(isPlayer(tid)) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
end
end
end
 
doAddCondition(cid, exhaust)
if(not potion.empty or config.removeOnUse) then
doRemoveItem(item.uid, 1)
return true
end
doRemoveItem(item.uid, 1)
     doPlayerAddItem(cid, potion.empty, 1)
return true
end

 

 

 

alguma outra dica?

Editado por crupie (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Não apresenta nenhum erro no console ? nem nada ? um Duplicate? algo do tipo ? 

 

 

Amigo procure pela Great Mana potion do seu servidor e mude para esta ve se funciona.  ( APENAS COM ELA)

 

local MIN = 550
local MAX = 750
local EMPTY_POTION = 7635
 
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isPlayer(itemEx.uid) == FALSE then
return FALSE
end
 
if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end
 
if((not(isSorcerer(itemEx.uid) or isDruid(itemEx.uid)) or getPlayerLevel(itemEx.uid) < 80) and getPlayerCustomFlagValue(itemEx.uid, PlayerCustomFlag_GamemasterPrivileges) == FALSE) then
doCreatureSay(itemEx.uid, "Only sorcerers and druids of level 80 or above may drink this fluid.", TALKTYPE_ORANGE_1)
return TRUE
end
 
if doPlayerAddMana(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
return FALSE
end
 
doAddCondition(cid, exhaust)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid, 1)
     doPlayerAddItem(cid, EMPTY_POTION, 1)
return TRUE
end

Editado por igorcbc (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

igorcbc
 
Entao, no meu potion.lua nao tem essa parte somente para a great mana potion, ele é uma forma geral para as potions todas, olha isso:

function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = POTIONS[item.itemid]
if(not potion) then
return false
end
 
if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
if(not config.splashable) then
return false
end
 
if(toPosition.x == CONTAINER_POSITION) then
toPosition = getThingPos(item.uid)
end
 
doDecayItem(doCreateItem(2016, potion.splash, toPosition))
doTransformItem(item.uid, potion.empty)
return true
end
 
if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return true
end
 
if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
then
doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
return true
end
 
local health = potion.health
if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
return false
end
 
local mana = potion.mana
if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
return false
end
 
if isInArray({8704, 7618, 7588, 7591, 8473}, item.itemid) then
doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...", 180)
elseif isInArray({7620, 7589, 7590, 8472}, item.itemid) then
doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...", 17)
end
doSendMagicEffect(getThingPos(itemEx.uid), 30)
if realAnimation then
for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
if(isPlayer(tid)) then
end
end
end
 
doAddCondition(cid, exhaust)
if(not potion.empty or config.removeOnUse) then
doRemoveItem(item.uid, 1)
return true
end
end

 

E sao todas as pots que estao infinitas, nao somente a great mana pot.

 

E nao, nao da nenhum erro no console, é como se fosse natural o pot infinito

 

Obrigado.


Alguem mais alguma dica?


Alguem sabe o que mais pode ser feito???

Editado por crupie (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Alguem para me ajudar? Ainda nao consegui resolver meu problema!!!

Link para o post
Compartilhar em outros sites
  • Solução

Alguma alma boa aqui que pode me ajudar???


Eu acabei de descobrir que meu TFS ta usando um script dentro da pasta other, o script potions.lua a seguid:

 

 

local ultimateHealthPot = 8473

local greatHealthPot = 7591
local greatManaPot = 7590
local greatSpiritPot = 8472
local strongHealthPot = 7588
local strongManaPot = 7589
local healthPot = 7618
local manaPot = 7620
local smallHealthPot = 8704
local antidotePot = 8474
local greatEmptyPot = 7635
local strongEmptyPot = 7634
local emptyPot = 7636
 
local antidote = createCombatObject()
setCombatParam(antidote, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(antidote, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(antidote, COMBAT_PARAM_TARGETCASTERORTOPMOST, TRUE)
setCombatParam(antidote, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(antidote, COMBAT_PARAM_DISPEL, CONDITION_POISON)
 
local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))
-- 1000 - 100 due to exact condition timing. -100 doesn't hurt us, and players don't have reminding ~50ms exhaustion.
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if itemEx.itemid ~= 1 or itemEx.type ~= THING_TYPE_PLAYER then
                return true
        end
 
        if(getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == true) then
                doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
                return true
        end
 
        if(item.itemid == antidotePot) then
                if(doCombat(itemEx.uid, antidote, numberToVariant(itemEx.uid)) == LUA_ERROR) then
                        return false
                end
                doAddCondition(cid, exhaust)
                doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
                doRemoveItem(item.uid, 0)
                doPlayerAddItem(cid, emptyPot, 0)
        elseif(item.itemid == smallHealthPot) then
                if(doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, 50, 100, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
                        return false
                end
                doAddCondition(cid, exhaust)
                doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
                doRemoveItem(item.uid, 0)
                doPlayerAddItem(cid, emptyPot, 0)
        elseif(item.itemid == healthPot) then
                if(doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, 100, 200, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
                        return false
                end
                doAddCondition(cid, exhaust)
                doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
                doRemoveItem(item.uid, 0)
                doPlayerAddItem(cid, emptyPot, 0)
        elseif(item.itemid == manaPot) then
                if(doTargetCombatMana(0, itemEx.uid, 70, 130, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
                        return false
                end
                doAddCondition(cid, exhaust)
                doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
                doRemoveItem(item.uid, 0)
                doPlayerAddItem(cid, emptyPot, 0)
        elseif(item.itemid == strongHealthPot) then
                if(not(isKnight(itemEx.uid) or isPaladin(itemEx.uid)) or (getPlayerLevel(itemEx.uid) < 50)) and not(getPlayerGroupId(itemEx.uid) >= 2) then
                        doCreatureSay(itemEx.uid, "This potion can only be consumed by paladins and knights of level 50 or higher.", TALKTYPE_ORANGE_1)
                        return true
                end
 
                if(doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, 200, 400, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
                        return false
                end
                doAddCondition(cid, exhaust)
                doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
                doRemoveItem(item.uid, 0)
                doPlayerAddItem(cid, strongEmptyPot, 0)
        elseif(item.itemid == strongManaPot) then
                if(not(isSorcerer(itemEx.uid) or isDruid(itemEx.uid) or isPaladin(itemEx.uid)) or (getPlayerLevel(itemEx.uid) < 50)) and not(getPlayerGroupId(itemEx.uid) >= 2) then
                        doCreatureSay(itemEx.uid, "This potion can only be consumed by sorcerers, druids and paladins of level 50 or higher.", TALKTYPE_ORANGE_1)
                        return true
                end
 
                if(doTargetCombatMana(0, itemEx.uid, 110, 190, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
                        return false
                end
                doAddCondition(cid, exhaust)
                doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
                doRemoveItem(item.uid, 0)
                doPlayerAddItem(cid, strongEmptyPot, 0)
        elseif(item.itemid == greatSpiritPot) then
                if(not(isPaladin(itemEx.uid)) or (getPlayerLevel(itemEx.uid) < 80)) and not(getPlayerGroupId(itemEx.uid) >= 2) then
                        doCreatureSay(itemEx.uid, "This potion can only be consumed by paladins of level 80 or higher.", TALKTYPE_ORANGE_1)
                        return TRUE
                end
 
                if(doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, 200, 400, CONST_ME_MAGIC_BLUE) == LUA_ERROR or doTargetCombatMana(0, itemEx.uid, 110, 190, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
                        return true
                end
                doAddCondition(cid, exhaust)
                doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
                doRemoveItem(item.uid, 0)
                doPlayerAddItem(cid, greatEmptyPot, 0)
        elseif(item.itemid == greatHealthPot) then
                if(not(isKnight(itemEx.uid)) or (getPlayerLevel(itemEx.uid) < 80)) and not(getPlayerGroupId(itemEx.uid) >= 2) then
                        doCreatureSay(itemEx.uid, "This potion can only be consumed by knights of level 80 or higher.", TALKTYPE_ORANGE_1)
                        return true
                end
 
                if(doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, 500, 700, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
                        return false
                end
                doAddCondition(cid, exhaust)
                doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
                doRemoveItem(item.uid, 0)
                doPlayerAddItem(cid, greatEmptyPot, 0)
        elseif(item.itemid == greatManaPot) then
                if(not(isSorcerer(itemEx.uid) or isDruid(itemEx.uid)) or (getPlayerLevel(itemEx.uid) < 80)) and not(getPlayerGroupId(itemEx.uid) >= 2) then
                        doCreatureSay(itemEx.uid, "This potion can only be consumed by sorcerers and druids of level 80 or higher.", TALKTYPE_ORANGE_1)
                        return true
                end
 
                if(doTargetCombatMana(0, itemEx.uid, 350, 450, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
                        return false
                end
                doAddCondition(cid, exhaust)
                doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
                doRemoveItem(item.uid, 0)
                doPlayerAddItem(cid, greatEmptyPot, 0)
        elseif(item.itemid == ultimateHealthPot) then
                if(not(isKnight(itemEx.uid)) or (getPlayerLevel(itemEx.uid) < 130)) and not(getPlayerGroupId(itemEx.uid) >= 2) then
                        doCreatureSay(cid, "This potion can only be consumed by knights of level 130 or higher.", TALKTYPE_ORANGE_1)
                        return true
                end
 
                if(doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, 750, 900, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
                        return false
                end
                doAddCondition(cid, exhaust)
                doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
                doRemoveItem(item.uid, 0)
                doPlayerAddItem(cid, greatEmptyPot, 0)
        end
        return true
end

Resolvi o meu problema atraves deste topico aqui:

http://www.tibiaking.com/forum/topic/47758-potionslua/

Topico fechado

Editado por crupie (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por Aluccard
      Olá!

      A pedidos de usuarios, resolvi fazer esse script simples e eficaz. Como o própio nome do tópico diz: Aol Inifinito.
      No script possui um config onde pode ser alterado o ammyID = id do amuleto, lossExp = player perder exp, lossItems = player perder items.

      newAol.lua

      local config = { ammyID = 2130, lossExp = false, lossItems = false } function onDeath(cid, lastHitKiller, mostDamageKiller) if isPlayer(cid) then if (getPlayerSlotItem(cid, 2).itemid == config.ammyID) then if (config.lossExp == false) then doPlayerSetLossPercent(cid, experience, 0) end doCreatureSetDropLoot(cid, config.lossItems) return true end end return true end creaturescripts.xml <event type="death" name="NewAol" event="script" value="newAol.lua"/> Adicione no login.lua essa linha perto dos outros registercreatures. registerCreatureEvent(cid, "NewAol")

      Obs¹: Esse script serve para todos os players inclusive RedSkulls/BlackSkulls.


      Qualquer dúvida é só postar!



      Atenciosamente,
      Aluccard.
    • Por llucas75
      Oi tudo bem galera do Tk?
       
      Eu gostaria de saber como eu ativo o display numérico das pots.. tipo ela cura 200 aparece em verde +200.. No meu ele cura e não aparece o display em verdinho.. acontece isso tanto com magia e pots como eu altero isso?
    • Por PedroPr
      Galera aonde modifico !para que os viials do potion desapareção ????
       
    • Por safdo
      Seguinte, no meu server eu uso runas infinitas, todas são infinitas... Com exceção de uma, a Destroy Field, já procurei em todos os lugares e não achei uma solução. Existe algum jeito de deixa-la infinita? (PS: é meu primeiro tópico se estiver errado mova por favor)
                 Esse é o script dela:
      function onUse(cid, item, frompos, item2, topos) fieldpos = topos fieldpos.stackpos = 254 fielditem = getThingfromPos(fieldpos) if getPlayerMagLevel(cid) >= 3 then if fielditem.itemid > 0 and fielditem.itemid ~= 1497 and fielditem.itemid ~= 1498 then doSendMagicEffect(topos,2) doRemoveItem(fielditem.uid,1) if item.type > 1 then doChangeTypeItem(item.uid,item.type-1) else doRemoveItem(item.uid,1) end else doSendMagicEffect(frompos,2) return 0 end else doSendMagicEffect(frompos,2) doPlayerSendCancel(cid,"You don't have the required magic level to use that rune.") end return 1 end
    • Por elinardo12
      Ola pessoal, queria saber se tinha como me ajudar a tirar os potions infinitos, já editei a config.lua e nada. achei esse script aqui queria saber se ele é o que está causando isso.
       
      local config = { -- strong health potion [7588] = {health = {250, 350}, vocations = {3, 4}, text = 'paladins and knights', level = 50, emptyId = 7634}, -- strong mana potion [7589] = {mana = {115, 185}, vocations = {1, 2, 3}, text = 'sorcerers, druids and paladins', level = 50, emptyId = 7634}, -- great mana potion [7590] = {mana = {150, 250}, vocations = {1, 2}, text = 'sorcerers and druids', level = 80, emptyId = 7635}, -- great health potion [7591] = {health = {425, 575}, vocations = {4}, text = 'knights', level = 80, emptyId = 7635}, -- health potion potion [7618] = {health = {125, 175}, emptyId = 7636}, -- mana potion potion [7620] = {mana = {75, 125}, emptyId = 7636}, -- great spirit potion [8472] = {health = {250, 350}, mana = {100, 200}, vocations = {3}, text = 'paladins', level = 80, emptyId = 7635}, -- ultimate health potion [8473] = {health = {650, 850}, vocations = {4}, text = 'knights', level = 130, emptyId = 7635}, -- antidote potion [8474] = {antidote = true, emptyId = 7636}, -- small health potion [8704] = {health = {60, 85}, emptyId = 7636} }   local antidote = Combat() antidote:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING) antidote:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) antidote:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true) antidote:setParameter(COMBAT_PARAM_AGGRESSIVE, false) antidote:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON)   local exhaust = Condition(CONDITION_EXHAUST_HEAL) exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100)) -- 1000 - 100 due to exact condition timing. -100 doesn't hurt us, and players don't have reminding ~50ms exhaustion.   function onUse(cid, item, fromPosition, itemEx, toPosition) local potion = config[item.itemid] if not potion then return true end   if itemEx.itemid ~= 1 or itemEx.type ~= THING_TYPE_PLAYER then return true end   local player = Player(cid) if player:getCondition(CONDITION_EXHAUST_HEAL) then player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED)) return true end   if potion.antidote and not antidote:execute(itemEx.uid, Variant(itemEx.uid)) then return false end   if (potion.level and player:getLevel() < potion.level) or (type(potion.vocations) == 'table' and not isInArray(potion.vocations, player:getVocation():getBase():getId())) and not (player:getGroup():getId() >= 2) then player:say(string.format('This potion can only be consumed by %s of level %d or higher.', potion.text, potion.level), TALKTYPE_MONSTER_SAY) return true end   if type(potion.health) == 'table' and not doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, potion.health[1], potion.health[2], CONST_ME_MAGIC_BLUE) then return false end   if type(potion.mana) == 'table' and not doTargetCombatMana(0, itemEx.uid, potion.mana[1], potion.mana[2], CONST_ME_MAGIC_BLUE) then return false end   local cStorage = player:getStorageValue(Storage.Achievements.PotionAddict) if cStorage < 100000 then player:setStorageValue(Storage.Achievements.PotionAddict, math.max(1, cStorage) + 1) elseif cStorage == 100000 then player:addAchievement('Potion Addict') player:setStorageValue(Storage.Achievements.PotionAddict, 100001) end   doCreatureSayWithRadius(itemEx.uid, 'Aaaah...', TALKTYPE_MONSTER_SAY, 2, 2, toPosition) setPlayerStorageValue(cid, 14582, getPlayerStorageValue(cid, 14582) + 1) Item(item.uid):remove(1) return true end   Se alguem poder ajudar, obrigado desde já.
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo