• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

No more vials when buying potions.

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
7,030
Solutions
256
Reaction score
2,118
Location
Norway
GitHub
Znote
This work for at least evolution.xml [0.7.8], and all TFS SQL servers from the 0.2 series. [At least from 0.2.4]

Enter data\actions\scripts\other and open potions.lua

Remove
Code:
		doTransformItem(item.uid, emptyPot)
same goes to:
Code:
		doTransformItem(item.uid, strongEmptyPot)
and:
Code:
		doTransformItem(item.uid, greatEmptyPot)
And replace those lines with:
Code:
		doRemoveItem(item.uid,1)

Then when you click on the potion, you will drink the potion, and the vial will be removed automatic.
No more vials.

With this, you don't need any npc that buys vials at all, since there won't exist any vials.
[only the old vials you got when you where drinking the potions before you added this script.]

I'm just here to help you guys who think vials are annoying worthless items.

Any questions just ask.

For thoose of you who use Nharuto's potion system: [8.2, 8.21, 8.22]

Remove
Code:
            doTransformItem(item.uid, HealthP.trans)
Code:
            doTransformItem(item.uid, ManaP.trans)
Code:
            doTransformItem(item.uid, BothP.trans)

And replace those lines with:
Code:
		doRemoveItem(item.uid,1)

For lazy ass dudes who use Nharuto's potion script, or any other similar script, here is the finishing result:

