• 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 of Missions

roii12

New Member
Joined
Mar 28, 2013
Messages
38
Reaction score
0
Location
Santiago de Chile
1)I want to make a story of mission several NPC.
you have to go by talking with NPCs, unable to jump one
and to move to another npc you have to finish the previous mission.

2)similar to the above, but they are npc's a repeat, Missions giving diferenets than before

plzz!
 
Matye this is too hard, because we need to learn your history and know your map, you should better learn some of lua and made it by yourself, is better than anything
 
then as I add, that to talk to the npc need a storage?

Well... thats possible i will make it, just give me 10 minutes

- - - Updated - - -

Okay, here it is, first the npc.lua when you say hi if you have the correct storage he will pay you attention, if not, it qwill say that he is busy

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


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 = xxxx --The storage that you need in 1 to get the npc attention
local greetings = "Hello |PLAYERNAME|, how are you?" --Greetings message
local busy = "Sorry |PLAYERNAME|, i'm busy right now" --Busy message

function ignore(cid, message, keywords, parameters, node)
	if(cid ~= npcHandler.focus) then
		return false
	end
	
	if getPlayerStorageValue(cid, storage) == 1 then
		npcHandler:say(greetings, cid)
		else
		npcHandler:say(busy, cid)
		npcHandler:resetNpc()
	end
return true
end	

local node1 = keywordHandler:addKeyword({'hi'}, ignore)
local node2 = keywordHandler:addKeyword({'hello'}, ignore)

npcHandler:addModule(FocusModule:new())

and the npc.xml

Code:
<?xml version="1.0"?>
<npc name="NPC" script="npc.lua" access="3">
 	<look type="149" head="0" body="96" legs="114" feet="114"/>
</npc>

I'm honest with you, i think that won't work, test it please and tell me the errors
 
and that would be another function?? inside the same function?

Yes mate, but that script wont work, i can make you this, a npc that when you say hi he will say something like "Hello", and when you say mission if you have the storage value it will give you a mission, if not he will say that he wont give you anything, you want something like that?

- - - Updated - - -

and that would be another function?? inside the same function?

Yes mate, but that script wont work, i can make you this, a npc that when you say hi he will say something like "Hello", and when you say mission if you have the storage value it will give you a mission, if not he will say that he wont give you anything, you want something like that?
 
if I have a Missions npc or anything else, as I can get this script to need a storage to speak

Well im sorry, i dont know how to do that, and i dont got time to figure it, what i can offer to you is a npc that give you a mission if you already have an specific storage value, you should take my offer or wait someone else to respond
 
Yes i can, but give me 20 minutes from now, i'm a little busy

- - - Updated - - -

Okay mate, here it is the npc.lua

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


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 = xxxx --Storage to be needed
local busy = "Sorry, im busy right now" --No quest message
local mission = "Oh yes i need help in a mission, you can help me?" --Message dysplayed when you got the right storage
local mission2 = "Fine, search my map!" --Message displayed when you say yes to accept the mission
local never = "No?, oh cmon" --Message displayed when you say no to denied the mission
--Comment, try to watch closely, down at nodes there are the text and you can edit it to the npc respond
local storageset = xxxx --Storage id to be put on 1 when you accept the mission
npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|.') --Greeting message

function storage(cid, message, keywords, parameters, node)
	if(cid ~= npcHandler.focus) then
		return false
	end
	if getPlayerStorageValue(cid, storage) == 1 then
	npcHandler:say(mission, cid)
	else
	npcHandler:say(busy, cid)
	npcHandler:resetNpc()
	end
	return true
end

function storage1(cid, message, keywords, parameters, node)
	if(cid ~= npcHandler.focus) then
		return false
	end
	npcHandler:say(mission2, cid)
	npcHandler:resetNpc()
	return true
end

local node1 = keywordHandler:addKeyword({'raiden'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Raiden is the best scripter :D'})
local node2 = keywordHandler:addKeyword({'mission'}, storage)
local node3 = node3:addChildKeyword({'yes'}, storage1)
local node3 = node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = never})

npcHandler:addModule(FocusModule:new())

And the xml do the same as i gave to you, it should works now how i say, test it
 
[22/05/2013 22:51:33] [Error - Npc interface]
[22/05/2013 22:51:33] data/npc/scripts/mission.lua
[22/05/2013 22:51:33] Description:
[22/05/2013 22:51:33] data/npc/scripts/mission.lua:45: attempt to index global 'node3' (a nil value)
[22/05/2013 22:51:33] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/mission.lua

