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

[Request] Remove potion when used [Solved]

DX~

New Member
Joined
Mar 29, 2008
Messages
148
Reaction score
0
Hello

When a player use the potions is transformed to empty vial, and I want that when using potion be deleted.

What is the function that delete an item?

Example in potions.lua:
PHP:
		doTransformItem(item.uid, emptyPot)

Thanks in advance
 
Last edited:
If you're using The Forgotten Server look at LUA_FUNCTIONS in the doc folder (open it with Notepad). It will tell you if your server has this function:
PHP:
doPlayerRemoveItem(cid,itemid,count)

If it does then do it like this:
PHP:
doTransformItem(item.uid, emptyPot)
doPlayerRemoveItem(cid, emptyPot, 1)
I'm pretty sure that would work, if not just reply back. :D

Jo3
 
Last edited:
Thanks Jo3Bingham it work :D, but in mana pot and ultimate health pot no :/ i dont know why, i think all the code is right, take a look:

Ultimate Health Potion:
PHP:
doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, greatEmptyPot)
		doPlayerRemoveItem(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

Mana Potion:
PHP:
doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, emptyPot)
		doPlayerRemoveItem(cid, emptyPot, 1)
	elseif(item.itemid == manaPot) then
		if(doTargetCombatMana(0, cid, 70, 130, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end

What's wrong?
 
Does it transform the potion to an empty vial? If it doesn't then the empty vial ID is wrong at the top of the script. If it does transform the potion then I'm not sure :huh:. Give me a minute to test it on my server.

*EDIT*
The potion code starts at if or elseif so it should be like this:
PHP:
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)
		doTransformItem(item.uid, emptyPot)
        doPlayerRemoveItem(cid, emptyPot, 1)
and:
PHP:
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)
		doTransformItem(item.uid, greatEmptyPot)
        doPlayerRemoveItem(cid, emptyPot, 1)
*EDIT* If it still doesn't work I attached my potions.lua file at the bottom, you can download it and use it.

Jo3
 

Attachments

Last edited:
Back
Top