Ir para conteúdo

Modificar script


Boguemon

Posts Recomendados

Queria saber se alguém consegue fazer com que esse script funcione da seguinte maneira, somente vocations 1 podem falar com ele os outros recebem uma mensagem dizendo que não é ali o lugar deles, e que tbm só pode escolher uma das 3 promotions, se já escolheu ja era, não pode mudar...

 

local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)function onCreatureAppear(cid)            npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid)        npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg)        npcHandler:onCreatureSay(cid, type, msg) endfunction onThink()                npcHandler:onThink() endlocal 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 = 20000, level = 20, 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})local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})    node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})local node3 = keywordHandler:addKeyword({'master'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can masterize you for 2000000 gold coins. Do you want me to masterize you?'})    node3:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 2000000, level = 220, promotion = 3, text = 'Congratulations! You are now masterized.'})    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})npcHandler:addModule(FocusModule:new())

 

Link para o comentário
Compartilhar em outros sites

Boa noite,

 

Teste assim:

local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)function onCreatureAppear(cid)            npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid)        npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg)        npcHandler:onCreatureSay(cid, type, msg) endfunction onThink()                npcHandler:onThink() endlocal ctrl_sto = 12345 -- Storage de Controlelocal minLvl = 20 -- Level Mínimo para Promotelocal promCost = 20000 -- Custo em GPsfunction justVoc(cid, message, keywords, parameters, node)    if(not npcHandler:isFocused(cid)) then        return false    end    if getPlayerVocation(cid) == 2 then -- Vocação Permitida para Promote        if getPlayerStorageValue(cid, ctrl_sto) == -1 then			if getPlayerLevel(cid) >= minLvl then				if getPlayerMoney(cid) >= promCost then					setPlayerPromotionLevel(cid, parameters.value)					setPlayerStorageValue(cid, ctrl_sto, 1)					npcHandler:say('Deu tudo certo.')				else					selfSay('Você precisar de '..promCost..' gold coins para ser promovido.')				end			else				selfSay('Você precisar ser level '..minLvl..' ou mais para ser promovido.')			end		else			selfSay('Você já definiu sua promoção anteriormente.')		end	else		selfSay('Somente players da vocação 2 podem usar.')    endendlocal 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'}, justVoc, {value = 1}) -- valor numérico da promote    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})	node2:addChildKeyword({'yes'}, justVoc, {value = 2}) -- valor numérico da promote    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})local node3 = keywordHandler:addKeyword({'master'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can masterize you for 2000000 gold coins. Do you want me to masterize you?'})	node3:addChildKeyword({'yes'}, justVoc, {value = 3}) -- valor numérico da promote    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})npcHandler:addModule(FocusModule:new())

 

Boa sorte bro.

Link para o comentário
Compartilhar em outros sites

Agora, gonorreiaswat disse:

Boa noite,

 

Teste assim:

local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)function onCreatureAppear(cid)            npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid)        npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg)        npcHandler:onCreatureSay(cid, type, msg) endfunction onThink()                npcHandler:onThink() endlocal ctrl_sto = 12345 -- Storage de Controlelocal minLvl = 20 -- Level Mínimo para Promotelocal promCost = 20000 -- Custo em GPsfunction justVoc(cid, message, keywords, parameters, node)    if(not npcHandler:isFocused(cid)) then        return false    end    if getPlayerVocation(cid) == 2 then -- Vocação Permitida para Promote        if getPlayerStorageValue(cid, ctrl_sto) == -1 then			if getPlayerLevel(cid) >= minLvl then				if getPlayerMoney(cid) >= promCost then					setPlayerPromotionLevel(cid, parameters.value)					setPlayerStorageValue(cid, ctrl_sto, 1)					npcHandler:say('Deu tudo certo.')				else					selfSay('Você precisar de '..promCost..' gold coins para ser promovido.')				end			else				selfSay('Você precisar ser level '..minLvl..' ou mais para ser promovido.')			end		else			selfSay('Você já definiu sua promoção anteriormente.')		end	else		selfSay('Somente players da vocação 2 podem usar.')    endendlocal 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'}, justVoc, {value = 1}) -- valor numérico da promote    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})	node2:addChildKeyword({'yes'}, justVoc, {value = 2}) -- valor numérico da promote    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})local node3 = keywordHandler:addKeyword({'master'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can masterize you for 2000000 gold coins. Do you want me to masterize you?'})	node3:addChildKeyword({'yes'}, justVoc, {value = 3}) -- valor numérico da promote    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})npcHandler:addModule(FocusModule:new())

 

Boa sorte bro.

TOPZERA, foi 100%

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...