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

Windows Heal depends on Magiclvl/lvl

Joined
Jul 20, 2012
Messages
15
Reaction score
1
Location
Sweden
Hello!

I want to make that when you use great mana potion then you should get mana that depends on the magic lvl and lvl you have...
any1 knows what i'm talking about?

Rep++
 
replace [2270] with the potion id

Add this in Data/Action's/Liquids/NameHere.xml
Code:
local runes = {
	[2270] = {
		voc = {1, 2, 5, 6},
		min = 'level * 1 + maglv * 3 - 2',
		max = 'level * 1 + maglv * 4'
	},
	[2300] = {
		voc = {3, 7},
		min = 'level * 1 + maglv * 4 - 2',
		max = 'level * 1 + maglv * 7'
	},
	[2306] = {
		voc = {4, 8},
		min = 'level * 1 + maglv * 1 - 2',
		max = 'level * 1 + maglv * 3'
	}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local i = runes[item.itemid]
	if isInArray(i.voc, getPlayerVocation(cid)) then
		if isPlayer(itemEx.uid) == TRUE then
			level, maglv = getPlayerLevel(cid), getPlayerMagLevel(cid)
			doPlayerAddMana(cid, math.random(loadstring('return '..i.min)(), loadstring('return '..i.max)()))
			doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
			doCreatureSay(itemEx.uid, "Aaaah..", TALKTYPE_ORANGE_1)
			doRemoveItem(item.uid, 0)
		else
			doPlayerSendDefaultCancel(cid, RETURNVALUE_CANONLYUSETHISRUNEONCREATURES)
		end
	else
		doPlayerSendCancel(cid, 'Your vocation cannot use this rune.')
	end
	return true
end

Add this in Data/Actions/Actions.xml
Code:
<action itemid="2270;2300;2306" event="script" value="liquids/NameHere.lua"/>

Rep++? :D
 
Last edited:
Back
Top