Ir para conteúdo
  • Cadastre-se

(Resolvido)Inserir Anúncio


Ir para solução Resolvido por DukeeH,

Posts Recomendados

Diga em poucas palavras a base utilizada (Nome do servidor ou nome do website).

Ex. TFS 1.3;

Base: TF 0.4

 

 

Qual erro está surgindo/O que você procura?

Senhores, bom dia!!

Este é um sistema de forja que utilizo em meu servidor, gostaria de adicionar a mensagem no broadcast "O jogador "XYZ" acabou de forjar o item "XYZ".

 

Alguem poderia auxiliar?

 

Você tem o código disponível? Se tiver publique-o aqui:

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 doChangeWeapon(cid, message, keywords, parameters, node) -- by vodka
if(not npcHandler:isFocused(cid)) 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('Desculpe, voce precisa ter level ' .. parameters.level .. ' ou mais para forjar este item.', cid)
elseif not doRemoveItemsFromList(cid,parameters.items) then
npcHandler:say('Desculpe, mas voce nao tem '..getItemsFromList(parameters.items)..' para forjar este item!', cid)
else
local r = parameters.chance
local v = math.random(1, 100)
if r > v then
npcHandler:say('Sucesso! Aqui esta seu item.', cid)
doPlayerAddItem(cid,parameters.give,1)
doSendMagicEffect(getPlayerPosition(cid), math.random(28,30)) 
else
npcHandler:say('Desculpe, mas seu item falho na forja!', cid)
doSendMagicEffect(getPlayerPosition(cid), 2) 
end
npcHandler:resetNpc()
end
else
npcHandler:say('Desculpe, mas apenas forjo esse item para jogadores premium account.', cid)
end
npcHandler:resetNpc()
return true
end
local list = {
{"broken sword", items = {{12766,100}}, item_give = 12756, chance = 100, level = 8, premium = false},
{"broken axe", items = {{12766,100}}, item_give = 12759, chance = 100, level = 8, premium = false},
{"broken club", items = {{12766,100}}, item_give = 12758, chance = 100, level = 8, premium = false},
{"broken staff", items = {{12766,100}}, item_give = 12757, chance = 100, level = 8, premium = false},
{"broken spear", items = {{12766,100}}, item_give = 12760, chance = 100, level = 8, premium = false},

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.

Editado por edustyle (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  Em 26/11/2018 em 10:49, edustyle disse:

Diga em poucas palavras a base utilizada (Nome do servidor ou nome do website).

Ex. TFS 1.3;

Base: TF 0.4

 

 

Qual erro está surgindo/O que você procura?

Senhores, bom dia!!

Este é um sistema de forja que utilizo em meu servidor, gostaria de adicionar a mensagem no broadcast "O jogador "XYZ" acabou de forjar o item "XYZ".

 

Alguem poderia auxiliar?

 

Você tem o código disponível? Se tiver publique-o aqui:

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 doChangeWeapon(cid, message, keywords, parameters, node) -- by vodka
if(not npcHandler:isFocused(cid)) 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('Desculpe, voce precisa ter level ' .. parameters.level .. ' ou mais para forjar este item.', cid)
elseif not doRemoveItemsFromList(cid,parameters.items) then
npcHandler:say('Desculpe, mas voce nao tem '..getItemsFromList(parameters.items)..' para forjar este item!', cid)
else
local r = parameters.chance
local v = math.random(1, 100)
if r > v then
npcHandler:say('Sucesso! Aqui esta seu item.', cid)
doPlayerAddItem(cid,parameters.give,1)
doSendMagicEffect(getPlayerPosition(cid), math.random(28,30)) 
else
npcHandler:say('Desculpe, mas seu item falho na forja!', cid)
doSendMagicEffect(getPlayerPosition(cid), 2) 
end
npcHandler:resetNpc()
end
else
npcHandler:say('Desculpe, mas apenas forjo esse item para jogadores premium account.', cid)
end
npcHandler:resetNpc()
return true
end
local list = {
{"broken sword", items = {{12766,100}}, item_give = 12756, chance = 100, level = 8, premium = false},
{"broken axe", items = {{12766,100}}, item_give = 12759, chance = 100, level = 8, premium = false},
{"broken club", items = {{12766,100}}, item_give = 12758, chance = 100, level = 8, premium = false},
{"broken staff", items = {{12766,100}}, item_give = 12757, chance = 100, level = 8, premium = false},
{"broken spear", items = {{12766,100}}, item_give = 12760, chance = 100, level = 8, premium = false},

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.

 

Mostrar mais  
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 doChangeWeapon(cid, message, keywords, parameters, node) -- by vodka

	if(not npcHandler:isFocused(cid)) 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('Desculpe, voce precisa ter level ' .. parameters.level .. ' ou mais para forjar este item.', cid)
		elseif not doRemoveItemsFromList(cid,parameters.items) then
			npcHandler:say('Desculpe, mas voce nao tem '..getItemsFromList(parameters.items)..' para forjar este item!', cid)
		else
			local r = parameters.chance
			local v = math.random(1, 100)
			if r > v then
				npcHandler:say('Sucesso! Aqui esta seu item.', cid)
				local iname = getItemName(parameters.give.uid)
				doBroadcastMessage("[Sistema de Forja]\nO jogador "..getCreatureName(cid).." acabou de forjar o item "..iname..".", 22) 
				doPlayerAddItem(cid,parameters.give,1)
				doSendMagicEffect(getPlayerPosition(cid), math.random(28,30)) 
			else
				npcHandler:say('Desculpe, mas seu item falho na forja!', cid)
				doSendMagicEffect(getPlayerPosition(cid), 2) 
			end
			npcHandler:resetNpc()
		end
	else
		npcHandler:say('Desculpe, mas apenas forjo esse item para jogadores premium account.', cid)
	end
	npcHandler:resetNpc()
	return true
end

local list = {
{"broken sword", items = {{12766,100}}, item_give = 12756, chance = 100, level = 8, premium = false},
{"broken axe", items = {{12766,100}}, item_give = 12759, chance = 100, level = 8, premium = false},
{"broken club", items = {{12766,100}}, item_give = 12758, chance = 100, level = 8, premium = false},
{"broken staff", items = {{12766,100}}, item_give = 12757, chance = 100, level = 8, premium = false},
{"broken spear", items = {{12766,100}}, item_give = 12760, chance = 100, level = 8, premium = false},

 

asdukeeh.jpg

Link para o post
Compartilhar em outros sites
  Em 26/11/2018 em 14:23, DukeeH disse:
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 doChangeWeapon(cid, message, keywords, parameters, node) -- by vodka

	if(not npcHandler:isFocused(cid)) 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('Desculpe, voce precisa ter level ' .. parameters.level .. ' ou mais para forjar este item.', cid)
		elseif not doRemoveItemsFromList(cid,parameters.items) then
			npcHandler:say('Desculpe, mas voce nao tem '..getItemsFromList(parameters.items)..' para forjar este item!', cid)
		else
			local r = parameters.chance
			local v = math.random(1, 100)
			if r > v then
				npcHandler:say('Sucesso! Aqui esta seu item.', cid)
				local iname = getItemName(parameters.give.uid)
				doBroadcastMessage("[Sistema de Forja]\nO jogador "..getCreatureName(cid).." acabou de forjar o item "..iname..".", 22) 
				doPlayerAddItem(cid,parameters.give,1)
				doSendMagicEffect(getPlayerPosition(cid), math.random(28,30)) 
			else
				npcHandler:say('Desculpe, mas seu item falho na forja!', cid)
				doSendMagicEffect(getPlayerPosition(cid), 2) 
			end
			npcHandler:resetNpc()
		end
	else
		npcHandler:say('Desculpe, mas apenas forjo esse item para jogadores premium account.', cid)
	end
	npcHandler:resetNpc()
	return true
end

local list = {
{"broken sword", items = {{12766,100}}, item_give = 12756, chance = 100, level = 8, premium = false},
{"broken axe", items = {{12766,100}}, item_give = 12759, chance = 100, level = 8, premium = false},
{"broken club", items = {{12766,100}}, item_give = 12758, chance = 100, level = 8, premium = false},
{"broken staff", items = {{12766,100}}, item_give = 12757, chance = 100, level = 8, premium = false},
{"broken spear", items = {{12766,100}}, item_give = 12760, chance = 100, level = 8, premium = false},

 

 

Mostrar mais  

Boa tarde!!

Tive este erro.

image.thumb.png.0cfbc678365301330618131b7c708b4f.png

Link para o post
Compartilhar em outros sites
  Em 26/11/2018 em 18:44, edustyle disse:

Boa tarde!!

Tive este erro.

image.thumb.png.0cfbc678365301330618131b7c708b4f.png

 

Mostrar mais  

O script como mandou estava funcionando?

Teste assim, mas esta dando muito erro, se adicionei só uma linha.

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 doChangeWeapon(cid, message, keywords, parameters, node) -- by vodka
if(not npcHandler:isFocused(cid)) 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('Desculpe, voce precisa ter level ' .. parameters.level .. ' ou mais para forjar este item.', cid)
elseif not doRemoveItemsFromList(cid,parameters.items) then
npcHandler:say('Desculpe, mas voce nao tem '..getItemsFromList(parameters.items)..' para forjar este item!', cid)
else
local r = parameters.chance
local v = math.random(1, 100)
if r > v then
npcHandler:say('Sucesso! Aqui esta seu item.', cid)
doPlayerAddItem(cid,parameters.give,1)
doSendMagicEffect(getPlayerPosition(cid), math.random(28,30)) 
local iname = getItemNameById(itemid)(parameters.give)
doBroadcastMessage("[Sistema de Forja]\nO jogador "..getCreatureName(cid).." acabou de forjar o item "..iname..".", 22) 
else
npcHandler:say('Desculpe, mas seu item falho na forja!', cid)
doSendMagicEffect(getPlayerPosition(cid), 2) 
end
npcHandler:resetNpc()
end
else
npcHandler:say('Desculpe, mas apenas forjo esse item para jogadores premium account.', cid)
end
npcHandler:resetNpc()
return true
end
local list = {
{"broken sword", items = {{12766,100}}, item_give = 12756, chance = 100, level = 8, premium = false},
{"broken axe", items = {{12766,100}}, item_give = 12759, chance = 100, level = 8, premium = false},
{"broken club", items = {{12766,100}}, item_give = 12758, chance = 100, level = 8, premium = false},
{"broken staff", items = {{12766,100}}, item_give = 12757, chance = 100, level = 8, premium = false},
{"broken spear", items = {{12766,100}}, item_give = 12760, chance = 100, level = 8, premium = false},

 

asdukeeh.jpg

Link para o post
Compartilhar em outros sites
  Em 26/11/2018 em 18:49, DukeeH disse:

O script como mandou estava funcionando?

Teste assim, mas esta dando muito erro, se adicionei só uma linha.

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 doChangeWeapon(cid, message, keywords, parameters, node) -- by vodka
if(not npcHandler:isFocused(cid)) 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('Desculpe, voce precisa ter level ' .. parameters.level .. ' ou mais para forjar este item.', cid)
elseif not doRemoveItemsFromList(cid,parameters.items) then
npcHandler:say('Desculpe, mas voce nao tem '..getItemsFromList(parameters.items)..' para forjar este item!', cid)
else
local r = parameters.chance
local v = math.random(1, 100)
if r > v then
npcHandler:say('Sucesso! Aqui esta seu item.', cid)
doPlayerAddItem(cid,parameters.give,1)
doSendMagicEffect(getPlayerPosition(cid), math.random(28,30)) 
local iname = getItemNameById(itemid)(parameters.give)
doBroadcastMessage("[Sistema de Forja]\nO jogador "..getCreatureName(cid).." acabou de forjar o item "..iname..".", 22) 
else
npcHandler:say('Desculpe, mas seu item falho na forja!', cid)
doSendMagicEffect(getPlayerPosition(cid), 2) 
end
npcHandler:resetNpc()
end
else
npcHandler:say('Desculpe, mas apenas forjo esse item para jogadores premium account.', cid)
end
npcHandler:resetNpc()
return true
end
local list = {
{"broken sword", items = {{12766,100}}, item_give = 12756, chance = 100, level = 8, premium = false},
{"broken axe", items = {{12766,100}}, item_give = 12759, chance = 100, level = 8, premium = false},
{"broken club", items = {{12766,100}}, item_give = 12758, chance = 100, level = 8, premium = false},
{"broken staff", items = {{12766,100}}, item_give = 12757, chance = 100, level = 8, premium = false},
{"broken spear", items = {{12766,100}}, item_give = 12760, chance = 100, level = 8, premium = false},

 

 

Mostrar mais  

image.thumb.png.760f5108fc20810e16fb54c26cef82ee.png

 

Segue script completa

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 doChangeWeapon(cid, message, keywords, parameters, node) -- by vodka
if(not npcHandler:isFocused(cid)) 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('Desculpe, voce precisa ter level ' .. parameters.level .. ' ou mais para forjar este item.', cid)
elseif not doRemoveItemsFromList(cid,parameters.items) then
npcHandler:say('Desculpe, mas voce nao tem '..getItemsFromList(parameters.items)..' para forjar este item!', cid)
else
local r = parameters.chance
local v = math.random(1, 100)
if r > v then
npcHandler:say('Sucesso! Aqui esta seu item.', cid)
doPlayerAddItem(cid,parameters.give,1)
doSendMagicEffect(getPlayerPosition(cid), math.random(28,30)) 
else
npcHandler:say('Desculpe, mas seu item falho na forja!', cid)
doSendMagicEffect(getPlayerPosition(cid), 2) 
end
npcHandler:resetNpc()
end
else
npcHandler:say('Desculpe, mas apenas forjo esse item para jogadores premium account.', cid)
end
npcHandler:resetNpc()
return true
end
local list = {
{"broken sword", items = {{12766,100}}, item_give = 12756, chance = 100, level = 8, premium = false},
{"broken axe", items = {{12766,100}}, item_give = 12759, chance = 100, level = 8, premium = false},
{"broken club", items = {{12766,100}}, item_give = 12758, chance = 100, level = 8, premium = false},
{"broken staff", items = {{12766,100}}, item_give = 12757, chance = 100, level = 8, premium = false},
{"broken spear", items = {{12766,100}}, item_give = 12760, chance = 100, level = 8, premium = false},
{"noob sword", items = {{12756,1},{12761,100}}, item_give = 12733, chance = 100, level = 8, premium = false},
{"noob axe", items = {{12759,1},{12761,100}}, item_give = 12731, chance = 100, level = 8, premium = false},
{"noob club", items = {{12758,1},{12761,100}}, item_give = 12732, chance = 100, level = 8, premium = false},
{"noob staff", items = {{12757,1},{12761,100}}, item_give = 12734, chance = 100, level = 8, premium = false},
{"noob star", items = {{12760,1},{12761,100}}, item_give = 12735, chance = 100, level = 8, premium = false},
{"elite sword", items = {{12733,1},{12762,200}}, item_give = 12728, chance = 100, level = 8, premium = false},
{"elite axe", items = {{12731,1},{12762,200}}, item_give = 12726, chance = 100, level = 8, premium = false},
{"elite club", items = {{12732,1},{12762,200}}, item_give = 12727, chance = 100, level = 8, premium = false},
{"elite staff", items = {{12734,1},{12762,200}}, item_give = 12729, chance = 100, level = 8, premium = false},
{"elite star", items = {{12735,1},{12762,200}}, item_give = 12730, chance = 100, level = 8, premium = false},
{"epic sword", items = {{12728,1},{12763,300}}, item_give = 12723, chance = 100, level = 8, premium = false},
{"epic axe", items = {{12726,1},{12763,300}}, item_give = 12721, chance = 100, level = 8, premium = false},
{"epic club", items = {{12727,1},{12763,300}}, item_give = 12722, chance = 100, level = 8, premium = false},
{"epic staff", items = {{12729,1},{12763,300}}, item_give = 12724, chance = 100, level = 8, premium = false},
{"epic crossbow", items = {{12730,1},{12763,300}}, item_give = 12725, chance = 100, level = 8, premium = false},
{"legendary sword", items = {{12723,1},{12764,400}}, item_give = 12718, chance = 100, level = 8, premium = false},
{"legendary axe", items = {{12721,1},{12764,400}}, item_give = 12716, chance = 100, level = 8, premium = false},
{"legendary club", items = {{12722,1},{12764,400}}, item_give = 12717, chance = 100, level = 8, premium = false},
{"legendary staff", items = {{12724,1},{12764,400}}, item_give = 12719, chance = 100, level = 8, premium = false},
{"legendary crossbow", items = {{12725,1},{12764,400}}, item_give = 12720, chance = 100, level = 8, premium = false},
{"ultimate sword", items = {{12718,1},{12765,500}}, item_give = 12668, chance = 100, level = 8, premium = false},
{"ultimate axe", items = {{12716,1},{12765,500}}, item_give = 12666, chance = 100, level = 8, premium = false},
{"ultimate club", items = {{12717,1},{12765,500}}, item_give = 12667, chance = 100, level = 8, premium = false},
{"ultimate staff", items = {{12719,1},{12765,500}}, item_give = 12669, chance = 100, level = 8, premium = false},
{"ultimate crossbow", items = {{12720,1},{12765,500}}, item_give = 12670, chance = 100, level = 8, premium = false},
{"itens", text = "Eu posso forjar alguns itens como: {broken sword},{broken axe},{broken club},{broken staff},{broken spear},{noob sword},{noob axe},{noob club},{noob staff},{noob star},{elite sword},{elite axe},{elite club},{elite staff},{elite star},{epic sword},{epic axe},{epic club},{epic staff},{epic crossbow},{legendary sword},{legendary axe},{legendary club},{legendary staff},{legendary crossbow},{ultimate sword},{ultimate axe},{ultimate club},{ultimate staff} ou {ultimate crossbow}!"}
}
for i = 1, #list do local get = list if type(get.items) == "table" then
local node = keywordHandler:addKeyword({get[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Para forjar o item " .. get[1] .. " e necessario "..getItemsFromList(get.items)..". Voce tem tudo isso para me dar?"})
node:addChildKeyword({"yes"}, doChangeWeapon, {items = get.items, give = get.item_give, chance = get.chance, level = get.level, premium = get.premium})
node:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "tudo bem entao.", reset = true})
else keywordHandler:addKeyword({get[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = get.text}) end end
mounts = nil npcHandler:addModule(FocusModule:new())

Link para o post
Compartilhar em outros sites

@edustyle

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 doChangeWeapon(cid, message, keywords, parameters, node) -- by vodka
if(not npcHandler:isFocused(cid)) 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('Desculpe, voce precisa ter level ' .. parameters.level .. ' ou mais para forjar este item.', cid)
elseif not doRemoveItemsFromList(cid,parameters.items) then
npcHandler:say('Desculpe, mas voce nao tem '..getItemsFromList(parameters.items)..' para forjar este item!', cid)
else
local r = parameters.chance
local v = math.random(1, 100)
if r > v then
npcHandler:say('Sucesso! Aqui esta seu item.', cid)
local iname = getItemNameById(parameters.give)
doBroadcastMessage("[Sistema de Forja]\nO jogador "..getCreatureName(cid).." acabou de forjar o item "..iname..".", 22) 
doPlayerAddItem(cid,parameters.give,1)
doSendMagicEffect(getPlayerPosition(cid), math.random(28,30)) 
else
npcHandler:say('Desculpe, mas seu item falho na forja!', cid)
doSendMagicEffect(getPlayerPosition(cid), 2) 
end
npcHandler:resetNpc()
end
else
npcHandler:say('Desculpe, mas apenas forjo esse item para jogadores premium account.', cid)
end
npcHandler:resetNpc()
return true
end
local list = {
{"broken sword", items = {{12766,100}}, item_give = 12756, chance = 100, level = 8, premium = false},
{"broken axe", items = {{12766,100}}, item_give = 12759, chance = 100, level = 8, premium = false},
{"broken club", items = {{12766,100}}, item_give = 12758, chance = 100, level = 8, premium = false},
{"broken staff", items = {{12766,100}}, item_give = 12757, chance = 100, level = 8, premium = false},
{"broken spear", items = {{12766,100}}, item_give = 12760, chance = 100, level = 8, premium = false},
{"noob sword", items = {{12756,1},{12761,100}}, item_give = 12733, chance = 100, level = 8, premium = false},
{"noob axe", items = {{12759,1},{12761,100}}, item_give = 12731, chance = 100, level = 8, premium = false},
{"noob club", items = {{12758,1},{12761,100}}, item_give = 12732, chance = 100, level = 8, premium = false},
{"noob staff", items = {{12757,1},{12761,100}}, item_give = 12734, chance = 100, level = 8, premium = false},
{"noob star", items = {{12760,1},{12761,100}}, item_give = 12735, chance = 100, level = 8, premium = false},
{"elite sword", items = {{12733,1},{12762,200}}, item_give = 12728, chance = 100, level = 8, premium = false},
{"elite axe", items = {{12731,1},{12762,200}}, item_give = 12726, chance = 100, level = 8, premium = false},
{"elite club", items = {{12732,1},{12762,200}}, item_give = 12727, chance = 100, level = 8, premium = false},
{"elite staff", items = {{12734,1},{12762,200}}, item_give = 12729, chance = 100, level = 8, premium = false},
{"elite star", items = {{12735,1},{12762,200}}, item_give = 12730, chance = 100, level = 8, premium = false},
{"epic sword", items = {{12728,1},{12763,300}}, item_give = 12723, chance = 100, level = 8, premium = false},
{"epic axe", items = {{12726,1},{12763,300}}, item_give = 12721, chance = 100, level = 8, premium = false},
{"epic club", items = {{12727,1},{12763,300}}, item_give = 12722, chance = 100, level = 8, premium = false},
{"epic staff", items = {{12729,1},{12763,300}}, item_give = 12724, chance = 100, level = 8, premium = false},
{"epic crossbow", items = {{12730,1},{12763,300}}, item_give = 12725, chance = 100, level = 8, premium = false},
{"legendary sword", items = {{12723,1},{12764,400}}, item_give = 12718, chance = 100, level = 8, premium = false},
{"legendary axe", items = {{12721,1},{12764,400}}, item_give = 12716, chance = 100, level = 8, premium = false},
{"legendary club", items = {{12722,1},{12764,400}}, item_give = 12717, chance = 100, level = 8, premium = false},
{"legendary staff", items = {{12724,1},{12764,400}}, item_give = 12719, chance = 100, level = 8, premium = false},
{"legendary crossbow", items = {{12725,1},{12764,400}}, item_give = 12720, chance = 100, level = 8, premium = false},
{"ultimate sword", items = {{12718,1},{12765,500}}, item_give = 12668, chance = 100, level = 8, premium = false},
{"ultimate axe", items = {{12716,1},{12765,500}}, item_give = 12666, chance = 100, level = 8, premium = false},
{"ultimate club", items = {{12717,1},{12765,500}}, item_give = 12667, chance = 100, level = 8, premium = false},
{"ultimate staff", items = {{12719,1},{12765,500}}, item_give = 12669, chance = 100, level = 8, premium = false},
{"ultimate crossbow", items = {{12720,1},{12765,500}}, item_give = 12670, chance = 100, level = 8, premium = false},
{"itens", text = "Eu posso forjar alguns itens como: {broken sword},{broken axe},{broken club},{broken staff},{broken spear},{noob sword},{noob axe},{noob club},{noob staff},{noob star},{elite sword},{elite axe},{elite club},{elite staff},{elite star},{epic sword},{epic axe},{epic club},{epic staff},{epic crossbow},{legendary sword},{legendary axe},{legendary club},{legendary staff},{legendary crossbow},{ultimate sword},{ultimate axe},{ultimate club},{ultimate staff} ou {ultimate crossbow}!"}
}
for i = 1, #list do local get = list if type(get.items) == "table" then
local node = keywordHandler:addKeyword({get[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Para forjar o item " .. get[1] .. " e necessario "..getItemsFromList(get.items)..". Voce tem tudo isso para me dar?"})
node:addChildKeyword({"yes"}, doChangeWeapon, {items = get.items, give = get.item_give, chance = get.chance, level = get.level, premium = get.premium})
node:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "tudo bem entao.", reset = true})
else keywordHandler:addKeyword({get[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = get.text}) end end
mounts = nil npcHandler:addModule(FocusModule:new())

 

asdukeeh.jpg

Link para o post
Compartilhar em outros sites
  Em 26/11/2018 em 19:38, DukeeH disse:

@edustyle

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 doChangeWeapon(cid, message, keywords, parameters, node) -- by vodka
if(not npcHandler:isFocused(cid)) 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('Desculpe, voce precisa ter level ' .. parameters.level .. ' ou mais para forjar este item.', cid)
elseif not doRemoveItemsFromList(cid,parameters.items) then
npcHandler:say('Desculpe, mas voce nao tem '..getItemsFromList(parameters.items)..' para forjar este item!', cid)
else
local r = parameters.chance
local v = math.random(1, 100)
if r > v then
npcHandler:say('Sucesso! Aqui esta seu item.', cid)
local iname = getItemNameById(parameters.give)
doBroadcastMessage("[Sistema de Forja]\nO jogador "..getCreatureName(cid).." acabou de forjar o item "..iname..".", 22) 
doPlayerAddItem(cid,parameters.give,1)
doSendMagicEffect(getPlayerPosition(cid), math.random(28,30)) 
else
npcHandler:say('Desculpe, mas seu item falho na forja!', cid)
doSendMagicEffect(getPlayerPosition(cid), 2) 
end
npcHandler:resetNpc()
end
else
npcHandler:say('Desculpe, mas apenas forjo esse item para jogadores premium account.', cid)
end
npcHandler:resetNpc()
return true
end
local list = {
{"broken sword", items = {{12766,100}}, item_give = 12756, chance = 100, level = 8, premium = false},
{"broken axe", items = {{12766,100}}, item_give = 12759, chance = 100, level = 8, premium = false},
{"broken club", items = {{12766,100}}, item_give = 12758, chance = 100, level = 8, premium = false},
{"broken staff", items = {{12766,100}}, item_give = 12757, chance = 100, level = 8, premium = false},
{"broken spear", items = {{12766,100}}, item_give = 12760, chance = 100, level = 8, premium = false},
{"noob sword", items = {{12756,1},{12761,100}}, item_give = 12733, chance = 100, level = 8, premium = false},
{"noob axe", items = {{12759,1},{12761,100}}, item_give = 12731, chance = 100, level = 8, premium = false},
{"noob club", items = {{12758,1},{12761,100}}, item_give = 12732, chance = 100, level = 8, premium = false},
{"noob staff", items = {{12757,1},{12761,100}}, item_give = 12734, chance = 100, level = 8, premium = false},
{"noob star", items = {{12760,1},{12761,100}}, item_give = 12735, chance = 100, level = 8, premium = false},
{"elite sword", items = {{12733,1},{12762,200}}, item_give = 12728, chance = 100, level = 8, premium = false},
{"elite axe", items = {{12731,1},{12762,200}}, item_give = 12726, chance = 100, level = 8, premium = false},
{"elite club", items = {{12732,1},{12762,200}}, item_give = 12727, chance = 100, level = 8, premium = false},
{"elite staff", items = {{12734,1},{12762,200}}, item_give = 12729, chance = 100, level = 8, premium = false},
{"elite star", items = {{12735,1},{12762,200}}, item_give = 12730, chance = 100, level = 8, premium = false},
{"epic sword", items = {{12728,1},{12763,300}}, item_give = 12723, chance = 100, level = 8, premium = false},
{"epic axe", items = {{12726,1},{12763,300}}, item_give = 12721, chance = 100, level = 8, premium = false},
{"epic club", items = {{12727,1},{12763,300}}, item_give = 12722, chance = 100, level = 8, premium = false},
{"epic staff", items = {{12729,1},{12763,300}}, item_give = 12724, chance = 100, level = 8, premium = false},
{"epic crossbow", items = {{12730,1},{12763,300}}, item_give = 12725, chance = 100, level = 8, premium = false},
{"legendary sword", items = {{12723,1},{12764,400}}, item_give = 12718, chance = 100, level = 8, premium = false},
{"legendary axe", items = {{12721,1},{12764,400}}, item_give = 12716, chance = 100, level = 8, premium = false},
{"legendary club", items = {{12722,1},{12764,400}}, item_give = 12717, chance = 100, level = 8, premium = false},
{"legendary staff", items = {{12724,1},{12764,400}}, item_give = 12719, chance = 100, level = 8, premium = false},
{"legendary crossbow", items = {{12725,1},{12764,400}}, item_give = 12720, chance = 100, level = 8, premium = false},
{"ultimate sword", items = {{12718,1},{12765,500}}, item_give = 12668, chance = 100, level = 8, premium = false},
{"ultimate axe", items = {{12716,1},{12765,500}}, item_give = 12666, chance = 100, level = 8, premium = false},
{"ultimate club", items = {{12717,1},{12765,500}}, item_give = 12667, chance = 100, level = 8, premium = false},
{"ultimate staff", items = {{12719,1},{12765,500}}, item_give = 12669, chance = 100, level = 8, premium = false},
{"ultimate crossbow", items = {{12720,1},{12765,500}}, item_give = 12670, chance = 100, level = 8, premium = false},
{"itens", text = "Eu posso forjar alguns itens como: {broken sword},{broken axe},{broken club},{broken staff},{broken spear},{noob sword},{noob axe},{noob club},{noob staff},{noob star},{elite sword},{elite axe},{elite club},{elite staff},{elite star},{epic sword},{epic axe},{epic club},{epic staff},{epic crossbow},{legendary sword},{legendary axe},{legendary club},{legendary staff},{legendary crossbow},{ultimate sword},{ultimate axe},{ultimate club},{ultimate staff} ou {ultimate crossbow}!"}
}
for i = 1, #list do local get = list if type(get.items) == "table" then
local node = keywordHandler:addKeyword({get[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Para forjar o item " .. get[1] .. " e necessario "..getItemsFromList(get.items)..". Voce tem tudo isso para me dar?"})
node:addChildKeyword({"yes"}, doChangeWeapon, {items = get.items, give = get.item_give, chance = get.chance, level = get.level, premium = get.premium})
node:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "tudo bem entao.", reset = true})
else keywordHandler:addKeyword({get[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = get.text}) end end
mounts = nil npcHandler:addModule(FocusModule:new())

 

 

Mostrar mais  

Agora quando falo itens com o NPC da o seguinte erro:

image.thumb.png.220d4d09030da232302b69d5240d0b58.png

 

OBS: A script estava funcionando 100% só falta a parte do broadcast.

 

Tem noção do que pode ser?

  Em 26/11/2018 em 19:53, edustyle disse:

Agora quando falo itens com o NPC da o seguinte erro:

image.thumb.png.220d4d09030da232302b69d5240d0b58.png

 

OBS: A script estava funcionando 100% só falta a parte do broadcast.

 

Tem noção do que pode ser?

 

Mostrar mais  

Consegui resolver faltava um  lá no final!! deu certo.

image.png.a22b04181902626add63ba9b6616d58d.png

 

REP!!!

Link para o post
Compartilhar em outros sites
  Em 26/11/2018 em 19:53, edustyle disse:

Agora quando falo itens com o NPC da o seguinte erro:

image.thumb.png.220d4d09030da232302b69d5240d0b58.png

 

OBS: A script estava funcionando 100% só falta a parte do broadcast.

 

Tem noção do que pode ser?

Consegui resolver faltava um  lá no final!! deu certo.

image.png.a22b04181902626add63ba9b6616d58d.png

 

REP!!!

 

Mostrar mais  

Se quiser trocar pra vermelho no centro da tela, tira o ,22 no final da linha.

 

asdukeeh.jpg

Link para o post
Compartilhar em outros sites
  Em 26/11/2018 em 19:38, DukeeH disse:

@edustyle

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 doChangeWeapon(cid, message, keywords, parameters, node) -- by vodka
if(not npcHandler:isFocused(cid)) 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('Desculpe, voce precisa ter level ' .. parameters.level .. ' ou mais para forjar este item.', cid)
elseif not doRemoveItemsFromList(cid,parameters.items) then
npcHandler:say('Desculpe, mas voce nao tem '..getItemsFromList(parameters.items)..' para forjar este item!', cid)
else
local r = parameters.chance
local v = math.random(1, 100)
if r > v then
npcHandler:say('Sucesso! Aqui esta seu item.', cid)
local iname = getItemNameById(parameters.give)
doBroadcastMessage("[Sistema de Forja]\nO jogador "..getCreatureName(cid).." acabou de forjar o item "..iname..".", 22) 
doPlayerAddItem(cid,parameters.give,1)
doSendMagicEffect(getPlayerPosition(cid), math.random(28,30)) 
else
npcHandler:say('Desculpe, mas seu item falho na forja!', cid)
doSendMagicEffect(getPlayerPosition(cid), 2) 
end
npcHandler:resetNpc()
end
else
npcHandler:say('Desculpe, mas apenas forjo esse item para jogadores premium account.', cid)
end
npcHandler:resetNpc()
return true
end
local list = {
{"broken sword", items = {{12766,100}}, item_give = 12756, chance = 100, level = 8, premium = false},
{"broken axe", items = {{12766,100}}, item_give = 12759, chance = 100, level = 8, premium = false},
{"broken club", items = {{12766,100}}, item_give = 12758, chance = 100, level = 8, premium = false},
{"broken staff", items = {{12766,100}}, item_give = 12757, chance = 100, level = 8, premium = false},
{"broken spear", items = {{12766,100}}, item_give = 12760, chance = 100, level = 8, premium = false},
{"noob sword", items = {{12756,1},{12761,100}}, item_give = 12733, chance = 100, level = 8, premium = false},
{"noob axe", items = {{12759,1},{12761,100}}, item_give = 12731, chance = 100, level = 8, premium = false},
{"noob club", items = {{12758,1},{12761,100}}, item_give = 12732, chance = 100, level = 8, premium = false},
{"noob staff", items = {{12757,1},{12761,100}}, item_give = 12734, chance = 100, level = 8, premium = false},
{"noob star", items = {{12760,1},{12761,100}}, item_give = 12735, chance = 100, level = 8, premium = false},
{"elite sword", items = {{12733,1},{12762,200}}, item_give = 12728, chance = 100, level = 8, premium = false},
{"elite axe", items = {{12731,1},{12762,200}}, item_give = 12726, chance = 100, level = 8, premium = false},
{"elite club", items = {{12732,1},{12762,200}}, item_give = 12727, chance = 100, level = 8, premium = false},
{"elite staff", items = {{12734,1},{12762,200}}, item_give = 12729, chance = 100, level = 8, premium = false},
{"elite star", items = {{12735,1},{12762,200}}, item_give = 12730, chance = 100, level = 8, premium = false},
{"epic sword", items = {{12728,1},{12763,300}}, item_give = 12723, chance = 100, level = 8, premium = false},
{"epic axe", items = {{12726,1},{12763,300}}, item_give = 12721, chance = 100, level = 8, premium = false},
{"epic club", items = {{12727,1},{12763,300}}, item_give = 12722, chance = 100, level = 8, premium = false},
{"epic staff", items = {{12729,1},{12763,300}}, item_give = 12724, chance = 100, level = 8, premium = false},
{"epic crossbow", items = {{12730,1},{12763,300}}, item_give = 12725, chance = 100, level = 8, premium = false},
{"legendary sword", items = {{12723,1},{12764,400}}, item_give = 12718, chance = 100, level = 8, premium = false},
{"legendary axe", items = {{12721,1},{12764,400}}, item_give = 12716, chance = 100, level = 8, premium = false},
{"legendary club", items = {{12722,1},{12764,400}}, item_give = 12717, chance = 100, level = 8, premium = false},
{"legendary staff", items = {{12724,1},{12764,400}}, item_give = 12719, chance = 100, level = 8, premium = false},
{"legendary crossbow", items = {{12725,1},{12764,400}}, item_give = 12720, chance = 100, level = 8, premium = false},
{"ultimate sword", items = {{12718,1},{12765,500}}, item_give = 12668, chance = 100, level = 8, premium = false},
{"ultimate axe", items = {{12716,1},{12765,500}}, item_give = 12666, chance = 100, level = 8, premium = false},
{"ultimate club", items = {{12717,1},{12765,500}}, item_give = 12667, chance = 100, level = 8, premium = false},
{"ultimate staff", items = {{12719,1},{12765,500}}, item_give = 12669, chance = 100, level = 8, premium = false},
{"ultimate crossbow", items = {{12720,1},{12765,500}}, item_give = 12670, chance = 100, level = 8, premium = false},
{"itens", text = "Eu posso forjar alguns itens como: {broken sword},{broken axe},{broken club},{broken staff},{broken spear},{noob sword},{noob axe},{noob club},{noob staff},{noob star},{elite sword},{elite axe},{elite club},{elite staff},{elite star},{epic sword},{epic axe},{epic club},{epic staff},{epic crossbow},{legendary sword},{legendary axe},{legendary club},{legendary staff},{legendary crossbow},{ultimate sword},{ultimate axe},{ultimate club},{ultimate staff} ou {ultimate crossbow}!"}
}
for i = 1, #list do local get = list if type(get.items) == "table" then
local node = keywordHandler:addKeyword({get[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Para forjar o item " .. get[1] .. " e necessario "..getItemsFromList(get.items)..". Voce tem tudo isso para me dar?"})
node:addChildKeyword({"yes"}, doChangeWeapon, {items = get.items, give = get.item_give, chance = get.chance, level = get.level, premium = get.premium})
node:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "tudo bem entao.", reset = true})
else keywordHandler:addKeyword({get[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = get.text}) end end
mounts = nil npcHandler:addModule(FocusModule:new())

 

 

Mostrar mais  

Duke, a mensagem fica no meio da tela em branco, é dificil colocar ela no topo em vermelho?? Para não atrapalhar a jogabilidade??

Link para o post
Compartilhar em outros sites
  • Solução
  Em 26/11/2018 em 20:03, edustyle disse:

Duke, a mensagem fica no meio da tela em branco, é dificil colocar ela no topo em vermelho?? Para não atrapalhar a jogabilidade??

 

Mostrar mais  

Topo em vermelho não é uma opção, só centro da tela em vermelho, pois são usados os tipos de broadcast do tibia, como eu falei no post acima, pra deixar em vermelho, tira o ,12 no final da linha.

Mas infelizmente não é possível mudar a posição, apenas cor/estilo.

asdukeeh.jpg

Link para o post
Compartilhar em outros sites
  Em 27/11/2018 em 00:14, DukeeH disse:

Topo em vermelho não é uma opção, só centro da tela em vermelho, pois são usados os tipos de broadcast do tibia, como eu falei no post acima, pra deixar em vermelho, tira o ,12 no final da linha.

Mas infelizmente não é possível mudar a posição, apenas cor/estilo.

 

Expand   Mostrar mais  

beleza!! muito obrigado!!

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo