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

Adding vocs..

vejsa

Banned User
Joined
Nov 3, 2007
Messages
434
Reaction score
0
Hey this is my problem..

Code:
  function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isPlayer(itemEx.uid) == TRUE then
        local level, mlevel = getPlayerLevel(cid), getPlayerMagLevel(cid)
        local mana_minimum = level * 2 + mlevel * 2 - 35
        local mana_maximum = level * 3 + mlevel * 1

        doPlayerAddMana(cid, math.random(mana_minimum, mana_maximum))
        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
    return TRUE
end

That is my manarune script.. I need to add vocation id to them so mages can use 1 manarune.. knights can use 1 and pallys 1.. they are all diffrent manarunes.. Its a action script not a spell.. So if any one can help me out that would be awesome! :)
 
Code:
local runes = {
	[XXXX] = {
		voc = {1, 2, 5, 6},
		min = 'level * 2 + maglv * 2 - 35',
		max = 'level * 3 + maglv * 1'
	},
	[XXXX] = {
		voc = {3, 7},
		min = 'level * 2 + maglv * 2 - 35',
		max = 'level * 3 + maglv * 1'
	},
	[XXXX] = {
		voc = {4, 8},
		min = 'level * 2 + maglv * 2 - 35',
		max = 'level * 3 + maglv * 1'
	}
}
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
 
Back
Top