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

[HELP ME] Mana rune script

Lopaz

Member
Joined
Sep 1, 2010
Messages
50
Reaction score
5
Location
https://otland.net/
Hello... I need help with my Mana rune script.

How should I do (what kind of script should I type in) to make it only usable for druids, elder druids, sorcerers, master sorcerers, paladins and royal paladins?
Whatever I do, the Mana rune keep stop working >.<

Script here:
PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_MANADRAIN)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)

function onCastSpell(cid, var)
doPlayerAddMana(cid, 700)
doCreatureSay(cid, "Mana rune", TALKTYPE_MONSTER)
return doCombat(cid, combat, var)
end

Also, what should I type to make a Mana rune only usable for knights and elite knights?
Please help. I'll give you +Rep if help :)
 
add the lines in spells.xml example:

Code:
	<rune name="Manarune" id="2278" allowfaruse="1" charges="1" lvl="54" maglv="18" exhaustion="2000" mana="1400" needtarget="1" blocktype="solid" event="script" value="support/mr.lua">
		<vocation id="2"/>
		<vocation id="6" showInDescription="0"/>
	</rune>

You need to edit only the vocation ids that you want to be usable. If you want to look ids, look at xml / vocations.xml
 
add the lines in spells.xml example:

Code:
	<rune name="Manarune" id="2278" allowfaruse="1" charges="1" lvl="54" maglv="18" exhaustion="2000" mana="1400" needtarget="1" blocktype="solid" event="script" value="support/mr.lua">
		<vocation id="2"/>
		<vocation id="6" showInDescription="0"/>
	</rune>

You need to edit only the vocation ids that you want to be usable. If you want to look ids, look at xml / vocations.xml

It didn't work. Knights can still use the first mana rune that gives 700 mana :/
 
Then modify those lines for your 700 mana giving manarune.
4 - knight
8 - elite knight
If you don't want them to be able to use that rune remove those vocation IDs.
 
Then modify those lines for your 700 mana giving manarune.
4 - knight
8 - elite knight
If you don't want them to be able to use that rune remove those vocation IDs.

Thats just what I did :/... Like this:

Strong mana rune:

PHP:
<rune name="Strong mana Rune" id="2300" allowfaruse="1" charges="1" lvl="100" maglv="0" exhaustion="1000" aggressive="0" needtarget="1" blocktype="solid" event="script" value="healing/manarune.lua"/>
	    <vocation id="5"/>
		<vocation id="6" showInDescription="0"/>
		<vocation id="1"/>
	    <vocation id="2" showInDescription="0"/>

Knight mana rune:

PHP:
<rune name="Knight mana Rune" id="2276" allowfaruse="1" charges="1" lvl="100" maglv="0" exhaustion="1000" aggressive="0" needtarget="1" blocktype="solid" event="script" value="healing/manaruneknight.lua"/>
	    <vocation id="4"/>
	    <vocation id="8" showInDescription="0"/>

I cant see what the problem is wth >.<

EDIT: Added knight mana rune script
 
@up
lol? and where edit how mana taken, etc? nahh for this need manarune in actions..

I scripted newmanarune for you its easy config, how mana, vocations, etc..
Here you go:
items.xml

Lua:
<item id="2270" article="a" name="knight manarune">
<attribute key="weight" value="120"/>
</item>

actions.xml
Lua:
<action itemid="2270" event="script" value="liquids/manarune.lua" allowfaruse="1"/>

