• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Potions.lua - Using ALL h/m potions on use

Romantix

Omnipotent
Joined
Apr 27, 2010
Messages
131
Reaction score
2
Location
Australia
Hi Fellow OT'ers.

Currently using TFS 0.3.6 - Tibia 8.60 downloaded from - vapusdotnet/forum/data-packs-226/8-60-real-server-ready-run-4035-3/#post29926

When I use for example, I will buy 100x+ mana or health potions, when I use 1x potion, it uses them all and returns flasks.

Also, it is not displaying "you are using sudden death rune, x amount remaining"

What other information is required to get some assistance?

This is my current potions.lua, provided by some members on the forum:

Code:
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}, vocStr = "knights and paladins"}, -- strong health potion
	[7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights"}, -- great health potion
	[8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, 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 = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
	[7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion
	[8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, 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
	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)
	doPlayerRemoveItem(cid, potion.empty, getPlayerItemCount(cid, potion.empty))
	doPlayerAddItem(cid, potion.empty, getPlayerItemCount(cid, potion.empty))
	return TRUE
end

P.S - Before flaming me, I have searched every thread regarding potions and flasks with no resolution.

Thanks in advance,

Romantix
 
Last edited:
Try with this:

Lua:
local config = {
removeOnUse = "yes",
usableOnTarget = "yes",
splashable = "no",
realAnimation = "no", 
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}},
[7618] = {empty = 7636, splash = 2, health = {100, 200}},
[7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, 
[7591] = {empty = 7635, splash = 2, health = {180, 230}, level = 80, vocations = {4, 8}, vocStr = "knights"}, 
[8473] = {empty = 7635, splash = 2, health = {200, 300}, level = 130, vocations = {4, 8}, vocStr = "knights"}, 

[7620] = {empty = 7636, splash = 7, mana = {70, 130}}, 
[7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, 
[7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, 

[8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7}, vocStr = "paladins"} 
}

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))
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)
return true
end

return true
end
 
if cypher's doesnt work here u go

Lua:
local config = {
removeOnUse = "no",
usableOnTarget = "no", -- can be used on target? (fe. healing friend)
splashable = "no",
range = -1,
realAnimation = "no", -- make text effect visible only for players in range 1x1
multiplier = {
          health = 1.0,
          mana = 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 = 42, health = {50, 100}}, -- small health potion
	[7618] = {splash = 42, health = {110, 270}, mana = {50, 70}},  -- health potion
	[7588] = {splash = 42, health = {500, 750}, level = 1, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
	[7591] = {splash = 42, health = {700, 900}, level = 8, vocations = {4, 8, 12}, vocStr = "knights"}, -- great health potion
	[8473] = {splash = 42, health = {1200, 1500}, level = 1, vocations = {4, 8, 12}, vocStr = "knights"}, -- ultimate health potion

	[7620] = {splash = 47, mana = {210, 290}}, -- mana potion
	[7589] = {splash = 47, mana = {400, 500}, level = 10, vocations = {1, 2, 3, 5, 6, 7, 9, 10, 11}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
	[7590] = {splash = 47, mana = {450, 650}, level = 8, vocations = {1, 2, 5, 6, 9, 10}, vocStr = "sorcerers and druids"}, -- great mana potion

	[8472] = {splash = 43, health = {500, 650}, mana = {280, 370}, level = 8, 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 = getThingPosition(item.uid)
		end


		if(fromPosition.x ~= CONTAINER_POSITION) then
			doCreateItem(potion.empty, fromPosition)
		else
			doPlayerAddItem(cid, potion.empty, 1)
		end

		return true
	end

	if(hasCondition(cid, CONDITION_EXHAUST)) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return true
	end

	if(((potion.level and getPlayerLevel(itemEx.uid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(itemEx.uid)))) 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

	if(config.range > 0 and cid ~= itemEx.uid and getDistanceBetween(getThingPosition(cid), getThingPosition(itemEx.uid)) > config.range) then
		return false
	end

	local health = potion.health
	if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.multiplier.health))) then
		return false
	end

	local mana = potion.mana
	if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.multiplier.mana))) then
		return false
	end

	doSendMagicEffect(getThingPosition(itemEx.uid), CONST_ME_MAGIC_BLUE)
	if(not config.realAnimation) then
	else
		for i, tid in ipairs(getSpectators(getThingPosition(itemEx.uid), 1, 1)) do
			if(isPlayer(tid)) then
			end
		end
	end


	return true
end
 
