• 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 QUEST - Who can make it for me?

lajrek34a

New Member
Joined
Sep 15, 2009
Messages
117
Reaction score
0
Player: Hi
Rokyn: Hello |Playername|!
Player: mission
Rokyn: I can give you acess to enter in my Training Room if you give me 100 demonic essence.
Player: Yes

If player don't have essence (Sorry...but you dont have item. Come back have them)
If player have demonic essence Thank you! now you have acess to enter in my Training Room.
if player done mission text You already done this mission.

Change this script only for 1 StorageValue and 1 mission

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() 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, 'mission') then
if getPlayerStorageValue(cid, 30045) == -1 then
npcHandler:say('I lost my baby seal dool in my home, can you help me the found dool?', cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid, 30046) == 1 then
npcHandler:say('Own. you have a baby seal from me?', cid)
talkState[talkUser] = 2
elseif getPlayerStorageValue(cid, 30046) == 2 then
npcHandler:say('Sorry...but you already have complete my service. Good Bye', cid)
talkState[talkUser] = 3
end

elseif talkState[talkUser] == 1 then
if msgcontains(msg, 'yes') then
npcHandler:say('Great. you have acess to enter in my home, report your mission afterwards..', cid)
setPlayerStorageValue(cid,30045,1)
local chave = doCreateItemEx(2092, 1)
doSetItemActionId(chave, 4849)
doPlayerAddItemEx(cid, chave, 1)
talkState[talkUser] = 2
else
selfSay('You already have the service. Come back have them...', cid)
end

elseif talkState[talkUser] == 2 then
if msgcontains(msg, 'yes') then
npcHandler:say('Thank you! now you have acess to enter in my Training Room.', cid)
if doPlayerRemoveItem(cid,7183,1) == TRUE then
setPlayerStorageValue(cid,30046,2)
setPlayerStorageValue(cid,60034,1)
talkState[talkUser] = 3
else
npcHandler:say('Sorry...but you dont have item. Come back have them', cid)
end
end
end
return true
end

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

Thanks!!
 
use [ lua] an [/ 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

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, 'mission') then
		if getPlayerStorageValue(cid, 30045) < 0 then
			npcHandler:say('I can give you acess to enter in my Training Room if you give me 100 demonic essence. Do you have it?', cid)
			talkState[talkUser] = 1
		elseif getPlayerStorageValue(cid, 30045) == 1 then
			npcHandler:say('You already done this mission.', cid)
		end

	elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
		if doPlayerRemoveItem(cid,6500,100)then
			setPlayerStorageValue(cid,30045),1)
			npcHandler:say('Thank you! now you have acess to enter in my Training Room.', cid)
		else
			npcHandler:say('Sorry...but you dont have item. Come back have them.', cid)
		end
	end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Bug in Console but i don't know where [14/10/2009 21:25:11] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/trainer_quest.lua
[14/10/2009 21:25:11] data/npc/scripts/trainer_quest.lua:27: unexpected symbol near ','
 
then read bugs -_-...

line 27 :eek: xD

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
        if msgcontains(msg, 'mission') then
                if getPlayerStorageValue(cid, 30045) < 0 then
                        npcHandler:say('I can give you acess to enter in my Training Room if you give me 100 demonic essence. Do you have it?', cid)
                        talkState[talkUser] = 1
                elseif getPlayerStorageValue(cid, 30045) == 1 then
                        npcHandler:say('You already done this mission.', cid)
                end

        elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
                if doPlayerRemoveItem(cid,6500,100)then
                        setPlayerStorageValue(cid,30045,1)
                        npcHandler:say('Thank you! now you have acess to enter in my Training Room.', cid)
                else
                        npcHandler:say('Sorry...but you dont have item. Come back have them.', cid)
                end
        end
return true
end

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