manarune.lua
Lua:
local config = {
	removeOnUse = "no",
	splashable = "no",
	realAnimation = "no",
	healthMultiplier = 1.0,
	manaMultiplier = 1.0
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
	[2270] = {empty = 7635, splash = 2, mana = {650, 700}, level = 1, vocations = {3, 7, 11, 4, 8, 12}, vocStr = "knights and paladins"}
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local potion = POTIONS[item.itemid]
	if(not potion) then
		return false
	end

	if(not isPlayer(itemEx.uid)) then
		if(not config.splashable) then
			return false
		end

		if(toPosition.x == CONTAINER_POSITION) then
			toPosition = getThingPos(item.uid)
		end

		doDecayItem(doCreateItem(2016, potion.splash, toPosition))
		doTransformItem(item.uid, potion.empty)
		return true
	end

	if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return true
	end

	if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
		not getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges))
	then
		doCreatureSay(itemEx.uid, "Solo " .. potion.vocStr ..  " pueden usar esta manarune.", TALKTYPE_ORANGE_1)
		return true
	end

	local health = potion.health
	if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
		return false
	end

	local mana = potion.mana
	if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
		return false
	end

	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	if(not realAnimation) then
		doCreatureSay(itemEx.uid, "Manarune rox...", TALKTYPE_ORANGE_1)
	else
		for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
			end
		end
	end

	doAddCondition(cid, exhaust)
	if(not potion.empty or config.removeOnUse) then
		doRemoveItem(item.uid)
		return true
	end
	return true
end
 
Tested my Manarune and works ;)
Easy config.. how mana taken Manarune, etc..
mana = How much mana
level = how How much level need
vocations = Add vocations.. 1, 2, 3 .. etc
 
Are you sure that you are using different IDs for different manarunes?
talking about Rune IDs, not vocation IDs.
 
Only need edit IDS.. manarunes and you get edit items.xml
Manarune for Vocations :O?

actions.xml
Lua:
<action itemid="2264;2270;2297" event="script" value="liquids/manarune.lua" allowfaruse="1"/>

All manarune in 1 script ;)?..
Lua:
local config = {
	removeOnUse = "no",
	splashable = "no",
	realAnimation = "no",
	healthMultiplier = 1.0,
	manaMultiplier = 1.0
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
	[2270] = {empty = 7635, splash = 2, mana = {150, 250}, level = 1, vocations = {4, 8, 12}, vocStr = "knights"}, -- knight manarune
	[2264] = {empty = 7635, splash = 7, mana = {400, 500}, level = 1, vocations = {1, 2, 5, 6, 9, 10}, vocStr = "sorcerers and druids"}, -- mages manarune
	[2297] = {empty = 7635, splash = 3, mana = {200, 300}, level = 1, vocations = {3, 7, 11}, vocStr = "paladins"} -- paladin maanarune
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local potion = POTIONS[item.itemid]
	if(not potion) then
		return false
	end

	if(not isPlayer(itemEx.uid)) then
		if(not config.splashable) then
			return false
		end

		if(toPosition.x == CONTAINER_POSITION) then
			toPosition = getThingPos(item.uid)
		end

		doDecayItem(doCreateItem(2016, potion.splash, toPosition))
		doTransformItem(item.uid, potion.empty)
		return true
	end

	if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return true
	end

	if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
		not getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges))
	then
		doCreatureSay(itemEx.uid, "Solo " .. potion.vocStr ..  " pueden usar esta manarune.", TALKTYPE_ORANGE_1)
		return true
	end

	local health = potion.health
	if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
		return false
	end

	local mana = potion.mana
	if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
		return false
	end

	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	if(not realAnimation) then
		doCreatureSay(itemEx.uid, "Manarune rox...", TALKTYPE_ORANGE_1)
	else
		for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
			end
		end
	end

	doAddCondition(cid, exhaust)
	if(not potion.empty or config.removeOnUse) then
		doRemoveItem(item.uid)
		return true
	end
	return true
end

Or paladins and kina , sorcerer and druid?
Lua:
<action itemid="2264;2270" event="script" value="liquids/manarune.lua" allowfaruse="1"/>

