Fala Galera do Xtibia!
No OT que eu estou fazendo ( Mapa feito do 0, totalmente por mim )
O NPC que concerta a Soft Boots pede a Worn Soft Boots ( Oh Rly? )
Mas mesmo as tendo, ele falava que você não as possuía, depois de concertar isso
ele não devolvia a Soft Boots ( ) Concertei,
depois ele falava que você não tinha dinheiro, ou seja, Cerveja!
Eu refiz ele inteiro e finalmente deu certo! Aí vai o Script:
---Created by Nitroniumlocal focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
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)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I can fix your Worn Soft Boots for 10000 pieces of gold).')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Wait you time, ' .. creatureGetName(cid) .. '!')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'worn soft boots') or msgcontains(msg, 'soft boots')then
if getPlayerItemCount(cid,6530) >= 1 then
if doPlayerTakeItem(cid,6530,1) and pay(cid,10000) then
selfSay('Here you are.')
doPlayerAddItem(cid,6132,1)
end
else
selfSay('Sorry, you don\'t have the item.')
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. 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('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
Não sabe colocá-lo no OT? Leia as instruções abaixo!
- Vá na pasta data/npc/scripts
- Copie qualquer arquivo e apague tudo que estiver dentro dele
- Cole o script dentro dele e salve como "soft.lua" sem as aspas.
- Volte para a pasta data/npc
- Copie qualquer arquivo lá dentro e cole isso:<?xml version="1.0"?>
<npc name="NOME DO NPC" script="data/npc/scripts/soft.lua" autowalk="25" access="3" lookdir="2">
<health now="1" max="1"/>
<look type="151" head="114" body="1" legs="1" feet="76" addons="1"/>
</npc>
Em Verde você coloca o nome do NPC ( Salve o arquivo com o mesmo nome )
Em Vermelho é o script do NPC, se você salvou como soft.lua não precisa mecher, se não salvou assim, ponha o nome que você salvou.
E pronto!
Créditos 100% a... MIM!
Screen Shoots: