• 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!

Buff Potions (Solved)

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,857
Reaction score
96
Location
Brazil
All we know Berserk Potion, Bullseye Potion and Mastermind Potion.
In tibia rl you can't use one of then if you have buff of another.
How can I make it works?


LUA:
  <action itemid="7439" event="script" value="liquids/berserk_potion.lua"/>
	<action itemid="7440" event="script" value="liquids/mastermind_potion.lua"/>
	<action itemid="7443" event="script" value="liquids/bullseye_potion.lua"/>


bullseye_potion
LUA:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 30 * 60 * 1000) -- 10 minutes
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, 5)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, -10)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(doAddCondition(cid, condition)) then
		doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED)
		doRemoveItem(item.uid)
	end

	return true
end

berserk_potion
LUA:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10 * 60 * 1000) -- 10 minutes
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEE, 5)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, -10)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(doAddCondition(cid, condition)) then
		doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED)
		doRemoveItem(item.uid)
	end

	return true
end
mastermind_potion
LUA:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10 * 60 * 1000) 
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, 3)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, -10)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(not isSorcerer(cid) and not isDruid(cid)) then
		doCreatureSay(cid, "Only sorcerers and druids may drink this fluid.", TALKTYPE_ORANGE_1, cid)
		return true
	end

	if(doAddCondition(cid, condition)) then
		doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED)
		doRemoveItem(item.uid)
		doCreatureSay(cid, "You feel smarter.", TALKTYPE_ORANGE_1, cid)
	end

	return true
end
 
Last edited:
temporary storage? ;|

when use the potions, check the storage (same storage to all 'buff potions')
If the value is > = 1 return
If the value is < 1 run the script...

I think if you use storage will work.
 
try to add this to your scripts

Code:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10 * 60 * 1000) 
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, 3)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, -10)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(not isSorcerer(cid) and not isDruid(cid)) then
      [COLOR="red"][B]if (getPlayerStorageValue(cid, 9001) == 1) then[/B][/COLOR]
		doCreatureSay(cid, "Only sorcerers and druids may drink this fluid.", TALKTYPE_ORANGE_1, cid)
		end
		return true
	end
 
	if(doAddCondition(cid, condition)) then
		doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED)
		doRemoveItem(item.uid)
		[COLOR="red"][B]setPlayerStorageValue(cid, 9001, 1)[/B][/COLOR]
		doCreatureSay(cid, "You feel smarter.", TALKTYPE_ORANGE_1, cid)
	end
 
	return true
end
 
mastermind_potion
LUA:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10 * 60 * 1000) 
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, 3)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, -10)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local storage = 23000 -- set free storage

	if(not isSorcerer(cid) or not isDruid(cid)) then
		doCreatureSay(cid, "Only sorcerers and druids may drink this fluid.", TALKTYPE_ORANGE_1, cid)
		return true
	end
	
	if exhaustion.check(cid, storage) == false then	
		if(doAddCondition(cid, condition)) then
			exhaustion.set(cid, storage, 10 * 60 * 1000)
			doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED)
			doRemoveItem(item.uid)
			doCreatureSay(cid, "You feel smarter.", TALKTYPE_ORANGE_1, cid)
		end
	else
		doPlayerSendCancel(cid, "You can't drink it now.")
	end
 
	return true
end

berserk_potion
LUA:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10 * 60 * 1000) -- 10 minutes
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEE, 5)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, -10)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local storage = 23000 -- set free storage

	if(not isKnight(cid)) then
		doCreatureSay(cid, "Only knights may drink this fluid.", TALKTYPE_ORANGE_1, cid)
		return true
	end

	if exhaustion.check(cid, storage) == false then	
		if(doAddCondition(cid, condition)) then
			exhaustion.set(cid, storage, 10 * 60 * 1000)
			doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED)
			doRemoveItem(item.uid)
		end
	else
		doPlayerSendCancel(cid, "You can't drink it now.")
	end
 
	return true
end

bullseye_potion
LUA:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 30 * 60 * 1000) -- 10 minutes
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, 5)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, -10)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local storage = 23000 -- set free storage

	if(not isPaladin(cid)) then
		doCreatureSay(cid, "Only paladins  may drink this fluid.", TALKTYPE_ORANGE_1, cid)
		return true
	end
	
	if exhaustion.check(cid, storage) == false then	
		if(doAddCondition(cid, condition)) then
			exhaustion.set(cid, storage, 10 * 60 * 1000)
			doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED)
			doRemoveItem(item.uid)
		end
	else
		doPlayerSendCancel(cid, "You can't drink it now.")
	end
 
	return true
end



All storages must be the same.
 
Last edited:

Similar threads

Back
Top