Lua:
local config = {
	removeOnUse = "no",
	splashable = "no",
	realAnimation = "no",
	healthMultiplier = 1.0,
	manaMultiplier = 1.0
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
	[2270] = {empty = 7635, splash = 2, mana = {150, 250}, level = 1, vocations = {4, 8, 12, 3, 7, 11}, vocStr = "knights and paladins"}, -- knight manarune
	[2264] = {empty = 7635, splash = 7, mana = {400, 500}, level = 1, vocations = {1, 2, 5, 6, 9, 10}, vocStr = "sorcerers and druids"}, -- mages manarune
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local potion = POTIONS[item.itemid]
	if(not potion) then
		return false
	end

	if(not isPlayer(itemEx.uid)) then
		if(not config.splashable) then
			return false
		end

		if(toPosition.x == CONTAINER_POSITION) then
			toPosition = getThingPos(item.uid)
		end

		doDecayItem(doCreateItem(2016, potion.splash, toPosition))
		doTransformItem(item.uid, potion.empty)
		return true
	end

	if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return true
	end

	if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
		not getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges))
	then
		doCreatureSay(itemEx.uid, "Solo " .. potion.vocStr ..  " pueden usar esta manarune.", TALKTYPE_ORANGE_1)
		return true
	end

	local health = potion.health
	if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
		return false
	end

	local mana = potion.mana
	if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
		return false
	end

	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	if(not realAnimation) then
		doCreatureSay(itemEx.uid, "Manarune rox...", TALKTYPE_ORANGE_1)
	else
		for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
			end
		end
	end

	doAddCondition(cid, exhaust)
	if(not potion.empty or config.removeOnUse) then
		doRemoveItem(item.uid)
		return true
	end
	return true
end
 
Are you sure that you are using different IDs for different manarunes?
talking about Rune IDs, not vocation IDs.

Yes. 100% sure.

20:00 You see a knight mana rune.
It weighs 1.20 oz.
A weak, unlimited knight mana rune. When used it gives you back 100 mana. This rune can only be used by knights of level 100 or higher.
ItemID: [2276].

PHP:
	<item id="2276" override="yes" article="a" name="knight mana rune">
	<attribute key="description" value="A weak, unlimited knight mana rune. When used it gives you back 100 mana. This rune can only be used by knights of level 100 or higher."/>
    <attribute key="weight" value="120" />
    <attribute key="charges" value="0" />



20:00 You see a strong mana rune.
It weighs 1.20 oz.
A pretty strong, unlimited mana rune. When used it gives you back 700 mana. This rune can only be used by sorcerers, druids and paladins of level 100 or higher.
ItemID: [2300].

PHP:
<item id="2300" override="yes" article="a" name="strong mana rune">
	<attribute key="description" value="A pretty strong, unlimited mana rune. When used it gives you back 700 mana. This rune can only be used by sorcerers, druids and paladins of level 100 or higher."/>
    <attribute key="weight" value="120" />
    <attribute key="charges" value="0" />
 
Is why manarunes in items.xml not works you get charges..
Here you go all fixed and complete:
Lua:
	<item id="2276" article="a" name="knight mana rune">
		<attribute key="weight" value="120"/>
		<attribute key="description" value="A weak, unlimited knight mana rune. When used it gives you back 100 mana. This rune can only be used by knights of level 100 or higher."/>
	</item>
Lua:
	<item id="2300" article="a" name="strong mana rune">
		<attribute key="weight" value="120"/>
		<attribute key="description" value="A pretty strong, unlimited mana rune. When used it gives you back 700 mana. This rune can only be used by sorcerers, druids and paladins of level 100 or higher." />
	</item>

actions.xml
Lua:
<action itemid="2276;2300" event="script" value="manarune.lua" allowfaruse="1"/>

manarune.lua
Lua:
---- created by cronox
local config = {
	removeOnUse = "no",
	splashable = "no",
	realAnimation = "no",
	healthMultiplier = 1.0,
	manaMultiplier = 1.0
}
 
config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)
 
