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

Action Mana Rune

Delconis

Software Engineer
Joined
Apr 3, 2008
Messages
96
Reaction score
3
Here is a mana rune I made. I don't believe it exhaust rune use.

add to data/actions/actions.xml
Code:
<action itemid="manaruneid here" event="script" value="custom/mana rune.lua" allowfaruse="1"/>

data/actions/custom/mana rune.lua
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local level = getPlayerLevel(cid)
	local mlevel = getPlayerMagLevel(cid)
	local mana_minimum = (level * 1) + (mlevel * 1) - 50
	local mana_maximum = (level * 1.2) + (mlevel * 1)
	local mana_add = math.random(mana_minimum, mana_maximum)
	
	doPlayerAddMana(cid, mana_add)
	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
	doRemoveitem(item.uid)
	return TRUE
end

If this helps you at all please Rep++
 
Last edited:
If I want to make the Mana Rune infinite charges I need to remove the line doRemoveItem ,right?
The formula is good, well blanced.

Nice work!

Edit: on the 14th line is doRemoveItem, and not doremoveitem, a litle mistake :p please fix it. REP ++ you
 
Last edited:
Yup, just remove that line to make it infinite. Also make sure the folders line up, I was wondering why mine wasn't working... but it was because my folder had a different name.

Edit: oops old thread, oh well.
 
I like this script! Except that i want so just druids and sorcerers can use it :)
What should i write?
 
im not good at script sooo
like this?

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

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local level = getPlayerLevel(cid)
	local mlevel = getPlayerMagLevel(cid)
	local mana_minimum = (level * 3.4) + (mlevel * 1) - 50
	local mana_maximum = (level * 3.7) + (mlevel * 1)
	local mana_add = math.random(mana_minimum, mana_maximum)
----->if getplayervocation(cid) == 1,2,5,6 then <------
	doPlayerAddMana(cid, mana_add)
	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
	return TRUE
end
 
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

vocids = {1,2,5,6}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local level = getPlayerLevel(cid)
	local mlevel = getPlayerMagLevel(cid)
	local mana_minimum = (level * 3.4) + (mlevel * 1) - 50
	local mana_maximum = (level * 3.7) + (mlevel * 1)
	local mana_add = math.random(mana_minimum, mana_maximum)
if isInArray(vocids, getPlayerVocation(cid)) == true then
	doPlayerAddMana(cid, mana_add)
	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
	return TRUE
end
end

Try this
 
Last edited:
Getting this error

Code:
[25/02/2013 23:35:31] [Error - Action Interface] 
[25/02/2013 23:35:31] data/actions/scripts/Mana.lua:onUse
[25/02/2013 23:35:31] Description: 
[25/02/2013 23:35:31] data/actions/scripts/Mana.lua:12: attempt to call global 'getplayervocation' (a nil value)
[25/02/2013 23:35:31] stack traceback:
[25/02/2013 23:35:31] 	data/actions/scripts/Mana.lua:12: in function <data/actions/scripts/Mana.lua:6>
 
if i whant only lvl 100+ to use the manarune?
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerLevel(cid) >= 100 then
        local level = getPlayerLevel(cid)
        local mlevel = getPlayerMagLevel(cid)
        local mana_minimum = (level * 1) + (mlevel * 1) - 50
        local mana_maximum = (level * 1.2) + (mlevel * 1)
        local mana_add = math.random(mana_minimum, mana_maximum)
   
        doPlayerAddMana(cid, mana_add)
        doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveitem(item.uid)
    else   
        doPlayerSendCancel(cid, your level is too low , only level 100+ can use it)
    end
return TRUE
end

i don't remember send player animate text command () srry
 
Thanks

...but i get a error on this:

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

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerLevel(cid) >= 50 then
        local level = getPlayerLevel(cid)
        local mlevel = getPlayerMagLevel(cid)
        local mana_minimum = (level * 1.0) + (mlevel * 1) - 50
        local mana_maximum = (level * 3.0) + (mlevel * 1)
        local mana_add = math.random(mana_minimum, mana_maximum)
        doPlayerAddMana(cid, mana_add)
        doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
        doCreatureSay(itemEx.uid, "Ahh... Manarune rocks!", TALKTYPE_ORANGE_1)
-->        doRemoveitem(item.uid) <---
    else
        doPlayerSendCancel(cid,22, "your level is too low , only level 50+ can use it", TALKTYPE_ORANGE_1)
    end
return TRUE
end

error
[19/01/2014 12:53:49] [Error - Action Interface]
[19/01/2014 12:53:49] data/actions/scripts/manarune.lua:eek:nUse
[19/01/2014 12:53:49] Description:
[19/01/2014 12:53:50] data/actions/scripts/manarune.lua:15: attempt to call global 'doRemoveitem' (a nil value)
[19/01/2014 12:53:50] stack traceback:
[19/01/2014 12:53:50] data/actions/scripts/manarune.lua:15: in function <data/actions/scripts/manarune.lua:4>

other error
[19/01/2014 13:00:45] [Warning - Event::loadScript] Event onCastSpell not found (data/spells/scripts/healing/manarune.lua)
[19/01/2014 13:00:45] Reloaded spells.


with and without --> doRemoveitem(item.uid) <---
but the spells work
 
Last edited:
Please Add Lua Scripts in Code Tags To Be Readable

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

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerLevel(cid) >= 100 then
        local level = getPlayerLevel(cid)
        local mlevel = getPlayerMagLevel(cid)
        local mana_minimum = (level * 1) + (mlevel * 1) - 50
        local mana_maximum = (level * 1.2) + (mlevel * 1)
        local mana_add = math.random(mana_minimum, mana_maximum)

        doPlayerAddMana(cid, mana_add)
        doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
        doRemoveItem(item.uid,1)
    else
        doPlayerSendCancel(cid, your level is too low , only level 100+ can use it)
    end
return TRUE
end
 
Back
Top