:(
 
Lol, my misstake, was a simple number, use this

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
 
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 = xxxx --Storage to be needed
local busy = "Sorry, im busy right now" --No quest message
local mission = "Oh yes i need help in a mission, you can help me?" --Message dysplayed when you got the right storage
local mission2 = "Fine, search my map!" --Message displayed when you say yes to accept the mission
local never = "No?, oh cmon" --Message displayed when you say no to denied the mission
--Comment, try to watch closely, down at nodes there are the text and you can edit it to the npc respond
local storageset = xxxx --Storage id to be put on 1 when you accept the mission
npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|.') --Greeting message
 
function storage(cid, message, keywords, parameters, node)
	if(cid ~= npcHandler.focus) then
		return false
	end
	if getPlayerStorageValue(cid, storage) == 1 then
	npcHandler:say(mission, cid)
	else
	npcHandler:say(busy, cid)
	npcHandler:resetNpc()
	end
	return true
end
 
function storage1(cid, message, keywords, parameters, node)
	if(cid ~= npcHandler.focus) then
		return false
	end
	npcHandler:say(mission2, cid)
	npcHandler:resetNpc()
	return true
end
 
local node1 = keywordHandler:addKeyword({'raiden'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Raiden is the best scripter :D'})
local node2 = keywordHandler:addKeyword({'mission'}, storage)
local node3 = node2:addChildKeyword({'yes'}, storage1)
local node3 = node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = never})
 
npcHandler:addModule(FocusModule:new())
 
23:23 NPC: Hello Harry.
23:23 GOD [984]: mission
23:23 GOD [984]: mission1
23:23 GOD [984]: raiden
23:23 NPC: Raiden is the best scripter :D
23:23 GOD [984]: mission
23:23 GOD [984]: mission
23:23 GOD [984]: yes

What is the mission??
 
Thats not normal, try with this

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
 
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 = xxxx --Storage to be needed
local busy = 'Sorry, im busy right now' --No quest message
local mission1 = 'Oh yes i need help in a mission, you can help me?' --Message dysplayed when you got the right storage
local mission2 = 'Fine, search my map!' --Message displayed when you say yes to accept the mission
local never = 'No?, oh cmon' --Message displayed when you say no to denied the mission
--Comment, try to watch closely, down at nodes there are the text and you can edit it to the npc respond
local storageset = xxxx --Storage id to be put on 1 when you accept the mission
npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|.') --Greeting message
 
function storage(cid, message, keywords, parameters, node)
	if(cid ~= npcHandler.focus) then
		return false
	end
	if getPlayerStorageValue(cid, storage) == 1 then
	npcHandler:say(mission1, cid)
	else
	npcHandler:say(busy, cid)
	npcHandler:resetNpc()
	end
	return true
end
 
function storage1(cid, message, keywords, parameters, node)
	if(cid ~= npcHandler.focus) then
		return false
	end
	npcHandler:say(mission2, cid)
	npcHandler:resetNpc()
	return true
end
 
local node1 = keywordHandler:addKeyword({'raiden'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Raiden is the best scripter :D'})
local node2 = keywordHandler:addKeyword({'mission'}, storage)
local node3 = node2:addChildKeyword({'yes'}, storage1)
local node3 = node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = never})
 
npcHandler:addModule(FocusModule:new())
 
No error showed on console?, try with this but is strange

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
 
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 = xxxx --Storage to be needed
local busy = "Sorry, im busy right now" --No quest message
local mission1 = "Oh yes i need help in a mission, you can help me?" --Message dysplayed when you got the right storage
local mission2 = "Fine, search my map!" --Message displayed when you say yes to accept the mission
--Comment, try to watch closely, down at nodes there are the text and you can edit it to the npc respond
local storageset = xxxx --Storage id to be put on 1 when you accept the mission
npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|.") --Greeting message
 
function storage(cid, message, keywords, parameters, node)
	if(cid ~= npcHandler.focus) then
		return false
	end
	if getPlayerStorageValue(cid, storage) == 1 then
	npcHandler:say(mission1, cid)
	else
	npcHandler:say(busy, cid)
	npcHandler:resetNpc()
	end
	return true
end
 
function storage1(cid, message, keywords, parameters, node)
	if(cid ~= npcHandler.focus) then
		return false
	end
	npcHandler:say(mission2, cid)
        doSetPlayerStorageValue(cid, storageset, 1)
	npcHandler:resetNpc()
	return true
end
 
local node1 = keywordHandler:addKeyword({'raiden'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Raiden is the best scripter :D'})
local node2 = keywordHandler:addKeyword({'mission'}, storage)
local node3 = node2:addChildKeyword({'yes'}, storage1)
local node3 = node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'No?, cmon mate'})
 
npcHandler:addModule(FocusModule:new())

- - - Updated - - -

Well... i have tested it, and it works for me, using 0.3.6
 
Back
Top