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

script

Rossii

Member
Joined
Mar 27, 2012
Messages
366
Reaction score
6
Location
England
Yo i want a script


PHP:
2 Npc's first named Joy

Player: Hi
Joy: Hello, [PALAYER NAME] Looking for an adventure?
Player: yes
Joy: Go south from me and search Serby the key word is "Gueden"
Player: bye
Joy: bye bye
--------------------------------------------------------------------
now second npc "serby" should be some rules
1. if you havent spoken to joy you cant speak to serby
2. servy wont say anything if you say hi


Player: Gueden
Serby: So you have talk to Joy, hes my old friend would you like to do the mission?
Player: yes/no
IF NO THEN SAY FUCK OFF
Serby: do you want to go there too?
Player: yes/no
IF NO THEN SAY FUCK OFF
IF yes then
Serby: you need prove that you worth it, i have a task for you. Do you want do it?
IF no then
Serby: I tought you had potential...
Player: yes    (to that task thing)
Serby: bring 500000 gold coins, i know its alot but i need fix up some stuff to help you.
Player: bye
Serby: bye
*player have now 500000 gold coin in crystal coins*
Player: hi
Serby: did you bring me 500000 gold coins?
Player: yes
Serby: Thank you alot, now we  can start do you wanna continue?
Player: Yes/No
IF yes then
Serby: i need you bring from joy a key, say to him "the new city"
IF No then
Serby: bye then
--------------------------------------
*now to joy*
Player: hi
Joy: so you met Serby did you have fun?
Player: yes
Joy: okey what did he say to you?
Player: The new city
Joy: oh its time...
Joy: i have the key some where, let me search.
Joy: Oh here take it
---------------------------
back to Serby

player: hi
Serby: do you have the key?
player: yes
serby: ahh now you may enter into the Forgotten island use the key to enter through the door



REPP++++++++

- - - Updated - - -

Like i will 10 reps for this script please!
 
okay, first of all, credits to cykotroll for this blind orc and summ for the story npc

In npc/lib/npc.lua add:
LUA:
function npcDelayedTalk(cid, text, player)
	if isNpc(cid) and isPlayer(player) then
		doCreatureSay(cid, text, TALKTYPE_PRIVATE_NP, false, player, getThingPos(cid))
	end
end
 
function selfStory(msg, player, delay)
	local interval, npc = delay or 5000, getNpcCid()
	local ret = {}
 
	for i, message in pairs(msg) do
		if i == 1 then
			doCreatureSay(npc, message, TALKTYPE_PRIVATE_NP, false, player, getThingPos(npc))
		else
			local r = addEvent(npcDelayedTalk, (i-1)*interval, npc, message, player)
			table.insert(ret, r)
		end
	end
	return ret
end

>joy.lua
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

local c = {
	storage = 1234,
	key = 2087,			-- wooden key
	action = true,		-- key with action id? true or false
	actionid = 1234		-- if action = true, actionid = id
}

local story = {}
 
local function cancelStory(cid)
	if not(story[cid]) then return true end
	for _, eventId in pairs(story[cid]) do
		stopEvent(eventId)
	end
	story[cid] = {}
end
 
function creatureFarewell(cid)
	if not(isPlayer(cid)) then return true end
	cancelStory(cid)
	selfSay('Good bye then.', cid)
	return true
end
 


function greetCallback(cid)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	if getPlayerStorageValue(cid, c.storage) == -1 then
		npcHandler:setMessage(MESSAGE_GREET, "Hello " .. getPlayerName(cid) .. ", looking for an adventure?")
		talkState[talkUser] = 1
	elseif getPlayerStorageValue(cid, c.storage) == 1 then
		npcHandler:setMessage(MESSAGE_GREET, "Go south from me and search {Serby} the key word is {Gueden}")
		npcHandler:releaseFocus(cid)
	elseif getPlayerStorageValue(cid, c.storage) == 2 then
		npcHandler:setMessage(MESSAGE_GREET, 'So you met {Serby}, did you have fun?')
		talkState[talkUser] = 2
	elseif getPlayerStorageValue(cid, c.storage) == 3 then
		npcHandler:setMessage(MESSAGE_GREET, 'You already have the key!')
		npcHandler:releaseFocus(cid)
	elseif getPlayerStorageValue(cid, c.storage) == 4 then 
		npcHandler:setMessage(MESSAGE_GREET, "You already have done this mission.")
		npcHandler:releaseFocus(cid)
	end
	return true
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
 
	if msgcontains(msg, 'yes') then
		if talkState[talkUser] == 1 then
			selfSay('Go south from me and search {Serby} the key word is {Gueden}', cid)
			setPlayerStorageValue(cid, c.storage, 1)
			talkState[talkUser] = 0
		elseif talkState[talkUser] == 2 then
			selfSay('Okey, what did he say to you?', cid)
			talkState[talkUser] = 3
		end
	elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
		selfSay('Fuck off.', cid)
		talkState[talkUser] = 0
		npcHandler:releaseFocus(cid)
	elseif msgcontains(msg, "serby") then
		npcHandler:say("My old friend {Serby}, so you met him?", cid, TRUE)
		talkState[talkUser] = 2
	elseif msgcontains(msg, "the new city") then
		if talkState[talkUser] == 3 then
			setPlayerStorageValue(cid, c.storage, 3)
			cancelStory(cid)
			story[cid] = selfStory({"Oh its time...", "I have the key some where, let me search!", "Oh here take it."}, cid, 6000)
			local key = doPlayerAddItem(cid, c.key, 1)
			if c.action then setItemAttribute(key, "actionid", c.actionid) end
			npcHandler:releaseFocus(cid)
			talkState[talkUser] = 0
			return true
		else
			npcHandler:say("That is confidential information, talk with {Serby} about that.", cid, TRUE)
			npcHandler:releaseFocus(cid)
			talkState[talkUser] = 0
		end
	end
	return true
