Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

Coloquei em meu Servidor um NPC que vende montarias, muito parecido com o sistema de addon!

Adaptei e criei o NPC que da  mount dos Horses (cavalos), Aqui surge o problema

Atualmente o NPC oferece ao player as 3 mounts dos Rented Horses.

Rented_Horse.gif  Rented_Horse_Thais.gif  Rented_Horse_Grey.gif

O que eu quero: Que o player so possa comprar uma vez a montaria e quando comprar venha um dos tres horses aleatoriamente.



Caso não entenderam podem me perguntar explico melhor


segue o Script que eu uso.

 

 

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
 
npcHandler:setMessage(MESSAGE_GREET, "Ola |PLAYERNAME|. Voce pode me ajudar? Se voce me ajudar, vou te recompensar com lindas montarias! Basta dizer {mounts} ou {ajuda} se voce não sabe o que fazer.")
 
function playerBuyMountNPC(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if (parameters.confirm ~= true) and (parameters.decline ~= true) then
if(getPlayerPremiumDays(cid) >= 1) and (parameters.premium == true) then
npcHandler:say('Desculpe, mas esta montaria e apenas para jogadores premium!', cid)
npcHandler:resetNpc()
return true
end
if (getPlayerStorageValue(cid, parameters.storageID) ~= -1) then
npcHandler:say('Voce ja tem esta montaria!', cid)
npcHandler:resetNpc()
return true
end
local itemsTable = parameters.items
local items_list = ''
if table.maxn(itemsTable) > 0 then
for i = 1, table.maxn(itemsTable) do
local item = itemsTable
items_list = items_list .. item[2] .. ' ' .. getItemNameById(item[1])
if i ~= table.maxn(itemsTable) then
items_list = items_list .. ', '
end
end
end
local text = ''
if (parameters.cost > 0) and table.maxn(parameters.items) then
text = items_list .. ' and ' .. parameters.cost .. ' gp'
elseif (parameters.cost > 0) then
text = parameters.cost .. ' gp'
elseif table.maxn(parameters.items) then
text = items_list
end
npcHandler:say('Trouxeste-me ' .. text .. ' por ' .. keywords[1] .. '?', cid)
return true
elseif (parameters.confirm == true) then
local mountNode = node:getParent()
local mountinfo = mountNode:getParameters()
local items_number = 0
if table.maxn(mountinfo.items) > 0 then
for i = 1, table.maxn(mountinfo.items) do
local item = mountinfo.items
if (getPlayerItemCount(cid,item[1]) >= item[2]) then
items_number = items_number + 1
end
end
end
if(getPlayerMoney(cid) >= mountinfo.cost) and (items_number == table.maxn(mountinfo.items)) then
doPlayerRemoveMoney(cid, mountinfo.cost)
if table.maxn(mountinfo.items) > 0 then
for i = 1, table.maxn(mountinfo.items) do
local item = mountinfo.items
doPlayerRemoveItem(cid,item[1],item[2])
end
end
doPlayerAddMount(cid, mountinfo.mountid)
setPlayerStorageValue(cid,mountinfo.storageID,1)
npcHandler:say('Aqui esta.', cid)
else
npcHandler:say('Voce nao tem os items necessarios ou dinheiro!', cid)
end
npcHandler:resetNpc()
return true
elseif (parameters.decline == true) then
npcHandler:say('Este nao lhe interessa? Experimente outro!', cid)
npcHandler:resetNpc()
return true
end
return false
end
 
local noNode = KeywordNode:new({'no'}, playerBuyMountNPC, {decline = true})
local yesNode = KeywordNode:new({'yes'}, playerBuyMountNPC, {confirm = true})
 
-- Rented Horse (done)(custom)
local mount_node = keywordHandler:addKeyword({'rented horse 1'}, playerBuyMountNPC, {premium = false, cost = 10000, items = {}, mountid = 22, storageID = 10059})
mount_node:addChildKeywordNode(yesNode)
mount_node:addChildKeywordNode(noNode)
local mount_node = keywordHandler:addKeyword({'rented horse 2'}, playerBuyMountNPC, {premium = false, cost = 10000, items = {}, mountid = 25, storageID = 10060})
mount_node:addChildKeywordNode(yesNode)
mount_node:addChildKeywordNode(noNode)
local mount_node = keywordHandler:addKeyword({'rented horse 3'}, playerBuyMountNPC, {premium = false, cost = 10000, items = {}, mountid = 26, storageID = 10061})
mount_node:addChildKeywordNode(yesNode)
mount_node:addChildKeywordNode(noNode)
 
 
keywordHandler:addKeyword({'mounts'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Posso te dar {blazebringer}, {donkey}, {rented horse} de 1 a 3, {shadow draptor}, {stampor}, {uniwheel} e a {tin lizzard}.'})
keywordHandler:addKeyword({'ajuda'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Para ter a montaria fale um dos nomes da lista (falando {mounts}) e consiga os items nescessários.'})
keywordHandler:addKeyword({'rented horse'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Existem 3 tipos de rented horse, para compra-los é {rented horse 1}, {rented horse 2} e {rented horse 3} eles são por tempo ilimitado.'})
 
npcHandler:addModule(FocusModule:new())

 

Meus Trabalhos:

 

*Spell Rajada de Flechas: http://migre.me/eI3aE

 

 

 

 

gif1705.gif

 

Postado

Eu nao to no computador, depois vou dar uma olhada e vejo se consigo te dar uma ajuda mano.

Mas ve se nao e porque todas as keywords de rented horse nao se confundem com a ketword rented horse... Eu nao mexo muito com NPCs entao nao entendi algumas funcoes... Depois que eu estudar mais eu posso ver se consigo te ajudar!

[TalkAction] Comando !stamina e stamina potion.

http://www.tibiaking.com/forum/topic/38953-talkaction-stamina-recupera-stamina-e-d%C3%A1-uma-potion-de-stamina/

Krell Gaming, OTServer estará ONLINE em breve!

Training Offline

Tasks, Mounts, Addons, Outfits

Quests baú, Quests lógicas, Quests misteriosas

Mistery Box (Itens Aleatórios), Upgrade your Itens(Melhorar os atributos dos itens), Frag Remover, Monster Cards

Stamina System e Stamina Potion

Castle com sistema próprio

Área Free com variadas e equilibradas hunts.

Mapa RPG porém equilibrado às rates do servidor.

Rates Variadas (Stages que podem variar de exp alta pra baixa, não baixando sempre como a maioria)

Drop rate: variando entre 3 ou mais x

Skills e ML: 20/10

Houses apenas para premium accounts.

Premium Account = 15 reais um mês.

Aproveite!

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.7k

Informação Importante

Confirmação de Termo