DiegoRulez
Member
I'm using scripts for NPCs based on tutorial Limos.
https://otland.net/threads/npc-mission.211063/
How do you already have to have a storage to talk to this NPC ?
and..
How can I make it delivered to storage without giving anything in return ?
https://otland.net/threads/npc-mission.211063/
Code:
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
local storage = 55201
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, "word of greeting") then
if getPlayerStorageValue(cid, storage) == -1 then
selfSay("Talk 'yes' to continue", cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid, storage) == 1 then
selfSay("Talk 'yes' to continue", cid)
talkState[talkUser] = 1
else
selfSay("You already have my permission. Proceed with your mission", cid)
end
elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, storage) == -1 then
selfSay("", cid)
setPlayerStorageValue(cid, storage, 1)
else
if(doPlayerRemoveItem(cid, 2148, 1)) then
selfSay("Ready! You have my permission.", cid)
setPlayerStorageValue(cid, 55101, 1)
setPlayerStorageValue(cid, storage, 2)
else
selfSay("You do not have 1 Gold Coin to buy my permission .", cid)
end
end
talkState[talkUser] = 0
elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
selfSay("Ok then.", cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
How do you already have to have a storage to talk to this NPC ?
and..
How can I make it delivered to storage without giving anything in return ?