Open Tibia Server

Forum Zostalo Stworzone By Pomagać Ludzią W Grze Tibia Ots


#1 2008-12-24 23:05:54

Michal

Administrator

Zarejestrowany: 2008-12-24
Posty: 51
Punktów :   

Npc Sprzedający Outfit Elfa

Wchodzimy w data/npc

Tworzymy notatnik
Wpisujemy w nim:

<?xml version="1.0"?>
<npc name="Old Elf" script="data/npc/scripts/elf outfit.lua" access="3">
    <look type="63" head="113" body="120" legs="114" feet="132"/>
</npc>

Zapisujemy jako Old Elf.xml

Przechodzimy w data/npc/scripts
Robimy notatnik i wpisujemy:

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('Nara Ziomal!')
          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('Siema ' .. creatureGetName(cid) .. ' !Sprzedaje Elf Outfit(60cc).')
          focus = cid
          talk_start = os.clock()

      elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
          selfSay('Przepraszam, ' .. creatureGetName(cid) .. 'Napisze do ciebie za minute.')

    elseif focus == cid then
        talk_start = os.clock()


        if msgcontains(msg, 'elf outfit') then
            buy(cid,2280,1,600000)

        elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 5 then
            selfSay('Dowdzenia!, ' .. 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('Nastepny...')
          end
              focus = 0
      end
    if focus ~= 0 then
        if getDistanceToCreature(focus) > 3 then
            selfSay('Nara!')
            focus = 0
        end
    end
end

Zapisujemy jako elf outfit.lua

Następnie przechodzimy w data/world

Edytujemy plik Npc.xml

i dodajemy pod:
<npclist>

<npc name="Old Elf" x="xxx" y="xxx" z="x" dir="2"/>

Niebieski = Położenie Old Elfa - gdzie Old Elf ma się znajdować

Offline

 

Stopka forum

RSS
Powered by PunBB
© Copyright 2002–2008 PunBB
Polityka cookies - Wersja Lo-Fi


Darmowe Forum | Ciekawe Fora | Darmowe Fora
kancelaria ultimatum weekend w Ciechocinku