Ir para conteúdo

[npc] Npc Q Revive Seu Pet !


cagaio

Posts Recomendados

Alguéem poderia me ajudar criando um npc q revive meu pet ?

 

Ou um comando sei la tipo !petrevive

 

Só isso Vlw's !

 

 

PS : NAO Sei se a SS Vai ajuda mais Tbm Vo posta a Scripit do npc !

 

<npc name="Pet" script="data/npc/scripts/pet.lua" autowalk="25" floorchange="0" access="5" level="1" maglevel="1">

<health now="150" max="150"/>

<look type="231" head="79" body="118" legs="115" feet="114" corpse="2212"/>

<parameters>

 

</parameters>

</npc>

 

 

ee

local focus = 0

local talk_start = 0

local talk_state = 0

local costPerLevel = 300

 

dofile("./petConfig.lua")

 

 

 

function onThingMove(creature, thing, oldpos, oldstackpos)

 

end

 

 

function onCreatureAppear(creature)

 

end

 

 

function onCreatureDisappear(cid, pos)

if focus == cid then

selfSay('How rude!.')

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 getDistanceToCreature(cid) < 4 then

if (msgcontains(msg, 'hi') and (focus == 0)) then

selfSay('Hello! I can take you to the train!')

focus = cid

talk_start = os.clock()

 

elseif msgcontains(msg, 'hi') and (focus ~= cid) then

selfSay('Sorry! I talk to you in a minute.')

end

 

if msgcontains(msg, 'revive') and focus == cid then

if isCreature(getPlayerStorageValue(cid, storages.petUid)) == 0 then

if getPlayerStorageValue(cid, storages.petIsOnline) == 2 then

selfSay('YOUR PET DIED?!, YOU\'R A BAD OWNER, THIS WILL COST YOU ' .. getPlayerLevel(cid)*costPerLevel .. ' GOLD COINS!, AGREE?!')

talk_state = 1

else

selfSay('Your pet is alive.')

end

else

selfSay('Your pet is standing next to you.')

end

talk_start = os.clock()

end

if msgcontains(msg, 'yes') and focus == cid and talk_state == 1 then

if doPlayerRemoveMoney(cid, getPlayerLevel(cid)*costPerLevel) == 1 then

setPlayerStorageValue(cid, storages.petIsOnline, 1)

selfSay('You can now summon again your pet.')

else

selfSay('You don\'t have enought money.')

end

talk_state = 0

talk_start = os.clock()

end

 

if msgcontains(msg, 'bye') then

selfSay('Good bye!')

focus = 0

talk_start = 0

talk_state = 0

end

end

end

 

 

function onCreatureChangeOutfit(creature)

 

end

 

 

function onThink()

 

doNpcSetCreatureFocus(focus)

if (os.clock() - talk_start) > 30 then

if focus > 0 then

selfSay('Next Please...')

end

focus = 0

talk_state = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

talk_state = 0

selfSay('Good bye then.')

talk_state = 0

focus = 0

end

end

end

 

 

 

Qndo eu falo com o npc ele nao me responde :X

 

e da esse Erro q vc vai ver na SS

post-162379-1241285624_thumb.jpg

Editado por cagaio
Link para o comentário
Compartilhar em outros sites

que non sense, eu não sei o sistema de pet que você usa, não sei como ele funciona e muito menos tenho o script do npc aqui, quer que eu faço o que? -.-

Link para o comentário
Compartilhar em outros sites

Você posto na seção errada, post em pedidos de scripts ou dúvidas de script.

 

Voce ja deveria saber disso sendo uma pessoa que ja usa bastante o xtibia.

Editado por Darkanso
Link para o comentário
Compartilhar em outros sites

ae, agora dá para ajudar.

 

o que ocorre no seu distro é que não existe mais a função getDistanceToCreature(), este script de NPC não a sintaxe que o TFS atualmente usa.

 

todos seus NPCs são assim ou somente esse? (digo a sintaxe, se a maioria é Jiddo (padrão) ou assim)

 

Se for somente esse, eu posso fazer um update neste e deixá-lo com sistema Jiddo, caso contrário, poste outro NPC aqui para mim dar uma olhada como foi feito nessa função.

 

ps: poste o arquivo petConfig.lua junto também

Editado por noobinhu
Link para o comentário
Compartilhar em outros sites

Vlw mais Tipo assim eu consigeui "arruma o pet Trocano todo o systema de npc colocando od no systema jiddo mas agora eles nao falam o npc chanel e nem trade e tals onde eu vo p arrumar isso ?

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...