Kara adorei a organizaçao entao por isso irei fazer todos os scripts xD
Npc 1:
Va em data/npc/scripts e adicione o script blesserfree.lua e bote este script dentro:
-------- NPC by MatheusMkalo for Xtibia.com ---------
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
if msgcontains(msg, "first") or msgcontains(msg, "first bless") then
selfSay("You sure to pay 10000 gold coins for a first bless?", cid)
talkState[cid] = 1
elseif msgcontains(msg, 'yes') and talkState[cid] == 1 then
if not getPlayerBlessing(cid, 1) then
if doPlayerRemoveMoney(cid, 10000) then
doPlayerAddBlessing(cid, 1)
selfSay("Now you have the first bless.", cid)
talkState[cid] = 0
else
selfSay("You don't have enough money to pay.", cid)
end
else
selfSay("You already have the first bless.", cid)
end
elseif msgcontains(msg, 'no') and talkState[cid] == 1 then
selfSay("What you wanna?", cid)
talkState[cid] = 0
end
if msgcontains(msg, "second") or msgcontains(msg, "second bless") then
selfSay("You sure to pay 10000 gold coins for a second bless?", cid)
talkState[cid] = 2
elseif msgcontains(msg, "yes") and talkState[cid] == 2 then
if not getPlayerBlessing(cid, 2) then
if doPlayerRemoveMoney(cid, 10000) then
doPlayerAddBlessing(cid, 2)
selfSay("Now you have the second bless.", cid)
talkState[cid] = 0
else
selfSay("You don't have enough money to pay.", cid)
end
else
selfSay("You already have the second bless.", cid)
end
elseif msgcontains(msg, 'no') and talkState[cid] == 2 then
selfSay("What you wanna?", cid)
talkState[cid] = 0
end
if msgcontains(msg, "third") or msgcontains(msg, "third bless") then
selfSay("You sure to pay 10000 gold coins for a third bless?", cid)
talkState[cid] = 3
elseif msgcontains(msg, "yes") and talkState[cid] == 3 then
if not getPlayerBlessing(cid, 3) then
if doPlayerRemoveMoney(cid, 10000) then
doPlayerAddBlessing(cid, 3)
selfSay("Now you have the third bless.", cid)
talkState[cid] = 0
else
selfSay("You don't have enough money to pay.", cid)
end
else
selfSay("You already have the third bless.", cid)
end
elseif msgcontains(msg, 'no') and talkState[cid] == 3 then
selfSay("What you wanna?", cid)
talkState[cid] = 0
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Depois va em data/npc crie um arquivo .xml com o nome de Carlos.xml e bote isto dentro:
<npc name="Carlos" script="data/npc/scripts/blesserfree.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="143" head="0" body="126" legs="87" feet="87" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell the {first} bless, {second} and {third} bless." />
<parameter key="message_farewell" value="Bye." />
<parameter key="message_walkaway" value="Bye." />
</parameters>
</npc>
Script do Item:
Va em data/actions/scripts e adicione o script blesscheck.lua e bote este script dentro:
function onUse(cid, item) first = "" second = "" third = "" fourth = "" fifth = "" if getPlayerBlessing(cid, 1) then first = "First Bless" end if getPlayerBlessing(cid, 2) then second = "Second Bless" end if getPlayerBlessing(cid, 3) then third = "Third Bless" end if getPlayerBlessing(cid, 4) then fourth = "Fourth Bless" end if getPlayerBlessing(cid, 5) then fifth = "Fifth Bless" end doPlayerPopupFYI(cid,"#Blessing Informations#\n\nMinhas Blessings:\n\n*"..first.."\n*"..second.."\n*"..third.."\n*"..fourth.."\n*"..fifth.."") return TRUE end
Depois va em actions.xml e bote esta tag:
<action itemid="6561" script="blesscheck.lua"/>
Npc 2:
Va em data/npc/scripts e adicione o script blesservip.lua e bote este script nele:
-------- NPC by MatheusMkalo for Xtibia.com ---------
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local storage = 13700
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
if getPlayerStorageValue(cid, storage) <= 0 then
selfSay("You want to be a vip for buy my offers.", cid)
return FALSE
end
if msgcontains(msg, "first") or msgcontains(msg, "first bless") then
selfSay("You sure to pay 10000 gold coins for a first bless?", cid)
talkState[cid] = 1
elseif msgcontains(msg, 'yes') and talkState[cid] == 1 then
if not getPlayerBlessing(cid, 1) then
if doPlayerRemoveMoney(cid, 10000) then
doPlayerAddBlessing(cid, 1)
selfSay("Now you have the first bless.", cid)
talkState[cid] = 0
else
selfSay("You don't have enough money to pay.", cid)
end
else
selfSay("You already have the first bless.", cid)
end
elseif msgcontains(msg, 'no') and talkState[cid] == 1 then
selfSay("What you wanna?", cid)
talkState[cid] = 0
end
if msgcontains(msg, "second") or msgcontains(msg, "second bless") then
selfSay("You sure to pay 10000 gold coins for a second bless?", cid)
talkState[cid] = 2
elseif msgcontains(msg, "yes") and talkState[cid] == 2 then
if not getPlayerBlessing(cid, 2) then
if doPlayerRemoveMoney(cid, 10000) then
doPlayerAddBlessing(cid, 2)
selfSay("Now you have the second bless.", cid)
talkState[cid] = 0
else
selfSay("You don't have enough money to pay.", cid)
end
else
selfSay("You already have the second bless.", cid)
end
elseif msgcontains(msg, 'no') and talkState[cid] == 2 then
selfSay("What you wanna?", cid)
talkState[cid] = 0
end
if msgcontains(msg, "third") or msgcontains(msg, "third bless") then
selfSay("You sure to pay 10000 gold coins for a third bless?", cid)
talkState[cid] = 3
elseif msgcontains(msg, "yes") and talkState[cid] == 3 then
if not getPlayerBlessing(cid, 3) then
if doPlayerRemoveMoney(cid, 10000) then
doPlayerAddBlessing(cid, 3)
selfSay("Now you have the third bless.", cid)
talkState[cid] = 0
else
selfSay("You don't have enough money to pay.", cid)
end
else
selfSay("You already have the third bless.", cid)
end
elseif msgcontains(msg, 'no') and talkState[cid] == 3 then
selfSay("What you wanna?", cid)
talkState[cid] = 0
end
if msgcontains(msg, "fourth") or msgcontains(msg, "fourth bless") then
selfSay("You sure to pay 10000 gold coins for a fourth bless?", cid)
talkState[cid] = 4
elseif msgcontains(msg, "yes") and talkState[cid] == 4 then
if not getPlayerBlessing(cid, 4) then
if doPlayerRemoveMoney(cid, 10000) then
doPlayerAddBlessing(cid, 4)
selfSay("Now you have the fourth bless.", cid)
talkState[cid] = 0
else
selfSay("You don't have enough money to pay.", cid)
end
else
selfSay("You already have the fourth bless.", cid)
end
elseif msgcontains(msg, 'no') and talkState[cid] == 4 then
selfSay("What you wanna?", cid)
talkState[cid] = 0
end
if msgcontains(msg, "fifth") or msgcontains(msg, "fifth bless") then
selfSay("You sure to pay 10000 gold coins for a fifth bless?", cid)
talkState[cid] = 5
elseif msgcontains(msg, "yes") and talkState[cid] == 5 then
if not getPlayerBlessing(cid, 5) then
if doPlayerRemoveMoney(cid, 10000) then
doPlayerAddBlessing(cid, 5)
selfSay("Now you have the fifth bless.", cid)
talkState[cid] = 0
else
selfSay("You don't have enough money to pay.", cid)
end
else
selfSay("You already have the fifth bless.", cid)
end
elseif msgcontains(msg, 'no') and talkState[cid] == 5 then
selfSay("What you wanna?", cid)
talkState[cid] = 0
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Depois va em data/npc e adicione um arquivo.xml com o nome de Henrique.xml e bote este script:
<npc name="Henrique" script="data/npc/scripts/blesservip.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="132" head="0" body="114" legs="94" feet="0" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell the {first}, {second}, {third}, {fourth} and {fifth} bless." />
<parameter key="message_farewell" value="Bye." />
<parameter key="message_walkaway" value="Bye." />
</parameters>
</npc>
Faça tudo conforme eu falei para pegar perfeitamente, todos os scripts postados foram testados e aprovados :smile_positivo:




