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

Potion Charges

Dyker

New Member
Joined
Sep 12, 2008
Messages
97
Reaction score
1
Hi people, I was thinking about the non stackable mana potions on 8.54 and i thought if it's possible that make it?

Some script that when you use mana potion on other mana potion makes a mana potion with 2 charges and his weight got's multiplies by 2? And if it's possible when you do look on that you could see:

21:45 You see a mana potion. (Charges: 1)
It weighs 1.80 oz.

21:45 You see a mana potion. (Charges: 2)
It weighs 3.60 oz.

Ty
 
LUA:
local config = { 
    removeOnUse = "no", 
    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.splashable = getBooleanFromString(config.splashable) 
config.realAnimation = getBooleanFromString(config.realAnimation) 

local POTIONS = { 
    [8704] = {charges = 100, empty = 7636, splash = 2, health = {50, 100}}, -- small health potion 
    [7618] = {charges = 100, empty = 7636, splash = 2, health = {100, 200}}, -- health potion 
    [7588] = {charges = 100, empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8, 12, 11}, vocStr = "knights and paladins"}, -- strong health potion 
    [7591] = {charges = 100, empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8, 12}, vocStr = "knights"}, -- great health potion 
    [8473] = {charges = 100, empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8, 12}, vocStr = "knights"}, -- ultimate health potion 

    [7620] = {charges = 100, empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion 
    [7589] = {charges = 100, 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] = {charges = 100, empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6, 9, 10}, vocStr = "sorcerers and druids"}, -- great mana potion 

    [8472] = {charges = 100, empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, 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)) 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) 

    doItemSetAttribute(item.uid, 'aid', math.max(101, item.actionid + 1)) 
    if item.actionid >= 100 + potion.charges then 
        doRemoveItem(item.uid) 
    end 
    return true 
end
 
mmmmm this is not exactly what i want cos all potions have 100 charges.. I don't want this I want when you use a mana potion on another mana potion it becomes to mana potion with 2 charges and you can see that on look like.

23:09 You see a mana potion. (charges: 2)
It weighs 1.80 oz.

can it be possible?
 
no that means that each potion is 100 charged so its still the same price but u use the potion 100 times until it disappears test it and u will see that its better :)
 
Yes i tried it but i find 2 problems here, i don't know how many charges got and it's impossible find potions with 1 charges?
 
Yeah i see that but i really don know what to do. I use item editor and spr editor or like that and i put to stackable all kind of potions but it doesnt works..
 
Yes i found it but it's not what i want coz all the potions have charges. I want something like stackable, when you use a mana potion on another mana potion makes a mana potion with 2 charges.
 
Yes i found it but it's not what i want coz all the potions have charges. I want something like stackable, when you use a mana potion on another mana potion makes a mana potion with 2 charges.

Impossible in pre 8.6 versions (without .dat changes)
 
LUA:
local t = {
	[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, 12, 11}, vocStr = 'knights and paladins'}, -- strong health potion
	[7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8, 12}, vocStr = 'knights'}, -- great health potion
	[8473] = {empty = 7635, splash = 2, health = {800, 1000}, 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 = {200, 300}, level = 80, vocations = {1, 2, 5, 6, 9, 10}, vocStr = 'sorcerers and druids'}, -- great mana potion

	[8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7, 11}, vocStr = 'paladins'} -- great spirit potion
}

local function f(item, aid, name)
	doItemSetAttribute(item, 'aid', aid)
	doItemSetAttribute(item, 'name', name .. ' (Charges: ' .. aid .. ')')
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(itemEx.uid) == false then
		local ext = t[itemEx.itemid]
		if ext and item.uid ~= itemEx.uid then
			if item.itemid == itemEx.itemid then
				if itemEx.actionid < 100 then
					local name, a, b = getItemInfo(item.itemid).name,
						math.max(1, item.actionid),
						math.max(1, itemEx.actionid)
					if a + b > 100 then
						f(item.uid, item.actionid - (a - b), name)
					else
						doRemoveItem(item.uid)
					end
					f(itemEx.uid, math.min(100, a + b), name)
					doSendMagicEffect(toPosition, CONST_ME_HOLYDAMAGE)
				else
					doCreatureSay(cid, 'You cannot stack more than 100 potions.', TALKTYPE_ORANGE_1, false, cid)
				end
			else
				doCreatureSay(cid, 'You can only merge potions of the same type.', TALKTYPE_ORANGE_1, false, cid)
			end
			return true
		end
		return
	end

	local potion = t[item.itemid]
	if (potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not table.find(potion.vocations, getPlayerVocation(cid)))
	then
		return doCreatureSay(itemEx.uid, 'Only ' .. potion.vocStr .. (potion.level and (' of level ' .. potion.level) or '') .. ' or above may drink this fluid.', TALKTYPE_ORANGE_1)
	end

	if potion.health then
		doCreatureAddHealth(itemEx.uid, math.random(unpack(potion.health)))
	end

	if potion.mana then
		doPlayerAddMana(itemEx.uid, math.random(unpack(potion.mana))) 
	end

	doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
	doCreatureSay(itemEx.uid, 'Aaaah...', TALKTYPE_ORANGE_1)

	if item.actionid > 1 then
		f(item.uid, item.actionid - 1, getItemInfo(item.itemid).name)
	else
		doRemoveItem(item.uid)
	end
	return true
end
I hope nobody's stupid enough to try this in 8.60
 
Back
Top