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

NPC gives STORAGE (travel) for the items

Balicuss

New Member
Joined
Jul 5, 2009
Messages
193
Reaction score
1
Location
POLand
Hello !
I need a NPC that gives STORAGE for 50 demonic essences and access to the island. When I give him 50 demonic essences he gets a trip 5cc.
 
Last edited:
Lua:
		if doPlayerRemoveItem(cid, 6500, 50) then
			doCreatureSetStorageValue(cid, 3949, 1)
			selfSay('Now i can give you a trip for 5 crystal coins to dangerous island!', cid)
		else
		selfSay('I feeling... you don\'t have my demonic essences!', cid)
	end
Lua:
if (getCreatureStorageValue(cid, 3949) == 1) then
	if doPlayerRemoveMoney(cid, 50000) then
		local newpos = {x = 544, y = 841, z = 7}
		doTeleportThing(cid, newpos)
		selfSay('Beware of strong creatures, there!', cid)
		else
		selfSay('I don\'t trust you, at the moment!', cid)
	end
else
selfSay('My old eyes dont spotted shiny crystal coins on your hands. Come back when you got 5 crystal coins.', cid)
end
 
Last edited:
All in one NPC edit the locals.

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	--[[
	REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!
	]]--
	local storage = 1337
	local itemID = 1337
	local itemName = Demonic Essence
	local itemAmount = 1337
	local teleport = {x=1000, y=1000, z=7}
	if(msgcontains(msg, 'travel') or msgcontains(msg, 'teleport')) then
		if(getPlayerStorageValue(cid, storage) == -1) then
			npcHandler:say("Hello young one, you'r face looks similar. Have we met? Anyway, I teleport my minions to the underworld for a small price. Bring me ".. itemAmount .." ".. itemName .."!", cid)
			setPlayerStorageValue(cid, storage, 1)
		elseif(getPlayerStorageValue(cid, storage) == 1) then
			npcHandler:say("Did you bring me ".. itemAmount .." ".. itemName .."?", cid)
			talkState[talkUser] = 1
		elseif(getPlayerStorageValue(cid, storage) == 2) then
			npcHandler:say("Would you like to travel again for 5 crystal coins?", cid)
			talkState[talkUser] = 2
		end
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if(doPlayerRemoveItem(cid, itemID, itemAmount)) then
			npcHandler:say("Thankyou oh wise one, I will never forget you! I shall teleport you now.", cid)
			setPlayerStorageValue(cid, storage, 2)
			doTeleportThing(cid, teleport)
			talkState[talkUser] = 0
			else
			npcHandler:say("You do not have my items!", cid)
			talkState[talkUser] = 0
		elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
			if doPlayerRemoveMoney(cid, 50000) == true then
			doTelePortThing(cid, position)
			else
			npcHandler:say("Sorry, you dont have 5 crystal coins!", cid)
			talkState[talkUser] = 0
		end
	elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
		npcHandler:say("Then not.", cid)
		talkState[talkUser] = 0
	end
	return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
[23:15:36.269] stack traceback:
[23:15:36.807] [Error - LuaInterface::loadFile] data/npc/scripts/TEST.lua:17: '=
' expected near 'local'
[23:15:36.808] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scr
ipts/TEST.lua
[23:15:36.808] data/npc/scripts/TEST.lua:17: '=' expected near 'local'

