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

Only for specified vocations!

Amiroslo

Excellent OT User
Joined
Jul 28, 2009
Messages
6,812
Solutions
6
Reaction score
822
Can someone make this only used by druids and sorcerers
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	return doPlayerAddMana(itemEx.uid, 60000000) and doSendAnimatedText(getThingPos(cid), "Mega Mr!", TEXTCOLOR_WHITE)
end

and this only for knights
Code:
local exhausted = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhausted, CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions') - 100)
setConditionParam(exhausted, CONDITION_PARAM_SUBID, EXHAUST_HEALING)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if hasCondition(cid, CONDITION_EXHAUST, EXHAUST_HEALING) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
	elseif not isPlayer(itemEx.uid) then
		doPlayerSendCancel(cid, 'You can only use this rune on players.')
	elseif getCreatureHealth(itemEx.uid) == getCreatureMaxHealth(itemEx.uid) then
		doPlayerSendCancel(cid, (itemEx.uid == cid and 'You already have' or getCreatureName(itemEx.uid) .. ' already has') .. ' full health.')
	else
		local lvl, mag, min, max = getPlayerLevel(cid), getPlayerMagLevel(cid)
		if isSorcerer(cid) or isDruid(cid) then
			min = lvl * 1.0 + mag * 1.0
			max = lvl * 1.0 + mag * 1.0
		elseif isPaladin(cid) then
			min = lvl * 1.0 + mag * 1.0
			max = lvl * 1.0 + mag * 1.0
		elseif isKnight(cid) then
			min = lvl * 0.5 + mag * 0.5
			max = lvl * 1.0 + mag * 1.0
		end
 
		local rand = math.random(min, max)
 
		rand = math.min(60000000, rand)
		rand = math.max(60000000, rand)
 
		doCreatureAddHealth(itemEx.uid, rand)
		doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
		doAddCondition(cid, exhausted)
		doCreatureSay(itemEx.uid, "Mega UH", TALKTYPE_ORANGE_1)
	end
	return true
end

and this only for pally
Code:
function onUse (cid, item, fromPosition, itemEx, toPosition)
	if (getCreatureCondition(cid, CONDITION_EXHAUST)) then
		doPlayerSendCancel(cid, "You are exhausted.")
	else
		if getPlayerMagLevel(cid) >= 3 then
			if isPlayer(cid) then
				doCreatureAddHealth(cid, 100000000)
				doCreatureAddMana(cid, 100000000)
				doCreatureSay(cid, "Mixed Rune!", TALKTYPE_ORANGE_1)
			end
		end
	end
    return true
end

rep++
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
		if isSorcerer(cid) or isDruid(cid) then
			doPlayerAddMana(itemEx.uid, 60000000) and doSendAnimatedText(getThingPos(cid), "Mega Mr!", TEXTCOLOR_WHITE)
		else
			doPlayerSendCancel(cid, "You don/'t have the right vocation to use this.")
			doSendMagicEffect(getCreaturePosition(cid), 2)
		end
	return true
end

LUA:
local exhausted = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhausted, CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions') - 100)
setConditionParam(exhausted, CONDITION_PARAM_SUBID, EXHAUST_HEALING)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getCreatureCondition(cid, CONDITION_EXHAUST) then
		doPlayerSendDefaultCancel(cid, "You are exhausted.")
	elseif not isPlayer(itemEx.uid) then
		doPlayerSendCancel(cid, 'You can only use this rune on players.')
	elseif getCreatureHealth(itemEx.uid) == getCreatureMaxHealth(itemEx.uid) then
		doPlayerSendCancel(cid, "The target got full health.")
	elseif getPlayerVocation(itemEx.uid) == 1 or getPlayerVocation(itemEx.uid) == 2 or getPlayerVocation(itemEx.uid) == 3 or getPlayerVocation(itemEx.uid) == 5 or getPlayerVocation(itemEx.uid) == 6 or getPlayerVocation(itemEx.uid) == 7 then
		doPlayerSendCancel(cid, "You or the target don't have the right vocation to use this.")
		return true
	else
		local lvl, mag, min, max = getPlayerLevel(cid), getPlayerMagLevel(cid)
		if isSorcerer(cid) or isDruid(cid) then
			min = lvl * 1.0 + mag * 1.0
			max = lvl * 1.0 + mag * 1.0
		elseif isPaladin(cid) then
			min = lvl * 1.0 + mag * 1.0
			max = lvl * 1.0 + mag * 1.0
		elseif isKnight(cid) then
			min = lvl * 0.5 + mag * 0.5
			max = lvl * 1.0 + mag * 1.0
		end
 
		local rand = math.random(min, max)
 
		rand = math.min(60000000, rand)
		rand = math.max(60000000, rand)
 
		doCreatureAddHealth(itemEx.uid, rand)
		doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
		doAddCondition(cid, exhausted)
		doCreatureSay(itemEx.uid, "Mega UH", TALKTYPE_ORANGE_1)
	end
	return true
