Ir para conteúdo

Featured Replies

Resolvido por Pedro.

Ir para solução
Postado
  • Solução
Data > npc > script > lib > npcsystem> modules.lua
 
 
troca a função "function StdModule.travel" por está aqui

function StdModule.travel(cid, message, keywords, parameters, node)
		local npcHandler = parameters.npcHandler
		if(npcHandler == nil) then
			error('StdModule.travel called without any npcHandler instance.')
		end
		if(cid ~= npcHandler.focus) then
			return false
		end
		
		if(isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == true or parameters.premium == false) then
			if(parameters.level ~= nil and getPlayerLevel(cid) < parameters.level) then
				npcHandler:say('You must reach level ' .. parameters.level .. ' before I can let you go there.')
			elseif(doPlayerRemoveMoney(cid, parameters.cost) ~= TRUE) then
				npcHandler:say('You do not have enough money!')
			elseif (parameters.vip ~= nil and vip.hasVip(cid) == FALSE) then
				npcHandler:say('I can only allow vip players to travel with me!')
                        
			else
				doTeleportThing(cid, parameters.destination)
				doSendMagicEffect(parameters.destination, 10)
			end
		else
			npcHandler:say('I can only allow premium players to travel with me.')
		end
		
		npcHandler:resetNpc()
		return true
	end

 
npc/script


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
 
        -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
 
        local travelNode = keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to cityvip?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, vip = true, level = 0, cost = 200, destination = {x=xxxxx, y=xxxxx, z=x} }) 
            travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
 
        local travelNode = keywordHandler:addKeyword({'cityvip'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to cityvip?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, vip = true, level = 0, cost = 200, destination = {x=xxxxx, y=xxxxx, z=x} }) 
            travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
 
 
        keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
        keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to cityvip.'})
        -- Makes sure the npc reacts when you say hi, bye etc.
        npcHandler:addModule(FocusModule:new())

 

agora você pode usar o parâmetro vip = true, assim como premium = true
 
ex:
 
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, vip = true, level = 0, cost = 200, destination = {x=xxxxx, y=xxxxx, z=x} }) 
 
 

Editado por pedrook (veja o histórico de edições)

Postado
  • Autor

 

Data > npc > script > lib > npcsystem> modules.lua
 
 
troca a função "function StdModule.travel" por está aqui

function StdModule.travel(cid, message, keywords, parameters, node)
		local npcHandler = parameters.npcHandler
		if(npcHandler == nil) then
			error('StdModule.travel called without any npcHandler instance.')
		end
		if(cid ~= npcHandler.focus) then
			return false
		end
		
		if(isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == true or parameters.premium == false) then
			if(parameters.level ~= nil and getPlayerLevel(cid) < parameters.level) then
				npcHandler:say('You must reach level ' .. parameters.level .. ' before I can let you go there.')
			elseif(doPlayerRemoveMoney(cid, parameters.cost) ~= TRUE) then
				npcHandler:say('You do not have enough money!')
			elseif (parameters.vip ~= nil and vip.hasVip(cid) == FALSE) then
				npcHandler:say('I can only allow vip players to travel with me!')
                        
			else
				doTeleportThing(cid, parameters.destination)
				doSendMagicEffect(parameters.destination, 10)
			end
		else
			npcHandler:say('I can only allow premium players to travel with me.')
		end
		
		npcHandler:resetNpc()
		return true
	end

 
npc/script


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
 
        -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
 
        local travelNode = keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to cityvip?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, vip = true, level = 0, cost = 200, destination = {x=xxxxx, y=xxxxx, z=x} }) 
            travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
 
        local travelNode = keywordHandler:addKeyword({'cityvip'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to cityvip?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, vip = true, level = 0, cost = 200, destination = {x=xxxxx, y=xxxxx, z=x} }) 
            travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
 
 
        keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
        keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to cityvip.'})
        -- Makes sure the npc reacts when you say hi, bye etc.
        npcHandler:addModule(FocusModule:new())

 

agora você pode usar o parâmetro vip = true, assim como premium = true
 
ex:
 
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, vip = true, level = 0, cost = 200, destination = {x=xxxxx, y=xxxxx, z=x} }) 
 
 

 

 

 

Obrigado. REP +

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo