Open Tibia Server

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


#1 2008-12-24 22:47:59

Michal

Administrator

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

Bankier

Wchodzimy w data/npc

Tworzymy notatnik
Wpisujemy w nim :

<?xml version="1.0"?>
<npc name="Bankier" script="data/npc/scripts/change.lua" access="3">
    <look type="128" head="20" body="30" legs="40" feet="50"/>
</npc>

Zapisujemy jako Bankier.xml


Przechodzimy następnie w
data/npc/scripts

Tworzymy notatnik
Wpisujemy w nim :

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('Narka.')
          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('Czesc ' .. creatureGetName(cid) .. '! Zamienie twoja kase. Napisz "help" by otrzymac wiecej informacji')
          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 minutke.')

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

        if msgcontains(msg, 'change platin 1') then
            buy(cid,2148,100,100)
        elseif msgcontains(msg, 'change platin 2') then
            buy(cid,2148,200,200)
        elseif msgcontains(msg, 'change platin 5') then
            buy(cid,2148,500,500)
        elseif msgcontains(msg, 'change platin 10') then
            buy(cid,2148,1000,1000)
        elseif msgcontains(msg, 'change platin 20') then
            buy(cid,2148,2000,2000)
        elseif msgcontains(msg, 'change crystal 1') then
            buy(cid,2152,100,1000)
        elseif msgcontains(msg, 'change crystal 2') then
            buy(cid,2152,200,2000)
        elseif msgcontains(msg, 'change crystal 5') then
            buy(cid,2152,500,50000)
        elseif msgcontains(msg, 'change crystal 10') then
            buy(cid,2152,1000,100000)
        elseif msgcontains(msg, 'change crystal 20') then
            buy(cid,2152,2000,200000)

        elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
            selfSay('Narka, ' .. 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('Dowidzenia.')
            focus = 0
        end
    end
end

Zapisujemy jako change.lua

Następnie przechodzimy w data/world

Edytujemy plik Npc.xml

i dodajemy pod:
<npclist>


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

Niebieski = Położenie Bankier - gdzie bankier 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
here kancelaria ultimatum weekend w Ciechocinku