try last one
Lua:
local config = {
	removeOnUse = "no",
	usableOnTarget = "no", -- can be used on target? (fe. healing friend)
	splashable = "no",
	range = -1,
	realAnimation = "no", -- make text effect visible only for players in range 1x1
	multiplier = {
		health = 1.0,
		mana = 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 = 42, health = {50, 100}}, -- small health potion
	[7618] = {splash = 42, health = {110, 270}, mana = {50, 70}},  -- health potion
	[7588] = {splash = 42, health = {500, 750}, level = 1, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
	[7591] = {splash = 42, health = {700, 900}, level = 8, vocations = {4, 8, 12}, vocStr = "knights"}, -- great health potion
	[8473] = {splash = 42, health = {1200, 1500}, level = 1, vocations = {4, 8, 12}, vocStr = "knights"}, -- ultimate health potion

	[7620] = {splash = 47, mana = {210, 290}}, -- mana potion
	[7589] = {splash = 47, mana = {400, 500}, level = 10, vocations = {1, 2, 3, 5, 6, 7, 9, 10, 11}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
	[7590] = {splash = 47, mana = {450, 650}, level = 8, vocations = {1, 2, 5, 6, 9, 10}, vocStr = "sorcerers and druids"}, -- great mana potion

	[8472] = {splash = 43, health = {500, 650}, mana = {280, 370}, level = 8, 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 = getThingPosition(item.uid)
		end


		if(fromPosition.x ~= CONTAINER_POSITION) then
			doCreateItem(potion.empty, fromPosition)
		else
			doPlayerAddItem(cid, potion.empty, 1)
		end

		return true
	end

	if(hasCondition(cid, CONDITION_EXHAUST)) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return true
	end

	if(((potion.level and getPlayerLevel(itemEx.uid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(itemEx.uid)))) 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

	if(config.range > 0 and cid ~= itemEx.uid and getDistanceBetween(getThingPosition(cid), getThingPosition(itemEx.uid)) > config.range) then
		return false
	end

	local health = potion.health
	if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.multiplier.health))) then
		return false
	end

	local mana = potion.mana
	if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.multiplier.mana))) then
		return false
	end

	doSendMagicEffect(getThingPosition(itemEx.uid), CONST_ME_MAGIC_BLUE)
	if(not config.realAnimation) then
	else
		for i, tid in ipairs(getSpectators(getThingPosition(itemEx.uid), 1, 1)) do
			if(isPlayer(tid)) then
			end
		end
	end


	return true
end
 
That code you posted Rox666 will just work with 0.3 series.

Try using this one:
Lua:
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, (getConfigInfo('timeBetweenExActions') - 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.uid ~= cid or itemEx.itemid ~= 1) 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(cid, antidote, numberToVariant(cid)) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
		doPlayerAddItem(cid, emptyPot, 1)
	elseif(item.itemid == smallHealthPot) then
		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 50, 100, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
		doPlayerAddItem(cid, emptyPot, 1)
	elseif(item.itemid == healthPot) then
		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 100, 200, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
		doPlayerAddItem(cid, emptyPot, 1)
	elseif(item.itemid == manaPot) then
		if(doTargetCombatMana(0, cid, 70, 130, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
		doPlayerAddItem(cid, emptyPot, 1)
	elseif(item.itemid == strongHealthPot) then
		if(not(isKnight(cid) or isPaladin(cid)) or (getPlayerLevel(cid) < 50)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by paladins and knights of level 50 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end

		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 200, 400, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
		doPlayerAddItem(cid, strongEmptyPot, 1)
	elseif(item.itemid == strongManaPot) then
		if(not(isSorcerer(cid) or isDruid(cid) or isPaladin(cid)) or (getPlayerLevel(cid) < 50)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "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, cid, 110, 190, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
		doPlayerAddItem(cid, strongEmptyPot, 1)
	elseif(item.itemid == greatSpiritPot) then
		if(not(isPaladin(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by paladins of level 80 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end

		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 200, 400, CONST_ME_MAGIC_BLUE) == LUA_ERROR or doTargetCombatMana(0, cid, 110, 190, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
		doPlayerAddItem(cid, greatEmptyPot, 1)
	elseif(item.itemid == greatHealthPot) then
		if(not(isKnight(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by knights of level 80 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end

		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 500, 700, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
		doPlayerAddItem(cid, greatEmptyPot, 1)
	elseif(item.itemid == greatManaPot) then
		if(not(isSorcerer(cid) or isDruid(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by sorcerers and druids of level 80 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end

		if(doTargetCombatMana(0, cid, 200, 300, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
		doPlayerAddItem(cid, greatEmptyPot, 1)
	elseif(item.itemid == ultimateHealthPot) then
		if(not(isKnight(cid)) or (getPlayerLevel(cid) < 130)) and not(getPlayerGroupId(cid) >= 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, cid, COMBAT_HEALING, 800, 1000, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid, 1)
		doPlayerAddItem(cid, greatEmptyPot, 1)
	end
	return TRUE
end

And yes, you need to reload the scripts or restart the server to test the recently added script.
 
plzz i need help i want to change vial= mana fluid to " mana rune" i've changed the name but cant find the scripts anywhere to change it like you guys are doing above so i can change how much mana it give and stuff like that im using tfs 0.3.6 8.60 plzz help fast
:)
 
Back
Top