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

StorageID help

JoccE

CopyLeft (ɔ)
Joined
Aug 26, 2007
Messages
3,418
Solutions
1
Reaction score
93
Location
Sweden, Stockholm
Okey i got this quest guy but i want so you need to have storageID XXXX to be able to get a mission from him.
This is what i added:

LUA:
if (getPlayerStorageValue(cid,first.storage) > 0) then
		selfSay(npc_message[7], cid)
else


Whole Script
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)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
 
 
--------------------------------
------- NPC MISION  2.0 --------
------ by Acubens - Otland.net -
--------------------------------
 
 
local first = {
-- Place true if you want to use the system of a gift for experience, false if you want to use items
useExpReward = true,
-- The experience that will get the player at the end of the mission
experience = 50000,
-- Id of the item that will be asking for the NPC to complete the mission
item = 2668, 
-- Count of the item required
item_count = 1,  
-- id of the gift that going to obtain the player at finish the mission 
reward = 2160,
-- count of the gift item
reward_count = 1, 
-- storage
storage = 11002, 
-- name of the quest
questname = "Quest one",
-- Old Quest
old = 11005
}
 
local npc_message ={
 
-- Procced - message
"Have you collected the itemhere, from the Wizzard Tower?",
-- if you dont have items - message
"You dont have any items to this mission.", 
-- thanks - message
"Thank You for Help me, {take it}.",
-- already done - message
"You have already done this mision.",
-- ready to go - message
"Hello Adventurer. For the mission {"..first.questname.."} I need you too collect one of the itemhere from the top of the Wizzard tower.",
-- congratulations - message
"Congratulations, you have finished the "..first.questname.."",
-- Message7
"Need to complete 7 First"
}

if (getPlayerStorageValue(cid,first.storage) > 0) then
		selfSay(npc_message[7], cid)
else

	if(msgcontains(msg, 'mission')) then
		selfSay(npc_message[5], cid)
	end

	if(msgcontains(msg, first.questname)) then
		selfSay(npc_message[1], cid)
		talkState[talkUser] = 1
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if (getPlayerStorageValue(cid,first.storage) > 0) then
			selfSay(npc_message[4], cid)
		else
			if(doPlayerRemoveItem(cid,first.item,first.item_count)) then
				setPlayerStorageValue(cid,first.storage,1)
				if(useExpReward) then
					doPlayerAddExperience(cid,first.experience)
				else
					doPlayerAddItem(cid,first.reward,first.reward_count)
				end
				selfSay(npc_message[3], cid)
				doSendMagicEffect(getCreaturePosition(cid), 10)
				doCreatureSay(cid, npc_message[6], TALKTYPE_ORANGE_1)
			else
				selfSay(npc_message[2], cid)
			end
		end
	return true
	end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


What am i Doing wrong o.O?
 
