• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Potions Disappear without vial

benjiz69

New Member
Joined
Jun 11, 2009
Messages
89
Reaction score
0
Need to know how to make a health potions/mana potions etc disappear after you use them. Can someone help?

Cheers.
 
THIS SCRIPT CREATE EMPTY FLASK

Example with health potion

There is this line

doTransformItem(item.uid, EMPTY_POTION)

Code:
local MIN = 100
local MAX = 200
local EMPTY_POTION = 7636

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(itemEx.uid) == FALSE then
		return FALSE
	end

	if doCreatureAddHealth(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
		return FALSE
	end

	doAddCondition(cid, exhaust)
	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
	[COLOR="Purple"]doTransformItem(item.uid, EMPTY_POTION)[/COLOR]
	return TRUE
end

THIS SECCOND SCRIPT REMOVE VIALS

And there is changed for this one

doRemoveItem(item.uid, EMPTY_POTION)

Code:
local MIN = 100
local MAX = 200
local EMPTY_POTION = 7636

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(itemEx.uid) == FALSE then
		return FALSE
	end

	if doCreatureAddHealth(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
		return FALSE
	end

	doAddCondition(cid, exhaust)
	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
[COLOR="#006400"]	doRemoveItem(item.uid, EMPTY_POTION)[/COLOR]
	return TRUE
end
 
ALERT: The script sended by baralala do not have the actions who checks if the player are in conditions of "CONDITION_EXHAUST_HEAL" like that:
Code:
	if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return TRUE
	end

@Topic
It's simple...

Look the sample what you have to do!

Code:
local MIN = 70
local MAX = 130
[COLOR="Blue"]local EMPTY_POTION = 7636[/COLOR]

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(itemEx.uid) == FALSE then
		return FALSE
	end

	if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return TRUE
	end

	if doPlayerAddMana(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
		return FALSE
	end

	doAddCondition(cid, exhaust)
	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
[COLOR="Red"]	doTransformItem(item.uid, EMPTY_POTION)[/COLOR]
	return TRUE
end

The lines in blue show variables to what item it will transform... so 7636 is empty potion and if you put another ID will transform in another thing after you use.

The line in red shows the command to transform the item, calling the variable EMPTY_POTION, that was seted before!

All that you have to do is:
-Delete the blue line, cause you will not use this.
-Delete the Red Line, cause you will use another command here.
-Put the command doRemoveItem(item.uid) Used to remove the item. without that you will have a infinity potion.

Here is the script of mana potion for sample

Code:
local MIN = 70
local MAX = 130


local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(itemEx.uid) == FALSE then
		return FALSE
	end

	if hasCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return TRUE
	end

	if doPlayerAddMana(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
		return FALSE
	end

	doAddCondition(cid, exhaust)
	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
	doRemoveItem(item.uid)
	return TRUE
end

If i help you please rep ++
;D
 
Last edited:
Back
Top