local POTIONS = {
	[2276] = {empty = 7635, splash = 2, mana = {100}, level = 100, vocations = {4, 8, 12}, vocStr = "knights"},
	[2300] = {empty = 7635, splash = 7, mana = {700}, level = 100, vocations = {1, 2, 5, 6, 9, 10, 3, 7, 11}, vocStr = "sorcerers, druids and paladins"},
}
 
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local potion = POTIONS[item.itemid]
	if(not potion) then
		return false
	end
 
	if(not isPlayer(itemEx.uid)) then
		if(not config.splashable) then
			return false
		end
 
		if(toPosition.x == CONTAINER_POSITION) then
			toPosition = getThingPos(item.uid)
		end
 
		doDecayItem(doCreateItem(2016, potion.splash, toPosition))
		doTransformItem(item.uid, potion.empty)
		return true
	end
 
	if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return true
	end
 
	if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
		not getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges))
	then
		doCreatureSay(itemEx.uid, "Only " .. potion.vocStr ..  " Can use this manarune.", TALKTYPE_ORANGE_1)
		return true
	end
 
	local health = potion.health
	if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
		return false
	end
 
	local mana = potion.mana
	if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
		return false
	end
 
	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	if(not realAnimation) then
		doCreatureSay(itemEx.uid, "Manarune rox...", TALKTYPE_ORANGE_1)
	else
		for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
			end
		end
	end
 
	doAddCondition(cid, exhaust)
	if(not potion.empty or config.removeOnUse) then
		doRemoveItem(item.uid)
		return true
	end
	return true
end
 
Cronox he doesn't want your god damn script, leave it. He wants to get his own script up and running.


Did you use close with </rune> after adding vocation IDs?
 
Not what you need, or put anything in spells
I edit all sciprt for works 100% for this thread :)
see is 1 script for all manarunes ;) no need use nothing.. only look

thanks*
 
Well Wavoz...

Like this?

PHP:
    <rune name="Knight mana Rune" id="2276" allowfaruse="1" charges="1" lvl="100" maglv="0" exhaustion="1000" aggressive="0" needtarget="1" blocktype="solid" event="script" value="healing/manaruneknight.lua"/>
	    <vocation id="4"/>
	    <vocation id="8" showInDescription="0"/>
	    </rune>

I did just like this one:

PHP:
<rune name="Wild Growth" id="2269" allowfaruse="1" charges="2" lvl="27" maglv="8" exhaustion="2000" blocktype="all" event="script" value="support/wild growth rune.lua">
        <vocation id="2"/>
	<vocation id="6" showInDescription="0"/>
	</rune>

but when I start my OT, it "Unables to load spells.xml" .......
 
Last edited:
data/actions
open actions.xml and add this
Lua:
<action itemid="2276;2300" event="script" value="manarune.lua" allowfaruse="1"/>
now open data/actions/scripts
created archive .lua or copy one script and changed name - manarune.lua
and paste inside my script
now in tibia say /i 2276 o /i 2300 and see manarunes.. works ;)
 
data/actions
open actions.xml and add this
Lua:
<action itemid="2276;2300" event="script" value="manarune.lua" allowfaruse="1"/>
now open data/actions/scripts
created archive .lua or copy one script and changed name - manarune.lua
and paste inside my script
now in tibia say /i 2276 o /i 2300 and see manarunes.. works ;)

Hmm yeah it did work. If you let me i'll just take this one so I can skip the other stupid script that wont work >.<... Thanks :).
One more thing... when I use the mana runes in-game on myself, I wont be able to logout. It's like getting targetted by a monster. Do you know how to fix this? :).
 
What i'm trying to say is Thank you for the script, for the help it works. + Rep to you :)
And do you know how to fix alittle thing on this mana rune? When I use it on myself a few times, I get yellow skull on myself and I cant logout (it's like I get targetted by a normal hostile monster).

Knight mana rune:
PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_MANADRAIN)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

function onCastSpell(cid, var)
doPlayerAddMana(cid, 100)
doCreatureSay(cid, "Knight mana rune", TALKTYPE_MONSTER)
return doCombat(cid, combat, var)
end

Mage and Paladin mana rune:
PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_MANADRAIN)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

function onCastSpell(cid, var)
doPlayerAddMana(cid, 700)
doCreatureSay(cid, "Mana rune", TALKTYPE_MONSTER)
return doCombat(cid, combat, var)
end

You understand now? :D
 
Back
Top