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

Small npc quest need help.

TriamerA

The Mystic One.
Joined
Nov 16, 2008
Messages
1,257
Reaction score
18
Location
Poland
So I want to make 2 npcs connected with themselfs.

First one should be like
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandlerCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlerCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlerCreatureSay(cid, type, msg) end
function onThink() npcHandlerThink() end

function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'help') then
selfSay('Do you want to help me??.')
if msgcontains(msg, 'yes') then
selfSay('You will have to tell my brother that I am still alive, he is selling jelewery in Thais.')
setPlayerStorageValue(cid, 171717)
else 
selfSay('Then do not waste my time!!')

return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

And the second one should be like

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandlerCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlerCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlerCreatureSay(cid, type, msg) end
function onThink() npcHandlerThink() end

function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'John is alive') then
elseif getPlayerStorageValue(cid, valueid) == 171717 then
selfSay('Oh thank you, I though he was dead!! So what would you like to get as a reward?? Hmm I can take you to the terrain of the Hell. If you want ask me for.')
setPlayerStorageValue(cid, 171718)
else
selfSay('How could you know that??!!')
if msgcontains(msg, 'Hell')
elseif getPlayerStorageValue(cid, valueid)
 == 171718 then
doTeleportThing(cid, newpos[, pushmove]) // how to teleport a player somewhere then?

return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Rep++ for help, and I think that those scripts could be a thing which some people were looking for.
 
I've edited id but i still dont know how to teleport player

Fist one:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandlerCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlerCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlerCreatureSay(cid, type, msg) end
function onThink() npcHandlerThink() end

function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'John is alive') then
queststatus == getPlayerStorageValue(cid,171717)
if queststatus == 1 then
selfSay('Oh thank you, I though he was dead!! So what would you like to get as a reward?? Hmm I can take you to the terrain of the Hell. If you want ask me for.')
setPlayerStorageValue(cid, 171718,1)
else
selfSay('How could you know that??!!')
if msgcontains(msg, 'Hell') then
queststatuss  == getPlayerStorageValue(cid, 171718)
if queststatuss == 1 then
doTeleportThing(cid, newpos[, pushmove]) // how to teleport a player somewhere then?




-- 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())



Second one
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandlerCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlerCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlerCreatureSay(cid, type, msg) end
function onThink() npcHandlerThink() end

function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'help') then
selfSay('Do you want to help me??.')
if msgcontains(msg, 'yes') then
selfSay('You will have to tell my brother that I am still alive, he is selling jelewery in Thais.')
setPlayerStorageValue(cid, 171717,1)
else 
selfSay('Then do not waste my time!!')




-- 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())
 
Back
Top