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

Pots ..

Depends on what distro you are using.
If you use TFS 0.3 this will do the trick:

All this goes into Actions folder. Remember to add the ID to actions.xml aswell.

You can store charges in actionId
Example:
Code:
	if(item.actionid == 0) then
		doSetItemActionId(item.uid, 99 + 3) -- 3 = charges
		return TRUE
	end

	local _charges = item.actionid - 100
	if(_charges > 1) then
		doSetItemActionId(item.uid, item.actionid - 1)
	else
		doRemoveItem(item.uid)
	end

example health potion with this: (taken from TFS 0.3)
Code:
local MIN = [COLOR="Red"]100[/COLOR]
local MAX = [COLOR="Red"]200[/COLOR]
local EMPTY_POTION = [COLOR="Red"]7636[/COLOR]
local CHARGES = [COLOR="Red"]3[/COLOR]

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') [COLOR="Red"]- 100[/COLOR]))

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 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)

	if(item.actionid == 0) then
		doSetItemActionId(item.uid, 99 + CHARGES)
		return TRUE
	end

	local _charges = item.actionid - 100
	if(_charges > 1) then
		doSetItemActionId(item.uid, item.actionid - 1)
	else
		doRemoveItem(item.uid)
	end

	return TRUE
end

It will automatically set actionid if its not setted. Defaulf charges are set in this script (CHARGES).

You can also set charges manually - command - /attr aid 100 + charges - example: /attr aid 150 (50 charges) - works only on TFS 0.3
 

Similar threads

Back
Top