info
Grupo: Campones
Registrado: 19/12/08
Posts: 22
Reputação: +2
Tipo do script: --
Protocolo (versão do Tibia): 8.54
Servidor utilizado:TFS
Nível de experiência:--
Adicionais/Informações:
Olá, queria fazer 3 pedidos, 2 NPCs e 1 Script.
#NPCS#
Primeiro NPC - quero um npc de Bless que vende só as 3 primeiras blessings (first bless, second bless e third bless) todas por 10 k, o nome do NPC poder ser Carlos.
OBS: esse NPC só vende para players Free Acc e VIP Acc.
STORAGE da VIP: 13700
Segundo NPC - também um npc de bless, mas que dessa vez vende as 5 blessings (first bless, second bless, third bless, fourth bless, fifth bless) todas por 10k, o nome do NPC pode ser Henrique
OBS: esse NPC só vende para players VIP!
STORAGE da VIP: 13700
#SCRIPT#
quero um script que quando você da use em tal item, aparece uma tela tipo a do !serverinfo, ou pode ser no default mesmo, mais prefiro tipo !serverinfo, e quando do use, aparece todas as informações das minhas blessings,
Exemplo
Com a imagem, vocês podem ter mais ou menos uma ideia
Item para aparecer as Blessings:Ceremonial Ankh
ID do Item: 6561
bom é isso, espero que consigam me ajudar, se tiverem dúvidas, me fale, que eu explico novamente.
Editado Junho 26 por tricolorgaucho