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

Healing prob..

Donio

Banned User
Joined
Jun 24, 2008
Messages
4,004
Reaction score
16
Location
Manhattan, New York
Hello, im trying to make a rune or EVEN the ultimate healing pot for knights to heal depending on their level + magic level.. This is how far I'v come-- But the thing is it Dont work!

If any one can see whats causing it to not work please help me out!


Code:
local runes = {
	[2275] = {
		voc = {4, 8},
		min = 'level * 1 + maglv * 3 - 2',
		max = 'level * 1 + maglv * 4'

}
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)
			doPlayerAddHealth(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
 
If you want to use a different ID, then change the red number too. :p
Code:
local runes = {
	[[B][COLOR="red"]2275[/COLOR][/B]] = {
		voc = {4, 8},
		min = 'level * 1 + maglv * 3 - 2',
		max = 'level * 1 + maglv * 4'
	}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local i = runes[item.itemid]
	if isInArray(i.voc, getPlayerVocation(cid)) then
		if isPlayer(itemEx.uid) then
			level, maglv = getPlayerLevel(cid), getPlayerMagLevel(cid)
			doCreatureAddHealth(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
 
Back
Top