LE

Npc Q Vende Spell Rep+

Por leonvenigor, 24 de abr. de 2012 em Scripts

tibia
otserv
9
1.7k
leonvenigorL
24 de abril de 2012 às 11:43

galera todos os npcs q eu tentei fazer nenhum da certo, eu precisava de um q desse certo, as minhas magias sao de narutibia e meu servidor eh 8.54, precisava q fosse facil de adicionar as magias no npc dps, quem fizer isso por mim dou rep+.

bonazzaB
24 de abril de 2012 às 12:38

seria por gps ou por items?

leonvenigorL
24 de abril de 2012 às 12:48

por gps

PsyMcKenzieP
24 de abril de 2012 às 12:58

Acho que este é a mesma coisa:

http://www.xtibia.com/forum/topic/170068-npc-professor-de-spells/

leonvenigorL
24 de abril de 2012 às 13:10

ja tentei esse e nao deu :(

caoticC
24 de abril de 2012 às 13:20

vo fazer so que por dinheiro.

 

flw

jhon992J
24 de abril de 2012 às 13:27

essa do @VodKart, funciona perfeitamente, basta configurar corretamente:

http://www.xtibia.co...pells-por-item/

 

e se você quiser para remover money ao invez do item, basta trocar essa linha no script:

doPlayerRemoveItem(cid,moeda,t[msg].price)

por essa:

doPlayerRemoveMoney(cid, t[msg].price)

Editado Abril 24 por Jhon992

caoticC
24 de abril de 2012 às 13:34

eu so tava organizando as funçoes para fazer ai eu achei o do Vorkat como jhon disse ele funciona

bonazzaB
24 de abril de 2012 às 13:42

fiz uma por trade

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local shopWindow = {}
local spells = {
{id=1950, buy = 10000, name = "find person", vocations = {1,2,3,4,5,6,7,8}, level = 15},
{id=1950, buy = 15000, name = "flame strike", vocations = {1,2,5,6}, level = 20}
}
local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
	  if not getPlayerLearnedInstantSpell(cid, shopWindow[item].SpellName) then
	  if getPlayerLevel(cid) >= shopWindow[item].Level then
	   if isInArray(shopWindow[item].Vocs, getPlayerVocation(cid)) then
doPlayerRemoveMoney(cid, shopWindow[item].Price)
			doPlayerLearnInstantSpell(cid, shopWindow[item].SpellName)
		npcHandler:say("você aprendeu uma nova magia chamada "..shopWindow[item].SpellName, cid)
		else
		npcHandler:say("você não tem a vocação para comprar está spell.", cid)
	end
	else
		npcHandler:say("você precisa ter level "..shopWindow[item].Level.." ou mais para comprar essa magia.", cid)
	end
	else
		npcHandler:say("você já aprendeu essa magia.", cid)
	end
return true
end
if msgcontains(msg, 'trade') or msgcontains(msg, 'spell') then
for var, item in pairs(spells) do
shopWindow[item.id] = {Level = item.level, Vocs = item.vocations, item_id = item.id, Price = item.buy, subType = 0, SpellName = item.name}
end
openShopWindow(cid, spells, onBuy, onSell)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Editado Abril 24 por SrNight