Action Mana Rune

Delconis

Software Engineer
Joined
Apr 3, 2008
Messages
96
Best answers
0
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:

Zeeh1997

New Member
Joined
Jan 1, 2010
Messages
29
Best answers
0
Reaction score
0
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:

induce

New Member
Joined
May 12, 2010
Messages
42
Best answers
0
Reaction score
1
Location
USA
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.
 

Maten

New Member
Joined
Mar 16, 2009
Messages
219
Best answers
0
Reaction score
2
I like this script! Except that i want so just druids and sorcerers can use it :)
What should i write?
 

City

Active Member
Joined
Jul 14, 2012
Messages
1,077
Best answers
0
Reaction score
30
Location
Sweden
I like this script! Except that i want so just druids and sorcerers can use it :)
What should i write?
Lua:
if getplayervocation(cid) == vocid then
should be 1,2,5,6
 

Maten

New Member
Joined
Mar 16, 2009
Messages
219
Best answers
0
Reaction score
2
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
 

City

Active Member
Joined
Jul 14, 2012
Messages
1,077
Best answers
0
Reaction score
30
Location
Sweden
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:

Maten

New Member
Joined
Mar 16, 2009
Messages
219
Best answers
0
Reaction score
2
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>
 

City

Active Member
Joined
Jul 14, 2012
Messages
1,077
Best answers
0
Reaction score
30
Location
Sweden
updated code

- - - Updated - - -

updated again
 

Maten

New Member
Joined
Mar 16, 2009
Messages
219
Best answers
0
Reaction score
2
nop still dont work :/

- - - Updated - - -

thanks :p
 

EvilSkillz

Back
Joined
Jul 12, 2012
Messages
1,719
Best answers
0
Reaction score
300
Location
Egypt - Cairo
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
 

MuGuFuTsu

New Member
Joined
Feb 26, 2012
Messages
28
Best answers
0
Reaction score
0
Location
Sverige
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:

tetra20

DD
Joined
Jan 17, 2009
Messages
1,306
Best answers
3
Reaction score
286
Location
Egypt
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
 
Top