end

EDIT: Fixed this spell ^ but it seems that it dont have exhaustion...

LUA:
function onUse (cid, item, fromPosition, itemEx, toPosition)
	if getPlayerVocation(itemEx.uid) == 1 or getPlayerVocation(itemEx.uid) == 2 or getPlayerVocation(itemEx.uid) == 4 or getPlayerVocation(itemEx.uid) == 5 or getPlayerVocation(itemEx.uid) == 6 or getPlayerVocation(itemEx.uid) == 8 then
		doPlayerSendCancel(cid, "You or the target don't have the right vocation to use this.")
	elseif getPlayerMagLevel(cid) < 4 then
		doPlayerSendCancel(cid, "Not enough magic level.")
	elseif getCreatureCondition(cid, CONDITION_EXHAUST) then
		doPlayerSendCancel(cid, "You are exhaustedd.")
	else
		doSendMagicEffect(toPosition, 12)
		doCreatureAddHealth(cid, 100000000)
		doCreatureAddMana(cid, 100000000)
		doCreatureSay(cid, "Mixed Rune!", TALKTYPE_ORANGE_1)
	end
	return true
end

EDIT2: Fixed this too ^ No exhaustion..
 
Last edited:
ty. btw im using custom vocations, like diff names
so should i change sorc to wizard or? it works?!
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
		if getPlayerVocation(cid) == xx or getPlayerVocation(cid) == xx then
			doPlayerAddMana(itemEx.uid, 60000000) and doSendAnimatedText(getThingPos(cid), "Mega Mr!", TEXTCOLOR_WHITE)
		else
			doPlayerSendCancel(cid, "You don/'t have the right vocation to use this.")
			doSendMagicEffect(getCreaturePosition(cid), 2)
		end
	return true
end

LUA:
local exhausted = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhausted, CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions') - 100)
setConditionParam(exhausted, CONDITION_PARAM_SUBID, EXHAUST_HEALING)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getCreatureCondition(cid, CONDITION_EXHAUST) then
		doPlayerSendDefaultCancel(cid, "You are exhausted.")
	elseif not isPlayer(itemEx.uid) then
		doPlayerSendCancel(cid, 'You can only use this rune on players.')
	elseif getCreatureHealth(itemEx.uid) == getCreatureMaxHealth(itemEx.uid) then
		doPlayerSendCancel(cid, "The target got full health.")
	elseif getPlayerVocation(itemEx.uid) == 1 or getPlayerVocation(itemEx.uid) == 2 or getPlayerVocation(itemEx.uid) == 3 or getPlayerVocation(itemEx.uid) == 5 or getPlayerVocation(itemEx.uid) == 6 or getPlayerVocation(itemEx.uid) == 7 then
		doPlayerSendCancel(cid, "You or the target don't have the right vocation to use this.")
		return true
	else
		local lvl, mag, min, max = getPlayerLevel(cid), getPlayerMagLevel(cid)
		if getPlayerVocation(cid) == xx or getPlayerVocation(cid) == xx then
			min = lvl * 1.0 + mag * 1.0
			max = lvl * 1.0 + mag * 1.0
		elseif getPlayerVocation(cid) == xx then
			min = lvl * 1.0 + mag * 1.0
			max = lvl * 1.0 + mag * 1.0
		elseif getPlayerVocation(cid) == xx then
			min = lvl * 0.5 + mag * 0.5
			max = lvl * 1.0 + mag * 1.0
		end
 
		local rand = math.random(min, max)
 
		rand = math.min(60000000, rand)
		rand = math.max(60000000, rand)
 
		doCreatureAddHealth(itemEx.uid, rand)
		doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
		doAddCondition(cid, exhausted)
		doCreatureSay(itemEx.uid, "Mega UH", TALKTYPE_ORANGE_1)
	end
	return true
end

idk id check from vocations.xml
 
Last edited:
and the mixed rune?

+ is this right?

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
		if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 5 or getPlayerVocation(cid) == 6 then
			doPlayerAddMana(itemEx.uid, 50000000) and doSendAnimatedText(getThingPos(cid), "Mega Mr!", TEXTCOLOR_WHITE)
		else
			doPlayerSendCancel(cid, "You don/'t have the right vocation to use this.")
			doSendMagicEffect(getCreaturePosition(cid), 2)
		end
	return true
end
 
Back
Top