Ir para conteúdo

[Pedido]Npc Que Venda Bless, Addon E Promotion...


7401131

Posts Recomendados

Tipo do script:Npc

Protocolo (versão do Tibia):8.50

Servidor utilizado:Styller

Nível de experiência:itendo um pouco de scipts

Adicionais/Informações:Npc que venda bless, addons e promotion, todos em um so npc...Possivel isso? sim tem um em mapas do pbot 8.5

 

Contato msn:fabianomartinsalberto@hotmail.com

Link para o comentário
Compartilhar em outros sites

tenta isso vá em data/npc crie um arquivo xml ai com copy e paste renomeie para Johnny,ponha isso dentro:

 

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Johnny" script="data/npc/scripts/promotion.lua" walkinterval="2000" floorchange="0">

<mana now="800" max="800"/>

<health now="200" max="200"/>

<look type="133" head="114" body="119" legs="132" feet="114"/>

</npc>

 

va para data/npc/scripts e crie um arquivo.lua com o nome de promotion e ponha isso dentro:

 

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 = 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})

 

npcHandler:addModule(FocusModule:new())

 

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({'first bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the first blessing for 2000 (plus level depending amount) gold?'})

node1:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 1, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

 

local node2 = keywordHandler:addKeyword({'second bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the second blessing for 2000 (plus level depending amount) gold?'})

node2:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 2, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})

node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

 

local node3 = keywordHandler:addKeyword({'third bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the third blessing for 2000 (plus level depending amount) gold?'})

node3:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 3, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})

node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

 

local node4 = keywordHandler:addKeyword({'fourth bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the fourth blessing for 2000 (plus level depending amount) gold?'})

node4:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 4, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})

node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

 

local node5 = keywordHandler:addKeyword({'fifth bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the fifth blessing for 2000 (plus level depending amount) gold?'})

node5:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 5, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})

node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

 

npcHandler:addModule(FocusModule:new())

 

 

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

 

function buyAddons(cid, message, keywords, parameters, node)

--TODO: buyAddons function in modules.lua

if(not npcHandler:isFocused(cid)) then

return false

end

 

local addon = parameters.addon

local cost = parameters.cost

local premium = (parameters.premium ~= nil and parameters.premium)

 

if isPlayerPremiumCallback == nil or (isPlayerPremiumCallback(cid) and premium) then

if doPlayerRemoveMoney(cid, cost) then

doPlayerAddAddons(cid, addon)

npcHandler:say('There, you are now able to use all addons!', cid)

else

npcHandler:say('Sorry, you do not have enough money.', cid)

end

else

npcHandler:say('I only serve customers with premium accounts.', cid)

end

 

keywordHandler:moveUp(1)

return true

end

 

local node1 = keywordHandler:addKeyword({'first addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the first addons set for 25000 gold coins?'})

node1:addChildKeyword({'yes'}, buyAddons, {addon = 1, cost = 25000, premium = true})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'})

 

local node2 = keywordHandler:addKeyword({'second addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to buy the second addons set for 50000 gold coins?'})

node2:addChildKeyword({'yes'}, buyAddons, {addon = 2, cost = 50000, premium = true})

node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'})

 

keywordHandler:addKeyword({'addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell the first addons set for 25000 gold coins and the second addons set for 50000 gold coins.'})

 

npcHandler:addModule(FocusModule:new())

 

se ajudei,de rep+

custa nada =]

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...