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

Manarune request! Very hard. jk

husam

Member
Joined
Aug 23, 2008
Messages
2,216
Reaction score
10
Location
Iraq-Baghdad
So, I found a manarune in here that i liked, but i want it to be for all vocations like when a mage uses it, he gets XX mana depending on his ml/lvl . If it's a paladin he would get health and mana and if hes a knight he would get mana only. depending on mlvl/lvl.
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(itemEx.uid) then
		local lvl, mag = getPlayerLevel(cid), getPlayerMagLevel(cid)
		local min = lvl * 2.4 + mag * 3.3
		local max = lvl * 2.7 + mag * 4.5
		local rand = math.random(min, max)
		doPlayerAddMana(itemEx.uid, rand)
		doCreatureAddHealth(itemEx.uid, rand)
		doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
	else
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
		doPlayerSendCancel(cid, "You can only use this rune on players.")
	end
	return true
end
 
Lua:
local vocations = {
[1] = {health_min_lvl = 2.5, health_min_mlvl = 2.5, health_max_lvl = 4.3, health_max_mlvl = 4.3, mana_min_lvl = 1.1, mana_min_mlvl = 1.1,  mana_max_lvl = 2.2, mana_max_mlvl = 2.2},
[2] = {health_min_lvl = 2.5, health_min_mlvl = 2.5, health_max_lvl = 4.3, health_max_mlvl  = 4.3, mana_min_lvl = 1.1, mana_min_mlvl = 1.1,  mana_max_lvl = 2.2 mana_max_mlvl = 2.2},
[3] = {health_min_lvl = 2.5, health_min_mlvl = 2.5, health_max_lvl = 4.3, health_max_mlvl = 4.3, mana_min_lvl = 1.1, mana_min_mlvl = 1.1,  mana_max_lvl = 2.2  mana_max_mlvl = 2.2},
[4] = {health_min_lvl = 2.5, health_min_mlvl = 2.5, health_max_lvl = 4.3, health_max_mlvl = 4.3, mana_min_lvl = 1.1, mana_min_mlvl = 1.1,  mana_max_lvl = 2.2 mana_max_mlvl = 2.2}
}

function getHealValue(cid,num)
num = num or isKnight(cid) and 4 or isPaladin(cid) and 3 or isDruid(cid) and 2 or 1;
local lv, mlv = getPlayerLevel(cid), getPlayerMagLevel(cid);
return math.random(lv*vocations[num].health_min_lvl +mlv*vocations[num].health_min_mlvl, lv*vocations[num].health_max_lvl +mlv*vocations[num].health_max_mlvl), math.random(lv*vocations[num].mana_min_lvl +mlv*vocations[num].mana_min_mlvl, lv*vocations[num].mana_max_lvl +mlv*vocations[num].mana_max_mlvl);
end


function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(itemEx.uid) then
		local hp, mana = getHealValue(cid);
if(mana>0) then
		doPlayerAddMana(itemEx.uid, rand)
end
if(hp>0) then
		doCreatureAddHealth(itemEx.uid, rand)
end
		doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
	else
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
		doPlayerSendCancel(cid, "You can only use this rune on players.")
	end
	return true
end

Sry for tabbling. Writting it in Quick reply window.

Seems my lua skills're still preety good
 
try this:
Code:
local vocations = {
	[1] = {health_min_lvl = 2.5, health_min_mlvl = 2.5, health_max_lvl = 4.3, health_max_mlvl = 4.3, mana_min_lvl = 1.1, mana_min_mlvl = 1.1,  mana_max_lvl = 2.2, mana_max_mlvl = 2.2},
	[2] = {health_min_lvl = 2.5, health_min_mlvl = 2.5, health_max_lvl = 4.3, health_max_mlvl  = 4.3, mana_min_lvl = 1.1, mana_min_mlvl = 1.1,  mana_max_lvl = 2.2 mana_max_mlvl = 2.2},
	[3] = {health_min_lvl = 2.5, health_min_mlvl = 2.5, health_max_lvl = 4.3, health_max_mlvl = 4.3, mana_min_lvl = 1.1, mana_min_mlvl = 1.1,  mana_max_lvl = 2.2  mana_max_mlvl = 2.2},
	[4] = {health_min_lvl = 2.5, health_min_mlvl = 2.5, health_max_lvl = 4.3, health_max_mlvl = 4.3, mana_min_lvl = 1.1, mana_min_mlvl = 1.1,  mana_max_lvl = 2.2 mana_max_mlvl = 2.2}
}
 
function getHealValue(cid,num)
	num = num or isKnight(cid) and 4 or isPaladin(cid) and 3 or isDruid(cid) and 2 or 1;
	local lv, mlv = getPlayerLevel(cid), getPlayerMagLevel(cid);
	return math.random(lv*vocations[num].health_min_lvl +mlv*vocations[num].health_min_mlvl, lv*vocations[num].health_max_lvl +mlv*vocations[num].health_max_mlvl), math.random(lv*vocations[num].mana_min_lvl +mlv*vocations[num].mana_min_mlvl, lv*vocations[num].mana_max_lvl +mlv*vocations[num].mana_max_mlvl);
end

local function getPlayerShit(cid)
	if isSorcerer(cid) or isDruid(cid) then
		return true, false
	elseif isPaladin(cid) then
		return true, true
	end
	return true, false
end

local function fuck(...)
	local p = {};
	for i = 1, #arg do
		table.insert(p, arg[i])
	end
	return p;
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if not isPlayer(itemEx.uid) then
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
		doPlayerSendCancel(cid, "You can only use this rune on players.")
		return
	end

	local rand = getHealthValue(cid)

	local s = fuck(pcall(loadstring("getPlayerShit(cid)")));
	if s[1] and s[2]
	then --paladin
		doPlayerAddMana(cid, rand)
		doPlayerAddHealth(cid, rand)
	elseif s[1] and not s[2]
	then --sorcerer
		doPlayerAddMana(cid, rand)
	else --knight
		doPlayerAddMana(cid, rand)
	end
	return true
end
 
Last edited:
Back
Top