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

Solved Hey, about manarune.

Niioxce

Otland lurker
Joined
Jun 22, 2012
Messages
324
Reaction score
4
Location
Sweden
Hello, im getting kinda frustrated and it sucks.. I've tryed so many things but apparantly not the right.. I want my "DONATION MANARUNE" To get stronger each level up, like i got with this "DONATION UH"
EXAMLPE: MY WORKING DONATION UH, THIS SCRIPT DOES WHAT I WANT IT TO DO.

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
setCombatParam(combat, COMBAT_PARAM_DIFFERENTAREADAMAGE, 29)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
--setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 500.3, -500, 500.3, 500)

function onGetFormulaValues(cid, level, maglevel)
    min = (level * 1 + maglevel * 5) * 500.20 - 500
    max = (level * 1 + maglevel * 5) * 500.50
   
    if min < 2500 then
        min = 2500
    end

    return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
doSendDistanceShoot(getCreaturePosition(cid), {x=getCreaturePosition(cid).x+3, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}, 10)
doSendDistanceShoot(getCreaturePosition(cid), {x=getCreaturePosition(cid).x-3, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}, 10)
doSendDistanceShoot(getCreaturePosition(cid), {x=getCreaturePosition(cid).x, y=getCreaturePosition(cid).y+3, z=getCreaturePosition(cid).z}, 10)
doSendDistanceShoot(getCreaturePosition(cid), {x=getCreaturePosition(cid).x, y=getCreaturePosition(cid).y-3, z=getCreaturePosition(cid).z}, 10)
doSendDistanceShoot(getCreaturePosition(cid), {x=getCreaturePosition(cid).x+3, y=getCreaturePosition(cid).y-3, z=getCreaturePosition(cid).z}, 28)
doSendDistanceShoot(getCreaturePosition(cid), {x=getCreaturePosition(cid).x-3, y=getCreaturePosition(cid).y+3, z=getCreaturePosition(cid).z}, 28)
doSendDistanceShoot(getCreaturePosition(cid), {x=getCreaturePosition(cid).x-3, y=getCreaturePosition(cid).y-3, z=getCreaturePosition(cid).z}, 28)
doSendDistanceShoot(getCreaturePosition(cid), {x=getCreaturePosition(cid).x+3, y=getCreaturePosition(cid).y+3, z=getCreaturePosition(cid).z}, 28)
doCreatureSay(cid, "Donation UH", TALKTYPE_ORANGE_1)
    return doCombat(cid, combat, var)
end
That script makes it stronger for each levels.. But how can i convert it to mana instead of Health?
 
Put in data/actions/scripts/donationmr.lua:
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isPlayer(itemEx.uid) == TRUE then
        local level = getPlayerLevel(cid)
        local mlevel = getPlayerMagLevel(cid)
        local mana_minimum = (level * 1) + (mlevel * 1) - 10
        local mana_maximum = (level * 1) + (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, "Donation MR", TALKTYPE_ORANGE_1)
        --doRemoveitem(item.uid)
        return TRUE
    else
        doPlayerSendCancel(cid, "You can only use this rune on players.")
        return TRUE
    end
end

Put in data/actions/actions.xml:
Code:
    <action itemid="XXXX" event="script" value="donationmr.lua"/>

Note: All vocations can use this potion atm. And it's infinite. You need to fix the mana_minimum & mana_maximum by yourself.
 
Put in data/actions/scripts/donationmr.lua:
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isPlayer(itemEx.uid) == TRUE then
        local level = getPlayerLevel(cid)
        local mlevel = getPlayerMagLevel(cid)
        local mana_minimum = (level * 1) + (mlevel * 1) - 10
        local mana_maximum = (level * 1) + (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, "Donation MR", TALKTYPE_ORANGE_1)
        --doRemoveitem(item.uid)
        return TRUE
    else
        doPlayerSendCancel(cid, "You can only use this rune on players.")
        return TRUE
    end
end

Put in data/actions/actions.xml:
Code:
    <action itemid="XXXX" event="script" value="donationmr.lua"/>
