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

Lua Antidote Potion Bug

Bill3000

New Member
Joined
Jul 26, 2010
Messages
106
Reaction score
1
My Antidote Potion cures poison, but don't add an empty potion when used:

Lua:
local EMPTY_POTION = 7636
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_POISON)
 
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions'))
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if(not isPlayer(itemEx.uid)) then
                return false
        end
 
        if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
                doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
                return true
        end
 
        if(not doCombat(cid, combat, numberToVariant(itemEx.uid))) then
                return false
        end
 
        doAddCondition(cid, exhaust)
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
 
        doRemoveItem(item.uid, 1)
        if(fromPosition ~= CONTAINER_POSITION) then
                doCreateItem(potion.empty, fromPosition)
        else
                doPlayerAddItem(cid, potion.empty, 1)
        end
 
        return true
end

This is the console error:

Code:
antidote_potion.lua:31: attemptto index global 'potion' <a nil value>
 
Back
Top