Just copy and paste to your script:
PHP:
local HealthPotions = {
    [8377] = {min=800,max=1000,trans=7635,lvl=130,voc={4,8}},
    [7591] = {min=500,max=700,trans=7635,lvl=80,voc={4,8}},
    [7588] = {min=200,max=400,trans=7634,lvl=50,voc={3,4,7,8}},
    [7618] = {min=100,max=200,trans=7636,lvl=8,voc={1,2,3,4,5,6,7,8}}
}
local ManaPotions = {
    [7590] = {min=200,max=300,trans=7635,lvl=80,voc={1,2,5,6}},
    [7589] = {min=110,max=190,trans=7634,lvl=50,voc={1,2,3,5,6,7}},
    [7620] = {min=70,max=130,trans=7636,lvl=8,voc={1,2,3,4,5,6,7,8}}
}
local BothPotions = {
    [8472] = {hmin=200,hmax=400,mmin=110,mmax=190,trans=7635,lvl=80,voc={3,7}}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if itemEx.uid ~= cid or itemEx.itemid ~= 1 then
        return TRUE
    end
    local HealthP = HealthPotions[item.itemid]
    local ManaP = ManaPotions[item.itemid]
    local BothP = BothPotions[item.itemid]
    if HealthP then
        if isInArray(HealthP.voc, getPlayerVocation(cid)) == TRUE and getPlayerLevel(cid) >= HealthP.lvl or getPlayerGroupId(cid) >= 2 then
            if(doTargetCombatHealth(0, cid, COMBAT_HEALING, HealthP.min, HealthP.max, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
                return FALSE
            end
            doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid,1)
        else
            doCreatureSay(cid, "This potion can only be consumed by " .. getVocationsName(HealthP.voc) .. " of level " .. HealthP.lvl .. " or higher.", TALKTYPE_ORANGE_1)
        end
    elseif ManaP then
  if isInArray(ManaP.voc, getPlayerVocation(cid)) == TRUE and getPlayerLevel(cid) >= ManaP.lvl or getPlayerGroupId(cid) >= 2 then
            if(doTargetCombatMana(0, cid, ManaP.min, ManaP.max, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
                return FALSE
            end
            doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid,1)
        else
            doCreatureSay(cid, "This potion can only be consumed by " .. getVocationsName(ManaP.voc) .. " of level " .. ManaP.lvl .. " or higher.", TALKTYPE_ORANGE_1)
        end
    elseif BothP then
        if isInArray(BothP.voc, getPlayerVocation(cid)) == TRUE and getPlayerLevel(cid) >= BothP.lvl or getPlayerGroupId(cid) >= 2 then
            if(doTargetCombatHealth(0, cid, COMBAT_HEALING, BothP.hmin, BothP.hmax, CONST_ME_MAGIC_BLUE) == LUA_ERROR or doTargetCombatMana(0, cid, BothP.mmin, BothP.max, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
                return FALSE
            end
            doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid,1)
        else
            doCreatureSay(cid, "This potion can only be consumed by " .. getVocationsName(BothP.voc) .. " of level " .. BothP.lvl .. " or higher.", TALKTYPE_ORANGE_1)
        end
    end
return TRUE
end
 
Last edited:
well, its working fine for my pvp-e server.. Good job :)
 
This script is for people who think it isn't neccesary, who thinks vials are innoying items that just lies on the ground.
Removing vials will improove the server, it will have a bit less lag, since if you run the server for 2 days without cleaning, there will most likely be tons of empty vials on the floor.

If you need vials, etc for summoner addon, then simply make a npc that sells empty vials, A tip is to maybe add empty vials to a foodtype that you don't use? For an example salomon? And add a npc that sell that kind of food.

nice script. bad idea.


Can you explain why this is a bad idea? I think its useful.

And ofc, if you don't like this, you don't have to add it :p
 
Last edited:
mm for my tfs it doesnt work right the potion just like stay there any dont leave like unlimited potions xD so ima just put it back to the regular way :/
 
Seems like you forgot to add
Code:
		doRemoveItem(item.uid,1)

If your using TFS, Enter data\actions\scripts\other and open potions.lua
delete everything inside, and paste this in:
Code:
local greatHealthPot = 7591
local greatManaPot = 7590
local strongHealthPot = 7588
local strongManaPot = 7589
local healthPot = 7618
local manaPot = 7620
local greatEmptyPot = 7635
local strongEmptyPot = 7634
local emptyPot = 7636

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if itemEx.uid ~= cid or itemEx.itemid ~= 1 then
		return TRUE
	end

	if(item.itemid == healthPot) then
		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 170, 230, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
            doRemoveItem(item.uid,1)

	elseif(item.itemid == manaPot) then
		if(doTargetCombatMana(0, cid, 85, 150, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
            doRemoveItem(item.uid,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, 300, 500, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
            doRemoveItem(item.uid,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, 100, 200, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
            doRemoveItem(item.uid,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, 800, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
            doRemoveItem(item.uid,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, 350, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
            doRemoveItem(item.uid,1)
	end

	return TRUE
end

It works 100%. No bugs, vial dissapear when drinking.
 
Yes it does, but you have to configure it by yourself.

how to do it with aries 0.4.5:
Enter the potions.lua folder, or fluids.lua, or whatever your potion/fluid scripts belong to:

Remove
Code:
		doTransformItem(item.uid, emptyPot)
same goes to:
Code:
		doTransformItem(item.uid, strongEmptyPot)
and:
Code:
		doTransformItem(item.uid, greatEmptyPot)
And replace thoose lines with:
Code:
		doRemoveItem(item.uid,1)

Then when you click on the potion, you will drink the potion, and the vial will be removed automatic.
No more vials.

This method works with pretty much all servers. Since all you need is
Code:
		doRemoveItem(item.uid,1)
and this code is very common.
 
thx for this
was usefull :)
i found that best way to solve summoner addon was to just to sell the ticket for 20 mana potions xD
that way no vials and cost 1k per ticket..
u could have for only 10 mana potions which is 500gp, but i think it should be a bit more expensive than real tibs because u dont have to keep your old vials which is pain in th a$$

thx again
 
Yep, there you see :p

Its extremely simple actually, I have no expereince in lua scripts, its just that I saw the lua function and found out how easy it is to use it.
 
Thx

Thx alo Znote this is a big improvment for the server 100% less lagg...
/Danne
 
It looks nice if you are using a 100x exp server and you get magic plate armor every demon..
 
Then you can't sell the vials and get the summoner addon ;X

It looks nice if you are using a 100x exp server and you get magic plate armor every demon..
I have exp x9-x5 (mpa = 350k and ~1/30 demons drop MPA) and use script like this. On every server 100-200 levels have too much money and want get high magic levels. After 3 weeks of OTS I had 230,000 items in houses. 180,000 empty potions...
 
I have exp x9-x5 (mpa = 350k and ~1/30 demons drop MPA) and use script like this. On every server 100-200 levels have too much money and want get high magic levels. After 3 weeks of OTS I had 230,000 items in houses. 180,000 empty potions...

That means you have botters in your server (Macro Recorders)
 

Similar threads

Back
Top