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

item count on pos. Othire

nilaya

New Member
Joined
Dec 29, 2011
Messages
18
Reaction score
0
Hello!

can anyone help me with this ?

I made a quest where a specific amount of skulls should be placed on a empty basin. But i can't figure out how to make the item count work.

Lua:
function onUse(cid, item, pos)

    skulls = {x=33365, y=32050, z=8, stackpos=255}
    newpos = {x=33336, y=32068, z=8}

    getskulls = getThingfromPos(skulls)
    
    if item.actionid == 5011 and getskulls.itemid == 2229 and getItemCountOnPosition(2229, 6) then
        doPlayerSendTextMessage(cid, 22, 'Success!')
        doTeleportThing(cid,newpos)
        doSendMagicEffect(getCreaturePosition(cid), 10)
        
    else
    doPlayerSendTextMessage(cid, 22, 'Sorry!!')
    pos.y = pos.y+1
    doTeleportThing(cid, pos)
    doSendMagicEffect(pos, 15)
    end
    return true
end

Lua:
Lua Script Error: [Action Interface]
data/actions/scripts/quests/TQFG/lever_last.lua:onUse

data/actions/scripts/quests/TQFG/lever_last.lua:8: attempt to call global 'getItemCountOnPosition' (a nil value)
stack traceback:
        data/actions/scripts/quests/TQFG/lever_last.lua:8: in function <data/actions/scripts/quests/TQFG/lever_last.lua:1>




Anyone got a idea ? Thanks in advance!
Post automatically merged:

Also trying another script where a NPC is summoned when pulling a lever. But nothing happends. No errors or nothing.

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local c = {
        standPos = {x= 33365, y= 32055, z= 8}, -- Position player stands to use lever. {x = 33365, y = 32055, z = 8}
        itemPos = {x= 33365, y= 32050, z= 8, stackpos=255}, -- Position of the place item is put. {x = 33365, y = 32050, z = 8}
        itemID = 2229, -- ID of the item they need on the itemPos position.
        itemAmount = 6, -- Amount they need.
        lever = 5011, -- ActionID of the lever.
        npcName = "Ghost of Chinmoy", -- NPC name to spawn.
        npcPos = {x=33365, y=32053, z=8} -- Position of NPC
    }
    
local functions = {
         getPos = getThingfromPos(c.itemPos)   
        
        }
if getPlayerPosition(cid, standPos) and getThingfromPos(c.itemPos) == true then
    if(item.actionid == c.lever) then
        if functions.getPos.itemid == c.itemID and functions.getPos.type >= c.itemAmount then
            doTransformItem(item.uid, 1946)       
                doRemoveItem(functions.getPos.uid, c.itemAmount)
                    doSendMagicEffect(c.itemPos, CONST_ME_POFF)
                        doCreateNpc(c.npcName, c.npcPos)
    else
        doPlayerSendCancel(cid,"Sorry, you need a specific item to use this lever!")
        return true
            end
        end
    end
end
 
Last edited:
Back
Top