• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Manarune

Glidarn

Member
Joined
May 9, 2009
Messages
970
Reaction score
16
Location
Åkersberga, Sweden
hello, i have a problem with this manarune, it doesnt work.

LUA:
<item id="2270" article="a" name="manarune">
		<attribute key="weight" value="120"/>
		<attribute key="charges" value="3"/>

anyone know?
 
First of all you need to have a script for the mana rune.
I guess you do have, but if you say its not working, I'll give you one.
This should go in data/spells/healing/mana rune.lua

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

function onCastSpell(cid, var)
doPlayerAddMana(cid, math.random(500, 550)) ----- Healing of the mr
return doCombat(cid, combat, var)
end

Then in spells.xml put

<rune name="Mana Rune" id="2275" allowfaruse="1" charges="1" lvl="1" maglv="5" exhaustion="850" aggressive="0" needtarget="1" blocktype="solid" event="script" value="healing/mana rune.lua"/>

ID= Use the one you want. I use 2275.

Rep+ if I helped :)
P.S= Do you want the charges to remove?
 
but this is only for mages?


and is this right?

LUA:
</conjure>
        <conjure name="Mana Rune" id="2275" allowfaruse="1" charges="1" lvl="1" maglv="5" exhaustion="850" aggressive="0" needtarget="1" blocktype="solid" event="script" value="healing/mana rune.lua"/>
        </conjure>
 
Last edited:
Manarune based upon level and magic level.

This is a manarune script that I have used for Donation's in the past, it might be useful for you. :thumbup:

data/actions/actions.xml
Code:
<action itemid="[COLOR="red"]2294[/COLOR]" event="script" value="[COLOR="red"]manarune.lua[/COLOR]"/>

data/actions/scripts/manarune.lua
Code:
local exhausted = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local min, max
	local lvl, mag = getPlayerLevel(cid), getPlayerMagLevel(cid)
	if isSorcerer(cid) or isDruid(cid) then
		min = lvl * 1.0 + mag * 1.0
		max = lvl * 1.0 + mag * 1.50
	elseif isPaladin(cid) then
		min = lvl * 1.0 + mag * 1.0
		max = lvl * 1.0 + mag * 1.35
	elseif isKnight(cid) then
		min = lvl * 0.5 + mag * 0.5
		max = lvl * 0.75 + mag * 1.0
	end
	
	local rand = math.random(min, max)
	if rand > 400 then
		rand = 400
	end
	
	if rand < 100 then
		rand = 100
	end
	
	if hasCondition(cid, CONDITION_EXHAUST_HEAL) then
		return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
	end
	
	if not isPlayer(itemEx.uid) then
		return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	end
	
	if(getCreatureMana(cid) >= getCreatureMaxMana(cid)) then
		return doPlayerSendCancel(cid, "Your mana is currently full.")
	end
	
	return doChangeTypeItem(item.uid, item.type - 1) and doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE) and doPlayerAddMana(itemEx.uid, rand) and doAddCondition(cid, exhausted) and doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
end

Note:
As you may be able to see I have outlined some of the code in blue. This is for balancing purposes.
If the manarune refills above 400, then the max will be 400. If it refills under 100, it will automatically refill 100.

I hope you understand, good luck.

Regards,
JDB.
 
Last edited:
Can that be used for a Donation UH too?

Yes sir, all you have to do is change...

Code:
doPlayerAddMana(itemEx.uid, rand)

to

Code:
doCreatureAddHealth(itemEx.uid, rand)

which is located on the last line starting with return. :thumbup:

And change...

Code:
if(getCreatureMana(cid) >= getCreatureMaxMana(cid)) then
	return doPlayerSendCancel(cid, "Your mana is currently full.")
end

to

Code:
if(getCreatureHealth(cid) >= getCreatureMaxHealth(cid)) then
	return doPlayerSendCancel(cid, "Your health is currently full.")
end

Regards,
JDB.
 
Thanks!
Lmao, I was always trying to put DoAddHp or hitpoints, im a dumb, never thought about health haha.
 
Back
Top