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

Stupid container bug lol

Mokerhamer

Retired Global Mod
Senator
Joined
Aug 6, 2007
Messages
1,767
Reaction score
35
oke last time :p

I'm using this function so npc's sell bp with runes

Code:
doAddContainerItem(doPlayerAddItem(cid, [COLOR="Blue"]2002[/COLOR], [COLOR="Red"]1[/COLOR]), [COLOR="Magenta"]2268[/COLOR], [COLOR="Yellow"]1[/COLOR])
Blue= Bp id
Red= changed but nothing happened
Purple=Item id
Yellow=Rune charges

But for some reason it only put's 1 sd rune in the back i'v tryt to many things just cant it working!
and where is the remove money part

and i get this bug lol:
Code:
Lua Script Error: [Npc interface] 
data/npc/scripts/runes.lua:onCreatureSay

luaDoAddContainerItem(). Container not found
 
Last edited:
@Mokerhamer

Add this to data/npc/lib/npc.lua

Code:
function buyContainer(cid, container, itemid, count, money)
	if doPlayerRemoveMoney(cid, money) == 1 then
		bp = doPlayerAddItem(cid, container, 1)
		x = 0
		
		while x < 20 do
			doAddContainerItem(bp, itemid, count)
			x = x + 1
		end
		
		selfSay('Here you are.')
	else
		selfSay('Sorry, you don\'t have enough money.')
	end
end
And use this script:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)             npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)     npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                         npcHandler:onThink() end
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    if(npcHandler.focus ~= cid) then
        return false
    end

        if msgcontains(msg, 'bp of sd') or msgcontains(msg, 'backpack sd') or msgcontains(msg, 'backpack of sudden death runes') then
            selfSay('Do you want buy bacpack of sudden death runes for 9000gp?')
            talk_state = 1
        elseif msgcontains(msg, 'bp of uh') or msgcontains(msg, 'backpack uh') then
            selfSay('Do you want buy backpack of ultimate healing runes for 6500gp?')
            talk_state = 2
        elseif msgcontains(msg, 'bp of explo') or msgcontains(msg, 'backpack explo') or msgcontains(msg, 'bp explosion') or msgcontains(msg, 'bacpack explosion') then
            selfSay('Do you want buy bacpack of explosion runes for 8000gp?')
            talk_state = 3
        elseif msgcontains(msg, 'bp of hmm') or msgcontains(msg, 'backpack hmm') then
            selfSay('Do you want buy backpack of heavy magic missile runes for 5000gp?')
            talk_state = 4
        elseif msgcontains(msg, 'bp of gfb') or msgcontains(msg, 'backpack gfb') then
            selfSay('Do you want buy backpack of great fireball runes for 7000gp?')
            talk_state = 5
        elseif msgcontains(msg, 'bp of manafluid') then
            selfSay('Do you want buy backpack of manafluids for 2000gp?')
            talk_state = 6
------------------------------------------------ confirm yes ------------------------------------------------
			elseif msgcontains(msg, 'yes') and talk_state == 1 then
                    buyContainer(cid,5926,2268,5,9000)
                talk_state = 0
            
			elseif msgcontains(msg, 'yes') and talk_state == 2 then
                    buyContainer(cid,5949,2273,5,6500)
            talk_state = 0
            
			elseif msgcontains(msg, 'yes') and talk_state == 3 then
                    buyContainer(cid,2000,2313,15,8000)
            talk_state = 0
            
			elseif msgcontains(msg, 'yes') and talk_state == 4 then
                    buyContainer(cid,2001,2311,5,5000)
            talk_state = 0
            
			elseif msgcontains(msg, 'yes') and talk_state == 5 then
                    buyContainer(cid,2000,2304,2,7000)
            talk_state = 0
            
            elseif msgcontains(msg, 'yes') and talk_state == 6 then
                    buyContainer(cid,2001,2006,7,2000)
            talk_state = 0
------------------------------------------------ confirm no ------------------------------------------------
        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 6) then
            selfSay('Ok than.')
            talk_state = 0
        end

    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Hehe nice but i want it a bit diferent i want like:

Example:
Buy 5 sudden death
Buy 5 backpacks of sudden death

I'm trying to inplant the getCOunt function.. so it will take some work and time
UNLESS you have one lol
 
Last edited:
erm, why make that? make the players do some hard word! mowahaha!

serious.. not a real reason to do that. Make a lua script that when u right click a certain thing, like a rock or something, it removes money and gives you the SD´s =p
 
Back
Top