Yea, thanks.. !
Note: All vocations can use this potion atm. And it's infinite. You need to fix the mana_minimum & mana_maximum by yourself.

Lol fail quote. Thank you..

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

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isPlayer(itemEx.uid) == TRUE then
        local level = getPlayerLevel(cid)
        local mlevel = getPlayerMagLevel(cid)
        local mana_minimum = (level * 1) + (mlevel * 1) - 10
        local mana_maximum = (level * 1) + (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, "Donation MR", TALKTYPE_ORANGE_1)
        --doRemoveitem(item.uid)
        return TRUE
    else
        doPlayerSendCancel(cid, "You can only use this rune on players.")
        return TRUE
    end
end

Put in data/actions/actions.xml:
Code:
    <action itemid="XXXX" event="script" value="donationmr.lua"/>

Note: All vocations can use this potion atm. And it's infinite. You need to fix the mana_minimum & mana_maximum by yourself.
Just says "you cannot use this object"
 
Last edited by a moderator:
Code:
local runes = {
    [2272] = {
        voc = {1, 2, 5, 6},
        min = 'level * 1 + maglv * 3 - 2',
        max = 'level * 1 + maglv * 4'
    }
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local i = runes[item.itemid]
    if isInArray(i.voc, getPlayerVocation(cid)) then
        if isPlayer(itemEx.uid) == TRUE then
            level, maglv = getPlayerLevel(cid), getPlayerMagLevel(cid)
            doPlayerAddMana(cid, math.random(loadstring('return '..i.min)(), loadstring('return '..i.max)()))
            doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
            doCreatureSay(itemEx.uid, "Donation Manarune", TALKTYPE_ORANGE_1)
            doRemoveItem(item.uid, 0)
        else
            doPlayerSendDefaultCancel(cid, RETURNVALUE_CANONLYUSETHISRUNEONCREATURES)
        end
    else
        doPlayerSendCancel(cid, 'Your vocation cannot use this rune.')
    end
    return true
end

Copied from a server i had on my desktop, Its alsow an action
 
Code:
local runes = {
    [2272] = {
        voc = {1, 2, 5, 6},
        min = 'level * 1 + maglv * 3 - 2',
        max = 'level * 1 + maglv * 4'
    }
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local i = runes[item.itemid]
    if isInArray(i.voc, getPlayerVocation(cid)) then
        if isPlayer(itemEx.uid) == TRUE then
            level, maglv = getPlayerLevel(cid), getPlayerMagLevel(cid)
            doPlayerAddMana(cid, math.random(loadstring('return '..i.min)(), loadstring('return '..i.max)()))
            doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
            doCreatureSay(itemEx.uid, "Donation Manarune", TALKTYPE_ORANGE_1)
            doRemoveItem(item.uid, 0)
        else
            doPlayerSendDefaultCancel(cid, RETURNVALUE_CANONLYUSETHISRUNEONCREATURES)
        end
    else
        doPlayerSendCancel(cid, 'Your vocation cannot use this rune.')
    end
    return true
end

Copied from a server i had on my desktop, Its alsow an action

Awesome, but how can i make it so it multipliers more? Or adds more mana each level?
 
These two lines:
Code:
level, maglv = getPlayerLevel(cid), getPlayerMagLevel(cid)
doPlayerAddMana(cid, math.random(loadstring('return '..i.min)(), loadstring('return '..i.max)()))

are the same as this:
Code:
local playerLevel = getPlayerLevel(cid)       -- Player's level
local magicLevel  = getPlayerMagLevel(cid)    -- Player's magic level

local minimumManaBuff = (playerLevel * 1) + (magicLevel * 3) - 2    
local maximumManaBuff = (playerLevel * 1) + (magicLevel * 4)

doPlayerAddMana(cid, math.random( minimumManaBuff, maximumManaBuff  ))

Use this code, but change the formulas to whatever you want.
Or use my simpler version to figure out the original, and change the formulas in the array at the start of the script.
 
Last edited:
These two lines:
Code:
level, maglv = getPlayerLevel(cid), getPlayerMagLevel(cid)
doPlayerAddMana(cid, math.random(loadstring('return '..i.min)(), loadstring('return '..i.max)()))

are the same as this:
Code:
local playerLevel = getPlayerLevel(cid)       -- Player's level
local magicLevel  = getPlayerMagLevel(cid)    -- Player's magic level

local minimumManaBuff = (playerLevel * 1) + (magicLevel * 3) - 2   
local maximumManaBuff = (playerLevel * 1) + (magicLevel * 4)

doPlayerAddMana(cid, math.random( minimumManaBuff, maximumManaBuff  ))

Use this code, but change the formulas to whatever you want.
Or use my simpler version to figure out the original, and change the formulas in the array at the start of the script.
I'll give it a shoot!

These two lines:
Code:
level, maglv = getPlayerLevel(cid), getPlayerMagLevel(cid)
doPlayerAddMana(cid, math.random(loadstring('return '..i.min)(), loadstring('return '..i.max)()))

are the same as this:
Code:
local playerLevel = getPlayerLevel(cid)       -- Player's level
local magicLevel  = getPlayerMagLevel(cid)    -- Player's magic level

local minimumManaBuff = (playerLevel * 1) + (magicLevel * 3) - 2   
local maximumManaBuff = (playerLevel * 1) + (magicLevel * 4)

doPlayerAddMana(cid, math.random( minimumManaBuff, maximumManaBuff  ))

Use this code, but change the formulas to whatever you want.
Or use my simpler version to figure out the original, and change the formulas in the array at the start of the script.
Well nvm, i didnt get it..
 
Last edited by a moderator:
Code:
        min = 'level * 1 + maglv * 3 - 2',
        max = 'level * 1 + maglv * 4'
Change theese
This means: level * 1 = Player level * 1
maglv * 3 - 2 = Player magic level * something of 2 or 3
 
Yea, thanks :p Well now i changed my charecter to level 50,000 thousand and i tryed to change the script to this.
Code:
        min = 'level * 250 + maglv * 3 - 2',

        max = 'level * 100000 + maglv * 30'

It worked fine in level 8 but when i got to level 50,000 thousand i got this err0r in console.

Code:
[05/04/2014 20:33:44] [Error - Action Interface]
[05/04/2014 20:33:44] data/actions/scripts/runes/donation manarune.lua:onUse
[05/04/2014 20:33:44] Description:
[05/04/2014 20:33:44] data/actions/scripts/runes/donation manarune.lua:13: bad argument #2 to 'random' (interval is empty)
[05/04/2014 20:33:44] stack traceback:
[05/04/2014 20:33:44]    [C]: in function 'random'
[05/04/2014 20:33:44]    data/actions/scripts/runes/donation manarune.lua:13: in function <data/actions/scripts/runes/donation manarune.lua:8>
Rofl, i think i changed the value of max level thingy..
 
Code:
local runes = {
    [2272] = {
        voc = {1, 2, 5, 6},
        min = 'level * 250 + maglv * 3 - 2',
        max = 'level * 100000 + maglv * 30'
    }
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local i = runes[item.itemid]
    if isInArray(i.voc, getPlayerVocation(cid)) then
        if isPlayer(itemEx.uid) == TRUE then
            level, maglv = getPlayerLevel(cid), getPlayerMagLevel(cid)
            doPlayerAddMana(cid, math.random(loadstring('return '..i.min)(), loadstring('return '..i.max)()))
            doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
            doCreatureSay(itemEx.uid, "Donation Manarune", TALKTYPE_ORANGE_1)
            doRemoveItem(item.uid, 0)
        else
            doPlayerSendDefaultCancel(cid, RETURNVALUE_CANONLYUSETHISRUNEONCREATURES)
        end
    else
        doPlayerSendCancel(cid, 'Your vocation cannot use this rune.')
    end
    return true
end

So its like this?
 
Back
Top