end

npcHandler:setCallback(CALLBACK_FAREWELL, creatureFarewell)
npcHandler:setCallback(CALLBACK_CREATURE_DISAPPEAR, creatureFarewell)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye then.")
npcHandler:addModule(FocusModule:new())

>serby.lua
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

local c = {
	storage = 1234,
	money = 500000
}

function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	if msgcontains(msg, "guaren") and (not npcHandler:isFocused(cid)) then
		if getPlayerStorageValue(cid, c.storage) == 1 then
			npcHandler:say("So you have talk to Joy, hes my old friend would you like to do the {mission}?", cid, TRUE)
			npcHandler:addFocus(cid)
			talkState[talkUser] = 1
		elseif getPlayerStorageValue(cid, c.storage) == 2 then
			npcHandler:say("You again, now we can continue?", cid, TRUE)
			npcHandler:addFocus(cid)
			talkState[talkUser] = 5
		elseif getPlayerStorageValue(cid, c.storage) == 4 then 
			npcHandler:say("You already have done this mission.", cid, TRUE)
			npcHandler:releaseFocus(cid)
		end
	elseif msgcontains(msg, "hi") and (not npcHandler:isFocused(cid)) then
		if getPlayerStorageValue(cid, c.storage) == 3 then
			npcHandler:say("Do you have the key?", cid, TRUE)
			npcHandler:addFocus(cid)
			talkState[talkUser] = 6
		elseif getPlayerStorageValue(cid, c.storage) == 4 then
			npcHandler:say("You already have done this mission.", cid, TRUE)
			npcHandler:releaseFocus(cid)
		end
	elseif (not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "yes") then
		if talkState[talkUser] == 1 then
			npcHandler:say("Do you want to go there too?", cid, TRUE)
			talkState[talkUser] = 2
		elseif talkState[talkUser] == 2 then
			npcHandler:say("You need prove that you worth it, I have a task for you. Do you want do it?", cid, TRUE)
			talkState[talkUser] = 3
		elseif talkState[talkUser] == 3 then
			npcHandler:say("Bring "..c.money.." gold coins, I know it is a lot but I need fix up some stuff to help you. You have that money?", cid, TRUE)
			talkState[talkUser] = 4
		elseif talkState[talkUser] == 4 then
			if doPlayerRemoveMoney(cid, c.money) then
				npcHandler:say("Thank you a lot, now we can start, do you wanna continue?", cid, TRUE)
				setPlayerStorageValue(cid, c.storage, 2)
				talkState[talkUser] = 5
			else
				npcHandler:say("I hate liers.", cid, TRUE)
				npcHandler:releaseFocus(cid)
				talkState[talkUser] = 0
			end
		elseif talkState[talkUser] == 5 and getPlayerStorageValue(cid, c.storage) == 2 then
			npcHandler:say("I need you bring from {Joy} a key, say to him {The New City}", cid, TRUE)
			npcHandler:releaseFocus(cid)
			talkState[talkUser] = 0
		elseif talkState[talkUser] == 6 and getPlayerStorageValue(cid, c.storage) == 3 then
			npcHandler:say("Ahh now you may enter into the {Forgotten Island}, use the key to enter through the door.", cid, TRUE)
			setPlayerStorageValue(cid, c.storage, 4)
			--npcHandler:releaseFocus(cid)
		end
	elseif msgcontains(msg, "no") and talkState[talkUser] ~= 0 then
		if (talkState[talkUser] == 1 or talkState[talkUser] == 2 or talkState[talkUser] == 4 or talkState[talkUser] == 5) then
			npcHandler:say("Fuck off.", cid, TRUE)
			talkState[talkUser] = 0
		elseif talkState[talkUser] == 3 then
			npcHandler:say("I tought you had potential...", cid, TRUE)
			talkState[talkUser] = 0
		elseif talkState[talkUser] == 4 then
			npcHandler:say("Bye then.", cid, TRUE)
			talkState[talkUser] = 0
		end
		npcHandler:releaseFocus(cid)
	elseif msgcontains(msg, "joy") then
		if talkState[talkUser] == 0 then
			npcHandler:say("My old friend {Joy}, so you met him?", cid, TRUE)
			talkState[talkUser] = 1
		elseif talkState[talkUser] == 5 then
			npcHandler:say("I need you bring from {Joy} a key, say to him {The New City}", cid, TRUE)
		end
	elseif msgcontains(msg, "the new city") then
		npcHandler:say("That is confidential information, talk with {Joy} about that.", cid, TRUE)
		npcHandler:releaseFocus(cid)
	end
	return true
end

npcHandler:setCallback(CALLBACK_FAREWELL, creatureFarewell)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye then.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

should works
 
Last edited:
Back
Top