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

Special manarune for paladins

zxzxzx

New Member
Joined
Mar 12, 2011
Messages
334
Reaction score
3
Hello!

I need manarune script that gives mana AND HP based on calculate method like this one:

" template = {min = (((playerinfo.level * 4) + (playerinfo.mlevel * 10)) + 0.0) , max =(((playerinfo.level * 5) + (playerinfo.mlevel * 10)) + 0.0)},"

and this manarune needs to be use only for paladins and royal paladins.

Please help! rep++
 
In the future when you request a script to be made, always provide the server version, this speeds up the process of someone helping you.
Now what server version is this for?
 
ok Friend it would be nice and very helpfull becouse I don't find that what I need on forum, every single script are too old or calculate method is shity. sry for my English ;3
 
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 2000))

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local level = player:getLevel()
    local mlevel = player:getMagicLevel()
    local hpandma_minimum = (level * 4) + (SKILL_MAGLEVEL * 10)
    local hpandma_maximum = (level * 5) + (SKILL_MAGLEVEL * 10)
 
    if player:getVocation():getId() == 3 or 7 then
        player:addMana(math.random(hpandma_minimum, hpandma_maximum))
        player:addHealth(math.random(hpandma_minimum, hpandma_maximum))
        player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
    else
        return FALSE
    end
return TRUE
end

There you go.

Oh forgot to edit that post I posted well whatever.
 
Last edited by a moderator:
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 2000))

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local level = player:getLevel()
    local mlevel = player:getMagicLevel()
    local hpandma_minimum = (level * 4) + (SKILL_MAGLEVEL * 10)
    local hpandma_maximum = (level * 5) + (SKILL_MAGLEVEL * 10)

    if player:getVocation():getId() == 3 or 7 then
        player:addMana(math.random(hpandma_minimum, hpandma_maximum))
        player:addHealth(math.random(hpandma_minimum, hpandma_maximum))
        player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
    else
        return FALSE
    end
return TRUE
end

There you go.

Oh forgot to edit that post I posted well whatever.
ok now it work but I have problem with exActions.. in my config I have ExActions - 500 but on this rune I want ExActions - 1000 (1 second for use it) now I have 0.5 second, I can't change it. can you make Exhaustion 1 sec? no matter if there is 2000 or 10000 this script using my config ExActions.
 
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 2000))

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local level = player:getLevel()
    local mlevel = player:getMagicLevel()
    local hpandma_minimum = (level * 4) + (SKILL_MAGLEVEL * 10)
    local hpandma_maximum = (level * 5) + (SKILL_MAGLEVEL * 10)

    if player:getVocation():getId() == 3 or 7 then
        player:addMana(math.random(hpandma_minimum, hpandma_maximum))
        player:addHealth(math.random(hpandma_minimum, hpandma_maximum))
        player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
    else
        return FALSE
    end
return TRUE
end

There you go.

