VA
script

npc que recusa o promotion se o player for...

Por valakas, 28 de dez. de 2015 em Scripts

resolvido
4
890
valakasV
28 de dezembro de 2015 às 17:18

entao gente é assim se o jogador estiver com a vocação 9,10,11 e 12 o npc recuse a dar o promotion

 

 

segue abaixo a script do meu npc

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 node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
	node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 0,level = 1, promotion = 1, text = 'Congratulations! You are now promoted.'})
	node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})



npcHandler:addModule(FocusModule:new())

zipter98Z
28 de dezembro de 2015 às 18:33
Melhor resposta
Troque:

node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 0, level = 1, promotion = 1, text = 'Congratulations! You are now promoted.'})

por:

node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, recuse = {9, 10, 11, 12}, cost = 0, level = 1, promotion = 1, text = 'Congratulations! You are now promoted.'})


Depois, em data/npc/lib/npcsystem/modules.lua, no código da função

function StdModule.promotePlayer(cid, message, keywords, parameters, node)

Abaixo de:


elseif(not doPlayerRemoveMoney(cid, parameters.cost)) then
npcHandler:say('You do not have enough money!', cid)

coloque:


elseif parameters.recuse and isInArray(parameters.recuse, getPlayerVocation(cid)) then
npcHandler:say("You can't change your vocation at the moment!", cid)

valakasV
28 de dezembro de 2015 às 20:29

 

Troque:
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 0, level = 1, promotion = 1, text = 'Congratulations! You are now promoted.'})
por:
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, recuse = {9, 10, 11, 12}, cost = 0, level = 1, promotion = 1, text = 'Congratulations! You are now promoted.'})
Depois, em data/npc/lib/npcsystem/modules.lua, no código da função
function StdModule.promotePlayer(cid, message, keywords, parameters, node)
Abaixo de:
elseif(not doPlayerRemoveMoney(cid, parameters.cost)) then
    npcHandler:say('You do not have enough money!', cid)
coloque:
elseif parameters.recuse and isInArray(parameters.recuse, getPlayerVocation(cid)) then
    npcHandler:say("You can't change your vocation at the moment!", cid)

 

zipter é o cara nunca descensona nas script vao tudo 100% funcional, até o momento, a proposito voce poderia me conseguir uma script de n se atacarem em party? grato, http://www.xtibia.com/forum/topic/238459-sem-danos-na-mesma-party/

Editado Dezembro 28 por valakas

1 mês depois...
DanihcvD
08 de janeiro de 2016 às 14:37

Tópico movido para dúvidas / pedidos resolvidos.