added a new storage variable required. you can't use the same one for quest completion
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local talkState = {}
local first = {
	-- Place true if you want to use the system of a gift for experience, false if you want to use items
	useExpReward = true,
	-- The experience that will get the player at the end of the mission
	experience = 50000,
	-- Id of the item that will be asking for the NPC to complete the mission
	item = 2668,
	-- Count of the item required
	item_count = 1,
	-- id of the gift that going to obtain the player at finish the mission
	reward = 2160,
	-- count of the gift item
	reward_count = 1,
	-- storage
	storage = 11002,
	-- required storage
	required = 11000,
	-- name of the quest
	questname = "Quest one",
	-- Old Quest
	old = 11005
}
local npc_message ={
	-- Procced - message
	"Have you collected the itemhere, from the Wizzard Tower?",
	-- if you dont have items - message
	"You dont have any items to this mission.",
	-- thanks - message
	"Thank You for Help me, {take it}.",
	-- already done - message
	"You have already done this mision.",
	-- ready to go - message
	"Hello Adventurer. For the mission {"..first.questname.."} I need you too collect one of the itemhere from the top of the Wizzard tower.",
	-- congratulations - message
	"Congratulations, you have finished the "..first.questname,
	-- Message7
	"Need to complete 7 First"
}

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)
	if not npcHandler:isFocused(cid) then
		return false
	elseif getCreatureStorage(cid,first.required) == -1 then
		selfSay(npc_message[7], cid)
	elseif msgcontains(msg, 'mission') then
		selfSay(npc_message[5], cid)
	elseif msgcontains(msg, first.questname) then
		selfSay(npc_message[1], cid)
		talkState[cid] = 1
	elseif msgcontains(msg, 'yes') and talkState[cid] == 1 then
		if getCreatureStorage(cid, first.storage) == 1 then
			selfSay(npc_message[4], cid)
		else
			if(doPlayerRemoveItem(cid, first.item, first.item_count)) then
				doCreatureSetStorage(cid, first.storage,1)
				if(useExpReward) then
					doPlayerAddExperience(cid, first.experience)
				else
					doPlayerAddItem(cid,first.reward, first.reward_count)
				end
				selfSay(npc_message[3], cid)
				doSendMagicEffect(getCreaturePosition(cid), 10)
				doCreatureSay(cid, npc_message[6], TALKTYPE_ORANGE_1)
			else
				selfSay(npc_message[2], cid)
			end
		end
		talkState[cid] = nil
	end
	return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
added a new storage variable required. you can't use the same one for quest completion
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local talkState = {}
local first = {
	-- Place true if you want to use the system of a gift for experience, false if you want to use items
	useExpReward = true,
	-- The experience that will get the player at the end of the mission
	experience = 50000,
	-- Id of the item that will be asking for the NPC to complete the mission
	item = 2668,
	-- Count of the item required
	item_count = 1,
	-- id of the gift that going to obtain the player at finish the mission
	reward = 2160,
	-- count of the gift item
	reward_count = 1,
	-- storage
	storage = 11002,
	-- required storage
	required = 11000,
	-- name of the quest
	questname = "Quest one",
	-- Old Quest
	old = 11005
}
local npc_message ={
	-- Procced - message
	"Have you collected the itemhere, from the Wizzard Tower?",
	-- if you dont have items - message
	"You dont have any items to this mission.",
	-- thanks - message
	"Thank You for Help me, {take it}.",
	-- already done - message
	"You have already done this mision.",
	-- ready to go - message
	"Hello Adventurer. For the mission {"..first.questname.."} I need you too collect one of the itemhere from the top of the Wizzard tower.",
	-- congratulations - message
	"Congratulations, you have finished the "..first.questname,
	-- Message7
	"Need to complete 7 First"
}

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)
	if not npcHandler:isFocused(cid) then
		return false
	elseif getCreatureStorage(cid,first.required) == -1 then
		selfSay(npc_message[7], cid)
	elseif msgcontains(msg, 'mission') then
		selfSay(npc_message[5], cid)
	elseif msgcontains(msg, first.questname) then
		selfSay(npc_message[1], cid)
		talkState[cid] = 1
	elseif msgcontains(msg, 'yes') and talkState[cid] == 1 then
		if getCreatureStorage(cid, first.storage) == 1 then
			selfSay(npc_message[4], cid)
		else
			if(doPlayerRemoveItem(cid, first.item, first.item_count)) then
				doCreatureSetStorage(cid, first.storage,1)
				if(useExpReward) then
					doPlayerAddExperience(cid, first.experience)
				else
					doPlayerAddItem(cid,first.reward, first.reward_count)
				end
				selfSay(npc_message[3], cid)
				doSendMagicEffect(getCreaturePosition(cid), 10)
				doCreatureSay(cid, npc_message[6], TALKTYPE_ORANGE_1)
			else
				selfSay(npc_message[2], cid)
			end
		end
		talkState[cid] = nil
	end
	return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


Yeh i copy pasted wrong i had if (getPlayerStorageValue(cid,first.old) > 0) then

But yours worked :) Thank you!
 
Back
Top