• 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's

wohami

New Member
Joined
May 18, 2010
Messages
93
Reaction score
0
Location
sweden
Hello. i wanna make a custom potion thats heal 450 - 530 mana.
item ID:7488

Client:8.54

i have used Search cant find.
i wold love if some one did help me. :thumbup:
 
In actions .xml...
Code:
<action itemid="7488" event="script" value="manapotion.lua"/>


Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local min, max = 0, 0
	end
	
	local rand = math.random(min, max)
	if rand > 530 then
		rand = 530
	end
	
	if rand < 450 then
		rand = 450
	end
	
	if not isPlayer(itemEx.uid) then
		return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	end
	
	if(getCreatureMana(cid) >= getCreatureMaxMana(cid)) then
		return doPlayerSendCancel(cid, "Your mana is currently full.")
	end
	return doChangeTypeItem(item.uid, item.type - 1) and doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE) and doPlayerAddMana(itemEx.uid, rand) and doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
end
 
instead of that, put this in actions.xml:
XML:
<action itemid="7488" event="script" value="liquids/potions.lua"/>
 
when i did add this in config.xml
Code:
<action itemid="7488" event="script" value="liquids/potions.lua"/>

I did get this error:
Code:
[08/10/2010 15:40:16] [Error - LuaScriptInterface::loadFile] data/actions/scripts/manapotion.lua:22: '<eof>' expected near 'end'
[08/10/2010 15:40:16] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/manapotion.lua)
[08/10/2010 15:40:16] data/actions/scripts/manapotion.lua:22: '<eof>' expected near 'end'
 
Try this..
Lua:
local MIN = 450
local MAX = 530
local EMPTY_POTION = 7635

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)
	
	return TRUE
end
 
Last edited:
Back
Top