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

Rune error

denkan97

Well-Known Member
Joined
Dec 27, 2011
Messages
327
Solutions
2
Reaction score
50
Trying to make all the runes to only work for the right voc but keep getting a error


Script.

Lua:
local exhausted = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhausted, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local min, max
    local lvl, mag = getPlayerLevel(cid), getPlayerMagLevel(cid)
    if isSorcerer(cid) or isDruid(cid) then
        min = lvl * 0 + mag * 0
        max = lvl * 0 + mag * 0
       doPlayerSendCancel(cid, "This can only be used by knights.")
    elseif isPaladin(cid) then
        min = lvl * 0 + mag * 0
        max = lvl * 0 + mag * 0
       doPlayerSendCancel(cid, "This can only be used by knights.")
    elseif isKnight(cid) then
        min = lvl * 8.6 + mag * 6.3
        max = lvl * 8.9 + mag * 6.5
    end
  
    local rand = math.random(min, max)
    if rand > 10000 then
        rand = 10000
    end
  
    if rand < 100 then
        rand = 0
    end
  
    if hasCondition(cid, CONDITION_EXHAUST_HEAL) then
        return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
    end
  
    if not isPlayer(itemEx.uid) then
        return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
    end
  
    return
        if isKnight(cid) then
        doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE) and doCreatureAddHealth(itemEx.uid, rand) and doAddCondition(cid, exhausted) and doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
        else
        doPlayerSendCancel(cid, "This can only be used by knights.")
    end
end

Error. Gyazo - 9dd46684581094aa8693e08b8ac6e757.png

(think thats all you need to know :confused:)
 
Last edited:
Lua:
local array_knight = {4, 8}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local exhausted = createConditionObject(CONDITION_EXHAUST)
    setConditionParam(exhausted, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

    if not isPlayer(itemEx.uid) then
        return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
    end
   
    if hasCondition(cid, CONDITION_EXHAUST_HEAL) then
        return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
    end
   
    if not isInArray(array_knight, getPlayerVocation(cid)) then
        return doPlayerSendCancel(cid, "Only knights can use this item.")
    end
   
    local min = getPlayerLevel(cid) * 8.6 + getPlayerMagLevel(cid) * 6.3
    local max = getPlayerLevel(cid)  * 8.9 + getPlayerMagLevel(cid) * 6.5

    local rand = math.random(min, max)

    if rand > 10000 then
        rand = 10000
    elseif rand < 100 then
        rand = 0
    end

    doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
    doCreatureAddHealth(itemEx.uid, rand)
    doAddCondition(cid, exhausted)
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
return true
end
 
@Itutorial when i see your answer i feel im way over my head trying to understand what im doing :confused:


Soo if im gonna use this for a mr i need to change

local array_knight = {4, 8} For the right vocs

doCreatureAddHealth(itemEx.uid, rand) to doCreatureAddMana(itemEx.uid, rand)

return doPlayerSendCancel(cid, "Only knights can use this item.") Only the text here.

But what do i do if i want to make it a paladin rune?

Sry for all the spam im WAY over my head.
 
Last edited:
You could change:

local array_knight = {4, 8}

to

local array_knight = {3, 7} --This would be paladin vocation id 3 and 7

or for sorc/druid

local array_knight = {1, 2, 5, 6}
 
Trying to make all the runes to only work for the right voc but keep getting a error


Script.
local exhausted = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhausted, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
local min, max
local lvl, mag = getPlayerLevel(cid), getPlayerMagLevel(cid)
if isSorcerer(cid) or isDruid(cid) then
min = lvl * 0 + mag * 0
max = lvl * 0 + mag * 0
doPlayerSendCancel(cid, "This can only be used by knights.")
elseif isPaladin(cid) then
min = lvl * 0 + mag * 0
max = lvl * 0 + mag * 0
doPlayerSendCancel(cid, "This can only be used by knights.")
elseif isKnight(cid) then
min = lvl * 8.6 + mag * 6.3
max = lvl * 8.9 + mag * 6.5
end

local rand = math.random(min, max)
if rand > 10000 then
rand = 10000
end

if rand < 100 then
rand = 0
end

if hasCondition(cid, CONDITION_EXHAUST_HEAL) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
end

if not isPlayer(itemEx.uid) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end

return
if isKnight(cid) then
doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE) and doCreatureAddHealth(itemEx.uid, rand) and doAddCondition(cid, exhausted) and doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
else
doPlayerSendCancel(cid, "This can only be used by knights.")
end
end


Error. Gyazo - 9dd46684581094aa8693e08b8ac6e757.png

(think thats all you need to know :confused:)

Please read the rules; Rules for the Support board
How to display CODE properly in your post
 
Back
Top