Vocation
crie um xml com o nome vocation e coloque isso nele
<?xml version="1.0"?>
<npc name="Vocation" script="data/npc/scripts/vocacao.lua" access="3" monster="1" speed="50" lookdir="2" pushable="0" level="100">
<mana now="0" max="0"/>
<health now="150" max="150"/>
<look type="1448" head="57" body="59" legs="40" feet="76" corpse="2212"/>
</npc>
agora crie um lua com nome vocacao e coloque isso nele
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
talk_state = 0
cname = ''
vocation = 0
mainlevel = 8
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
cname = creatureGetName(cid)
msg = string.lower(msg)
if (msgcontains(msg, 'oi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. cname .. '! Voce quer se transformar em uma vocaçao de sua escolha??')
talk_state = 0
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. cname .. '! I talk to you in a minute.')
elseif msgcontains(msg, 'bye') and focus == cid and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. cname .. '!')
talk_state = 0
focus = 0
talk_start = 0 elseif focus == cid then
talk_start = os.clock() if talk_state == 0 then
if msgcontains(msg, 'sim') then -- wanna go to mainland
level = getPlayerLevel(cname)
if level >= mainlevel then
selfSay('Great! Do you want to be a knight, a paladino, a sorcer or a druid?')
talk_state = 1
else
selfSay('Sorry, you need level ' .. mainlevel .. ' to go to the mainland.')
talk_state = 0
end
else
selfSay('Come back when you are ready then.')
talk_state = 0
end
elseif talk_state == 1 then -- telling vocation
talk_state = 2
if msgcontains(msg, 'sorcer') then
selfSay('A mighty sorcer! Are you sure?')
vocation = 1
elseif msgcontains(msg, 'druid') then
selfSay('A mysterious druid! Are you sure?')
vocation = 2
elseif msgcontains(msg, 'paladino') then
selfSay('A nimble paladino! Are you sure?')
vocation = 3
elseif msgcontains(msg, 'knight') then
selfSay('A valorous cavaleiro! Are you sure?')
vocation = 4
else
selfSay('Sorry, there is no such vocation.')
vocation = 0
talk_state = 1
end
elseif talk_state == 2 then -- confirming vocation
if msgcontains(msg, 'sim') then
selfSay('Great! I can send you to The City. Where do you want to go?')
talk_state = 3
else
selfSay('Diga sim para concuir o processo!')
talk_state = 1
end
elseif talk_state == 3 then -- telling city name
if msgcontains(msg, 'sim') then
selfSay('Good luck, young adventurer!')
setPlayerVocation(cid,vocation)
setPlayerMasterPos(cid,160,54,7)
selfSay('/send ' .. cname .. ', 160 54 7')
talk_state = 0
focus = 0
talk_start = 0
else
selfSay('Sorry, there is no such city.')
talk_state = 3
end
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 45 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
pronto agora vamos pro pally seller
crie um arkivo com nome Pally Seller e coloque
<?xml version="1.0"?>
<npc name="Pally Seller" script="data/npc/scripts/Vendp.lua" access="3">
<look type="131" head="57" body="57" legs="57" feet="57"/>
</npc>
crie um lua com nome Vendp
coloque isso nele
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('xau boa sorte.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'oi') and focus == 0) and getDistanceToCreature(cid) < 4 then
selfSay('olá ' .. creatureGetName(cid) .. '! eu vendo items de pally')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'oi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('desculpe, ' .. creatureGetName(cid) .. '! por favor espere um minuto.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'crossbow') then
buy(cid,2455,1,200)
elseif msgcontains(msg, 'bow') then
buy(cid,2456,1,300)
elseif msgcontains(msg, 'arrow') then
buy(cid,2544,200,100)
elseif msgcontains(msg, 'xau') and getDistanceToCreature(cid) < 4 then
selfSay('xau boa sorte, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('continue...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('xau boa sorte.')
focus = 0
end
end
end
bom por inquanto so tenho esses dois npc de bom^^ tipow eu nao tinha mto tempo qdo fui fazer o pally seller aew nao botei pra ele vender mtas arrows vc paga 100gp ele le da 100 arrow e ele vende bow e crossbow dpois eu edito isso aki^^ pra botar pra vender + arrow