• 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 isSorcerer, isDruid error console

davidmemo

New Member
Joined
Mar 28, 2011
Messages
37
Reaction score
0
This is the error console
error_is_sorcerer.png


this is my script
Code:
local berserker = Condition(CONDITION_ATTRIBUTES)
berserker:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
berserker:setParameter(CONDITION_PARAM_SKILL_MELEE, 5)
berserker:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mastermind = Condition(CONDITION_ATTRIBUTES)
mastermind:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
mastermind:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 3)
mastermind:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local bullseye = Condition(CONDITION_ATTRIBUTES)
bullseye:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 1000)
bullseye:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 5)
bullseye:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local config = {
    [7439] = berserker,
    [7440] = mastermind,
    [7443] = bullseye
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local useItem = config[item.itemid]
    if not useItem then
        return true
    end

    local player = Player(cid)
    if item.itemid == 7440 then
        if not (isSorcerer(cid) or isDruid(cid)) then
            player:say('Only sorcerers and druids may drink this fluid.', TALKTYPE_MONSTER_SAY)
            return true
        end
    end

    player:addCondition(useItem)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    Item(item.uid):remove(1)
    return true
end


Code:
if not player:isSorcerer() or player:isDruid() then

the solution
 
Last edited:
In your global.lua replace these:
Code:
function isSorcerer(cid)
    local player = Player(cid)
    if player == nil then
        return false
    end
    return isInArray({1, 5}, player:getVocation():getId())
end

function isDruid(cid)
    local player = Player(cid)
    if player == nil then
        return false
    end
    return isInArray({2, 6}, player:getVocation():getId())
end

function isPaladin(cid)
    local player = Player(cid)
    if player == nil then
        return false
    end
    return isInArray({3, 7}, player:getVocation():getId())
end

function isKnight(cid)
    local player = Player(cid)
    if player == nil then
        return false
    end
    return isInArray({4, 8}, player:getVocation():getId())
end


with these:
Code:
function Player.isSorcerer(self)
    return isInArray({1, 5}, self:getVocation():getId())
end

function Player.isDruid(self)
    return isInArray({2, 6}, self:getVocation():getId())
end

function Player.isPaladin(self)
    return isInArray({3, 7}, self:getVocation():getId())
end

function Player.isKnight(self)
    return isInArray({4, 8}, self:getVocation():getId())
end
 
tanks i solve this error by changing this
Code:
if not (isSorcerer(cid) or isDruid(cid)) then
for this
Code:
if not player:isSorcerer() or player:isDruid() then
 
Oh you did solve it, i thougt you needed the missing functions :P I know, since i was the one who changed those functions to OOP.
 
the problem is that I download the new version, but did not include the new compat.lua many functions that included the old compat, and I copy and paste that was missing in the new old compat.lua, and all this happened to compile the most updated version of its vercion TheForgottenServer,you did not realize that I suppose, that the real vercion map would have some bugs with the new vercion your TheForgottenServer: c
 

Similar threads

Back
Top