Ir para conteúdo

My Quinto Aporte :d


jhon44370

Posts Recomendados

well this npc I hope they serve is made by me: D have to accommodate some things but I think they will serve for now

 

tu server//data//npc//scripts:

 

local focus = 0

local talk_start = 0

local target = 0

local following = false

local attacking = false

local addon_state = 0

 

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('Olá ' .. getCreatureName(cid) .. '... Eu daria tudo por alguns Leaves... Você tem 50 sobrando aí?!')

focus = cid

talk_start = os.clock()

 

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

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

 

elseif focus == cid then

talk_start = os.clock()

if msgcontains(msg, 'Leaves') or msgcontains(msg, 'Leaf Stone') then

if doPlayerRemoveItem(cid,2111,50) == 0 then

selfSay('Eu disse 50 Leaves!')

addon_state = 0

else

selfSay('Obrigado, muito mesmo! Tome, isto pode ser útil para você!')

doPlayerAddItem(cid, 5918, 1)

talk_start = 0

end

 

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Good bye, ' .. getCreatureName(cid) .. '! Come back soon..')

focus = 0

talk_start = 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

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good bye then.')

focus = 0

end

end

end

 

it copies the name of leaf stone

 

then we go to npc and copy a file. lua and we put the name of Changer

in place

 

<?xml version="1.0"?>

 

<npc name="Changer" script="data/npc/scripts/leaf stone.lua" access="3" lookdir="1" autowalk="200" speed="200">

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

<look type="159" head="38" body="79" legs="107" feet="114"/>

</npc>

 

and lsita already have the npc that changes us by 50 leaves 1 leaf stone:)

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...