All in one NPC edit the locals.

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	--[[
	REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!
	]]--
	local storage = 1337
	local itemID = 1337
	local itemName = Demonic Essence
	local itemAmount = 1337
	local teleport = {x=1000, y=1000, z=7}
	if(msgcontains(msg, 'travel') or msgcontains(msg, 'teleport')) then
		if(getPlayerStorageValue(cid, storage) == -1) then
			npcHandler:say("Hello young one, you'r face looks similar. Have we met? Anyway, I teleport my minions to the underworld for a small price. Bring me ".. itemAmount .." ".. itemName .."!", cid)
			setPlayerStorageValue(cid, storage, 1)
		elseif(getPlayerStorageValue(cid, storage) == 1) then
			npcHandler:say("Did you bring me ".. itemAmount .." ".. itemName .."?", cid)
			talkState[talkUser] = 1
		elseif(getPlayerStorageValue(cid, storage) == 2) then
			npcHandler:say("Would you like to travel again for 5 crystal coins?", cid)
			talkState[talkUser] = 2
		end
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if(doPlayerRemoveItem(cid, itemID, itemAmount)) then
			npcHandler:say("Thankyou oh wise one, I will never forget you! I shall teleport you now.", cid)
			setPlayerStorageValue(cid, storage, 2)
			doTeleportThing(cid, teleport)
			talkState[talkUser] = 0
			else
			npcHandler:say("You do not have my items!", cid)
			talkState[talkUser] = 0
		elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
			if doPlayerRemoveMoney(cid, 50000) == true then
			doTelePortThing(cid, position)
			else
			npcHandler:say("Sorry, you dont have 5 crystal coins!", cid)
			talkState[talkUser] = 0
		end
	elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
		npcHandler:say("Then not.", cid)
		talkState[talkUser] = 0
	end
	return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	--[[
	REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!
	]]--
	local storage = 1337
	local itemID = 1337
	local itemName = "Demonic Essence"
	local itemAmount = 1337
	local teleport = {x=1000, y=1000, z=7}
	if(msgcontains(msg, 'travel') or msgcontains(msg, 'teleport')) then
		if(getPlayerStorageValue(cid, storage) == -1) then
			npcHandler:say("Hello young one, you'r face looks similar. Have we met? Anyway, I teleport my minions to the underworld for a small price. Bring me ".. itemAmount .." ".. itemName .."!", cid)
			setPlayerStorageValue(cid, storage, 1)
		elseif(getPlayerStorageValue(cid, storage) == 1) then
			npcHandler:say("Did you bring me ".. itemAmount .." ".. itemName .."?", cid)
			talkState[talkUser] = 1
		elseif(getPlayerStorageValue(cid, storage) == 2) then
			npcHandler:say("Would you like to travel again for 5 crystal coins?", cid)
			talkState[talkUser] = 2
		end
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if(doPlayerRemoveItem(cid, itemID, itemAmount)) then
			npcHandler:say("Thankyou oh wise one, I will never forget you! I shall teleport you now.", cid)
			setPlayerStorageValue(cid, storage, 2)
			doTeleportThing(cid, teleport)
			talkState[talkUser] = 0
			else
			npcHandler:say("You do not have my items!", cid)
			talkState[talkUser] = 0
		elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
			if doPlayerRemoveMoney(cid, 50000) == true then
			doTelePortThing(cid, position)
			else
			npcHandler:say("Sorry, you dont have 5 crystal coins!", cid)
			talkState[talkUser] = 0
		end
	elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
		npcHandler:say("Then not.", cid)
		talkState[talkUser] = 0
	end
	return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Lua:
end
before
Lua:
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
			if doPlayerRemoveMoney(cid, 50000) == true then

Lua:
doTelePortThing(cid, position)

to

Lua:
doTeleportThing(cid, teleport)

After the changes everything works. Many thanks.
 
Last edited:
hmm how can I add new pos to this script ?

Lua:
local storage = 1337
	local itemID = 6500
	local itemName = "Demonic Essence"
	local itemAmount = 50
	local teleport = {x=800, y=743, z=2} ----> VOOLCANO
        local teleport = {x=400, y=343, z=7} ----> ENIGMA

Lua:
local teleport1 = {x=400, y=343, z=7}
and
Lua:
doTeleportThing(cid, teleport1)
?
 
22:42 Balicus [1000]: hi
22:42 TEST: Hum Humm! Welcume lil' Balicus. I can melt items to special metals. If you dont know names metals, say 'metals'.
22:43 Balicus [1000]: center
22:43 TEST: Would you like to travel again for 1 crystal coins?
22:43 Balicus [1000]: yes
22:43 TEST: How rude!
22:43 Balicus [1000]: hi
22:43 TEST: Hum Humm! Welcume lil' Balicus. I can melt items to special metals. If you dont know names metals, say 'metals'.
22:43 Balicus [1000]: voolcano
22:43 TEST: Would you like to travel again for 1 crystal coins?
22:43 TEST: Then not.
22:43 Balicus [1000]: yes

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	--[[
	REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!
	]]--
	local storage = 1337
	local itemID = 6500
	local itemName = "Demonic Essence"
	local itemAmount = 50
	local teleport2 = {x=800, y=743, z=2}
	local teleport1 = {x=400, y=343, z=7}
	if(msgcontains(msg, 'voolcano')) then
		if(getPlayerStorageValue(cid, storage) == -1) then
			npcHandler:say("Hello young one, you'r face looks similar. Have we met? Anyway, I teleport my minions to the underworld for a small price. Bring me ".. itemAmount .." ".. itemName .."!", cid)
			setPlayerStorageValue(cid, storage, 1)
		elseif(getPlayerStorageValue(cid, storage) == 1) then
			npcHandler:say("Did you bring me ".. itemAmount .." ".. itemName .."?", cid)
			talkState[talkUser] = 1
		elseif(getPlayerStorageValue(cid, storage) == 2) then
			npcHandler:say("Would you like to travel again for 1 crystal coins?", cid)
			talkState[talkUser] = 2
		end
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if(doPlayerRemoveItem(cid, itemID, itemAmount)) then
			npcHandler:say("Thankyou oh wise one, I will never forget you! I shall teleport you now.", cid)
			setPlayerStorageValue(cid, storage, 2)
			doTeleportThing(cid, teleport2)
			talkState[talkUser] = 0
			else
			npcHandler:say("You do not have my items!", cid)
			talkState[talkUser] = 0
		end
		elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
			if doPlayerRemoveMoney(cid, 10000) == true then
			doTeleportThing(cid, teleport2, true)
			else
			npcHandler:say("Sorry, you dont have 1 crystal coins!", cid)
			talkState[talkUser] = 0
		end
	elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
		npcHandler:say("Then not.", cid)
		talkState[talkUser] = 0
