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

Manarune 100x ends after one use

Hbraveq

Active Member
Joined
Nov 11, 2012
Messages
167
Reaction score
39
Hello
I have problem with manarune on othire 0 0 3.....
Manarune works well, but it ends after 1 use... (100 charges rune)
This is manarune script
function onUse(cid, item, frompos, itemEx, topos)
local playerinfo = -- Please don't touch
{
level = getPlayerLevel(cid),
mlevel = getPlayerMagLevel(cid),
voc = getPlayerVocation(cid)
}
local config =
{
strenght = "constant", ---Values: template (strenght dependent on level and magic level), constant (on all level adding same mana)
template = {min = (((playerinfo.level * 8) + (playerinfo.mlevel * 2)) / 1.5) , max =(((playerinfo.level * 12) + (playerinfo.mlevel * 4)) / 1.5)}, -- liczymy - lvl * 4 /1.5 = x m lvl * 2 /1.5 = x lvl + m lvl = Minimum, lvl * 6 /1.5 = x m lvl * 4 /1.5 = x lvl + m lvl = Maximum
constant = {min = 300, max = 500},--only if strenght is constant
exhaustion = 1,--exhaustion in secs
exhaustion_value = 56789, --exhaustion storage value
minimum_level = 1,--minimum level to use manarune
minimum_mlevel = 0,--minimum magic level to use manarune
cannot_use_voc = {0} --id vocation which cannot use
}
local rand = 0
if(isPlayer(itemEx.uid) == false) then
return true
end
if(playerinfo.level < config.minimum_level) then
return true
end
if(playerinfo.mlevel < config.minimum_mlevel) then
return true
end
if(isInArray(config.cannot_use_voc, playerinfo.voc)) then
return true
end
if(config.strenght ~= "template" and config.strenght ~= "constant") then
config.strenght = "constant"
end
if(getPlayerStorageValue(cid, config.exhaustion_value) > os.time()) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are exhausted.")
return true
end
if(config.strenght == "template") then
rand = math.random(config.template.min, config.template.max)
elseif (config.strenght == "constant") then
rand = math.random(config.constant.min, config.constant.max)
end
doPlayerAddMana(cid, rand)
setPlayerStorageValue(cid, config.exhaustion_value, (os.time() + config.exhaustion))
doCreatureSay(cid, "+"..math.floor(rand).." mana", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid, 1)
return true
end
and there is actions.xml line

<action itemid="2298" script="manarune.lua"/>
and spells.xml

<rune name="adura fiutazbuta" id="2298" maglv="0" needtarget="1" aggressive="0" charges="100" script="healing/manarune.lua" />
AND ITEMS.XML......
<item id="2298" article="a" name="mana rune">
<attribute key="type" value="rune"/>
<attribute key="weight" value="120"/>
<attribute key="runeSpellName" value="adura fiutazbuta"/>
<attribute key="charges" value="100"/>
<attribute key="showcharges" value="1"/>

HOW IS IT POSSIBLE, THAT IT ENDS AFTER 1 USE??????!!!!!!!
 
Last edited:
This is removing the item = Rune not a charge.
Lua:
doRemoveItem(item.uid, 1)
correct. I believe in the older version you want to do like this to remove charges
Lua:
if item.type > 1 then
    doChangeTypeItem(item.uid, item.type - 1)
else
    doRemoveItem(item.uid)
end
 
Back
Top