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

Lua npc only talks to you if your lvl is 100 or higher

skenchu

New Member
Joined
Mar 14, 2009
Messages
218
Reaction score
0
Location
Holland, Rotterdam
like my title said i need a npc or a part of a script for a npc he will look first for your lvl and then he will answer

i need it for a 7.6 distro

i hope someone can help my

thxn i give rep+
 
i also need this i was working on a npc that talks to you for a while tells you a story while you answer and ask key words during the story but you have to be level 100 or he doesn't talk to you and i want him to say come back when you are worthy if you arnt high even level.


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

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
    -- 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.
    if(npcHandler.focus ~= cid) then
        return false
    end

if  msgcontains(msg, 'hi') or msgcontains(msg, 'quest') then
            selfSay('Do you know about the ruthless seven?')
            talk_state = 1
        

        elseif msgcontains(msg, 'yes') and talk_state == 1 then
            if getPlayerLevel(cid) >= 100 then and getPlayerItemCount(cid,2160) >= 1 then
                if doPlayerTakeItem(cid,2160,1) == 0 then
                selfSay('Now we are in buisness. Ask me about the ruthless seven')
                 
                end
            elseif  msgcontains(msg, 'ruthless seven') or msgcontains(msg, 'mission') then
                selfSay('i want this to be a whole story with more questions etc.')
            end
            elseif  msgcontains(msg, 'ruthless seven') or msgcontains(msg, 'mission') then
                selfSay('i want this to be a whole story with more questions etc.')
            end
            elseif  msgcontains(msg, 'ruthless seven') or msgcontains(msg, 'mission') then
                selfSay('i want this to be a whole story with more questions etc.')
            end
            elseif  msgcontains(msg, 'ruthless seven') or msgcontains(msg, 'mission') then
                selfSay('i want this to be a whole story with more questions etc.')
            end
            elseif  msgcontains(msg, 'ruthless seven') or msgcontains(msg, 'mission') then
                selfSay('i want this to be a whole story with more questions etc.')
            end
          

        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
            selfSay('STOP WASTING MY TIME!')
            talk_state = 0
        end

    -- 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())
 
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local t

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 greet(cid)
	t = nil
	return true
end
npcHandler:setCallback(CALLBACK_GREET, greet)

function creatureSayCallback(cid, type, msg)
	if npcHandler.focus ~= cid then
		return false
	elseif t == nil and msgcontains(msg, 'quest') then
		selfSay('Do you know about the ruthless seven?')
		t = 1
	elseif t == 1 then
		if msgcontains(msg, 'yes') then
			if getPlayerLevel(cid) < 100 then
				selfSay('Come back when you are worthy.')
				npcHandler:releaseFocus(cid)
			elseif doPlayerRemoveMoney(cid, 10000) == FALSE then
				selfSay('<no money message>')
				npcHandler:releaseFocus(cid)
			else
				selfSay('Now we are in buisness. Ask me about the ruthless seven.')
				t = 2
			end
		else
			selfSay('STOP WASTING MY TIME!')
			npcHandler:releaseFocus(cid)
		end
	elseif t == 2 then
		if msgcontains(msg, 'ruthless seven') or msgcontains(msg, 'mission') then
			selfSay('i want this to be a whole story with more questions etc.')
		elseif msgcontains(msg, 'ruthless seven') or msgcontains(msg, 'mission') then
			selfSay('i want this to be a whole story with more questions etc.')
		end
	end
	return true
end

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