end

--[CENTER]--
	if(msgcontains(msg, 'center') or msgcontains(msg, 'center city')) then
		if(getPlayerStorageValue(cid, storage) == -1) then
			npcHandler:say("Hello young one, you'r face looks similar. Have we met? Anyway, I teleport my minions to the underworld for a small price. Bring me ".. itemAmount .." ".. itemName .."!", cid)
			setPlayerStorageValue(cid, storage, 1)
		elseif(getPlayerStorageValue(cid, storage) == 1) then
			npcHandler:say("Did you bring me ".. itemAmount .." ".. itemName .."?", cid)
			talkState[talkUser] = 1
		elseif(getPlayerStorageValue(cid, storage) == 2) then
			npcHandler:say("Would you like to travel again for 1 crystal coins?", cid)
			talkState[talkUser] = 2
		end
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if(doPlayerRemoveItem(cid, itemID, itemAmount)) then
			npcHandler:say("Thankyou oh wise one, I will never forget you! I shall teleport you now.", cid)
			setPlayerStorageValue(cid, storage, 2)
			doTeleportThing(cid, teleport1)
			talkState[talkUser] = 0
			else
			npcHandler:say("You do not have my items!", cid)
			talkState[talkUser] = 0
		end
		elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
			if doPlayerRemoveMoney(cid, 10000) == true then
			doTeleportThing(cid, teleport1, true)
			else
			npcHandler:say("Sorry, you dont have 1 crystal coins!", cid)
			talkState[talkUser] = 0
		end
	elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
		npcHandler:say("Then not.", cid)
		talkState[talkUser] = 0
	end
	return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

It doesn't work ;/
 
Last edited:
Ill fix it for you now, give me a moment.

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	
-- Configuration --
	local t = {
		volcano = {x=0, y=0, z=0},
		center = {x=0, y=0, z=0}
	}
	
	local c = {
	    storage = 1337,
		itemID = 6500,
	    itemName = "Demonic Essence",
        itemAmount = 50,
		completePrice = 50000
	}
	
	
if(msgcontains(msg, 'travel') or msgcontains(msg, 'teleport')) then
	if(getPlayerStorageValue(cid, c.storage) == -1) then
			npcHandler:say("Hello young one, you'r face looks similar. Have we met? Anyway, I teleport my minions to the underworld for a small price. Bring me ".. c.itemAmount .." ".. c.itemName .."!", cid)
			setPlayerStorageValue(cid, c.storage, 1)
	elseif(getPlayerStorageValue(cid, c.storage) == 1) then
			npcHandler:say("Did you bring me ".. c.itemAmount .." ".. c.itemName .."?", cid)
			talkState[talkUser] = 1
	elseif(getPlayerStorageValue(cid, c.storage) == 3) then
			npcHandler:say("Would you like to travel again for 5 crystal coins?", cid)
			talkState[talkUser] = 2
		end
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if(doPlayerRemoveItem(cid, c.itemID, c.itemAmount)) then
			npcHandler:say("Thankyou oh wise one, Where would you like to go? {Volcano} or {Center city}", cid)
			setPlayerStorageValue(cid, storage, 3)
			talkState[talkUser] = 3
		else
		npcHandler:say("Wrong items!", cid)
		talkState[talkUser] = 0
		end
	elseif(msgcontains(msg, 'volcano') and talkState[talkUser] == 3) then
		doTeleportThing(cid, t.volcano)
			setPlayerStorageValue(cid, c.storage, 3)
				talkState[talkUser] = 0
	elseif(msgcontains(msg, 'center city') and talkState[talkUser] == 3) then
		doTeleportThing(cid, t.center)
			setPlayerStorageValue(cid, c.storage, 3)
				talkState[talkUser] = 0
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
		npcHandler:say("Would you like to go to {volcano} or {center city}?", cid)
			talkState[talkUser] = 4
	elseif(msgcontains(msg, 'volcano') and talkState[talkUser] == 4) then
		if doPlayerRemoveMoney(cid, c.completePrice) then
			doTeleportThing(cid, t.volcano)
				talkState[talkUser] = 0
	else
		npcHandler:say("Not enough money, you need ".. c.completePrice .."!", cid)
		end
	elseif(msgcontains(msg, 'center city') and talkState[talkUser] == 4) then
		if doPlayerRemoveMoney(cid, c.completePrice) then
			doTeleportThing(cid, t.center)
				talkState[talkUser] = 0
end
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
Change these

Lua:
elseif(msgcontains(msg, 'volcano')

to whatever

You don't understand me. Now this script works as follows:
I - HI
I - Travel
NPC - Would you like to travel again for 5 crystal coins?
I - YES
NPC - Thankyou oh wise one, Where would you like to go? {Volcano} or {Center city}"

and should:
I - Hi
I - Voolcano
NPC - Would you like to travel again for 1 crystal coins?
I - Yes (npc teleport me to voolcano)

or

I - Hi
I - Center
NPC - Would you like to travel again for 1 crystal coins?
I - Yes (npc teleport me to center)
 
Back
Top