Oh forgot to edit that post I posted well whatever.
What is the purpose of this code?
Code:
if player:getVocation():getId() == 3 or 7 then
It might aswell just say :rolleyes:
Code:
if true then
Also TRUE and FALSE are not defined :(
 
What is the purpose of this code?
Code:
if player:getVocation():getId() == 3 or 7 then
It might aswell just say :rolleyes:
Code:
if true then
Also TRUE and FALSE are not defined :(
Ah. I see, I can also use this rune when I'm sorcerer..

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

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local level = player:getLevel()
    local mlevel = player:getMagicLevel()
    local hpandma_minimum = (level * 4) + (SKILL_MAGLEVEL * 10)
    local hpandma_maximum = (level * 5) + (SKILL_MAGLEVEL * 10)

    if player:getVocation():getId() == 3 or player:getVocation():getId() == 7 then
        player:addMana(math.random(hpandma_minimum, hpandma_maximum))
        player:addHealth(math.random(hpandma_minimum, hpandma_maximum))
        player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
    else
        player:sendCancelMessage("This rune is not usable for your vocation.")
    end
    return TRUE
end

What do you mean with this? @Omni Cloud
Also TRUE and FALSE are not defined :(
 
Last edited by a moderator:
TRUE and true are not the same, neither is false or FALSE if TRUE or FALSE are not defined then they hold a value of nil which is a non-value.
Oh yea forgot about that.
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)

setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 2000))

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local level = player:getLevel()
    local mlevel = player:getMagicLevel()
    local hpandma_minimum = (level * 4) + (SKILL_MAGLEVEL * 10)
    local hpandma_maximum = (level * 5) + (SKILL_MAGLEVEL * 10)

    if player:getVocation():getId() == 3 or player:getVocation():getId() == 7 then
        player:addMana(math.random(hpandma_minimum, hpandma_maximum))
        player:addHealth(math.random(hpandma_minimum, hpandma_maximum))
        player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
    else
        player:sendCancelMessage("This rune is not usable for your vocation.")
    end
    return true
end
but can you make it without using config.lua exActions? only exhausted - 1 second. i can't change my config.
Tbh, I don't know.
 
you call player:getVocation():getId() which is two functions calls two times, which afaik is quite a bit worse than just doing
local voc = player:getVocation():getId()
if voc <~ then
since that only calls the functions once, and then uses a set value
im not sure about this, but i think getPlayerVocation(player) is better than player:getVocation():getId() aswell, since it fetches player vocation directly, instead of fetching userdata and sending it to a function
nevermind about getPlayerVocation(player), just tested it and it seems to be slower, but my point about not calling it twice still stands

for testing purposes i used
case 1
Code:
print(os.time()) 
for i=1,x,1 do 
    k = (player:getVocation():getId() == 1) 
    z = (player:getVocation():getId() == 2) 
end 
print(os.time())
case 2
Code:
print(os.time()) 
for i=1,x,1 do 
    local y = player:getVocation():getId() 
    k = (y == 1) 
    z = (y == 2) 
end 
print(os.time())
and x = 50000000

where case 2 took 12 seconds to execute, and case 1 took 24 seconds (due to double function calls, calculation with values are almost instant)
 
Last edited:
you call player:getVocation():getId() which is two functions calls two times, which afaik is quite a bit worse than just doing
local voc = player:getVocation():getId()
if voc <~ then
since that only calls the functions once, and then uses a set value
im not sure about this, but i think getPlayerVocation(player) is better than player:getVocation():getId() aswell, since it fetches player vocation directly, instead of fetching userdata and sending it to a function
nevermind about getPlayerVocation(player), just tested it and it seems to be slower, but my point about not calling it twice still stands

for testing purposes i used
case 1
Code:
print(os.time())
for i=1,x,1 do
    k = (player:getVocation():getId() == 1)
    z = (player:getVocation():getId() == 2)
end
print(os.time())
case 2
Code:
print(os.time())
for i=1,x,1 do
    local y = player:getVocation():getId()
    k = (y == 1)
    z = (y == 2)
end
print(os.time())
and x = 50000000

where case 2 took 12 seconds to execute, and case 1 took 24 seconds (due to double function calls, calculation with values are almost instant)
So you would have done it like this:

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

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local getvocid = player:getVocation():getId()
local level = player:getLevel()
local mlevel = player:getMagicLevel()
local hpandma_minimum = (level * 4) + (SKILL_MAGLEVEL * 10)
local hpandma_maximum = (level * 5) + (SKILL_MAGLEVEL * 10)

if getvocid == 3 or getvocid == 7 then
player:addMana(math.random(hpandma_minimum, hpandma_maximum))
player:addHealth(math.random(hpandma_minimum, hpandma_maximum))
player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
else
player:sendCancelMessage("This rune is not usable for your vocation.")
end
return true
end
 
Last edited by a moderator:
Back
Top