graphic
graphic
Forum OTS 7.92 Pepsi Strona Główna » Skrypty do OTS » [7.8+][Npc] Pirate Zlomiarz..
graphic
Napisz nowy temat   Odpowiedz do tematu
graphic

graphic graphic
Yoda Temat postu: [7.8+][Npc] Pirate Zlomiarz..


Administrator
Dołączył: 01 Mar 2007
Posty: 46
Przeczytał: 0 tematów

Pomógł: 1 raz
Ostrzeżeń: 0/100

Miedzy innym ten skrypt to npc kupujacy rozne rzeczy z piratów..

w data/npc script robimy zlomiarz.lau i wklejamy to :

Kod:
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('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('Ahoj ' .. creatureGetName(cid) .. '! Skupuje loot z piratów.')
        focus = cid
        talk_start = os.clock()

   elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
        selfSay('Zamknij sie, ' .. creatureGetName(cid) .. '! Rozmawiam...')     elseif focus == cid then
      talk_start = os.clock()      if msgcontains(msg, 'short sword') then
           sell(cid,2406,1,10)
      elseif msgcontains(msg, 'sword') then
           sell(cid,2376,1,30)
        elseif msgcontains(msg, 'bone club') then
           sell(cid,2449,1,50)
        elseif msgcontains(msg, 'chain armor') then
           sell(cid,2462,1,200)
        elseif msgcontains(msg, 'spear') then
           sell(cid,2389,1,10)
        elseif msgcontains(msg, 'treasure map') then
           sell(cid,5706,1,90000)
        elseif msgcontains(msg, 'goldfish bowl') then
           sell(cid,5928,1,6000)
        elseif msgcontains(msg, 'peg leg') then
           sell(cid,6126,1,100000)
      elseif msgcontains(msg, 'hook') then
           sell(cid,6097,1,80000)
        elseif msgcontains(msg, 'bandana') and focus == cid then
           sell(cid,5917,1,9999)
        elseif msgcontains(msg, 'eye patch') and focus == cid then
           sell(cid,6098,1,100000)
      elseif msgcontains(msg, 'pirate knee berches') or msgcontains(msg, 'pkb') then
           sell(cid,5918,1,10000)
        elseif msgcontains(msg, 'scale armor') then
           sell(cid,2483,1,666)
      elseif msgcontains(msg, 'steel shield') then
           sell(cid,2509,1,99)
      elseif msgcontains(msg, 'spike sword') then
           sell(cid,2383,1,1000)
      elseif msgcontains(msg, 'battle shield') then
           sell(cid,2513,1,300)
      elseif msgcontains(msg, 'plate armor') or msgcontains(msg, 'p armor') then
           sell(cid,2463,1,500)
      elseif msgcontains(msg, 'plate legs') or msgcontains(msg, 'p legs') then
           sell(cid,2647,1,1000)
      elseif msgcontains(msg, 'pirate shirt') then
           sell(cid,6095,1,5000)
      elseif msgcontains(msg, 'dark shield') then
           sell(cid,2521,1,400)
      elseif msgcontains(msg, 'pirate hat') then
           sell(cid,6096,1,20000)
      elseif msgcontains(msg, 'brutus bloodbeards hat') then
           sell(cid,6099,1,100000)
        elseif msgcontains(msg, 'piggy bank')  then
           selfSay('Zglos sie z tym go GMa')
      elseif msgcontains(msg, 'lethal lissys shirt') or msgcontains(msg, 'lethal lissy\'s shirt') then
           sell(cid,6100,1,100000)

        elseif string.find(msg, '(%a*)bye(%a*)')  and getDistanceToCreature(cid) < 4 then
           selfSay('Ahoj, ' .. creatureGetName(cid) .. '!')
           focus = 0
           talk_start = 0
        end
     end
end


function onCreatureChangeOutfit(creature)

end


function onThink()

if focus > 0 then
 x, y, z = creatureGetPosition(focus)
 myx, myy, myz = selfGetPosition()
 if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then
       selfTurn(0)
 end
 if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then
       selfTurn(2)
 end
       if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then
       selfTurn(1)
 end
 if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then
       selfTurn(3)
 end
 if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then
       selfTurn(1)
 end
 if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then
        selfTurn(3)
 end
 if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then
        selfTurn(2)
 end
 if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then
        selfTurn(0)
 end
 if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then
        selfTurn(1)
 end
 if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then
        selfTurn(3)
 end
 if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then
        selfTurn(2)
 end
 if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then
        selfTurn(0)
 end
 if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then
        selfTurn(1)
 end
 if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then
        selfTurn(3)
 end
 if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then
        selfTurn(2)
 end
 if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then
        selfTurn(0)
 end
end

     if (os.clock() - talk_start) > 30 then
        if focus > 0 then
           selfSay('A\'choj z toba... nastepny...')
        end
           focus = 0
     end
    if focus ~= 0 then
       if getDistanceToCreature(focus) > 5 then
          selfSay('Ahoy.')
          focus = 0
       end
    end
end



Nastepnie w data/npc robimy Pirate Zlomiarz.xml i wklejamy to :



Kod:
<?xml version="1.0"?>
<npc name="Pirate Zlomiarz" script="data/npc/scripts/zlomiarz.lua" access="3">
    <look type="96" head="76" body="114" legs="124" feet="86" addon="3" know="3"/>
</npc>
PostWysłany:Sob 16:06, 24 Mar 2007

Post został pochwalony 0 razy
graphic
Zobacz profil autora Top of page
graphic

graphic
Napisz nowy temat   Odpowiedz do tematu
graphic
Forum OTS 7.92 Pepsi Strona Główna » Skrypty do OTS
graphic
   
graphic

graphic graphic
Wyświetl posty z ostatnich:   
Skocz do:  
Zobacz poprzedni temat :: Zobacz następny temat


Strona 1 z 1
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
graphic graphic


fora.pl - załóż własne forum dyskusyjne za darmo
KDM2 template v1.0.1 © jasidog.com
Powered by phpBB © 2001, 2002 phpBB Group
Obecny czas to Wto 16:42, 23 Kwi 2024. Wszystkie czasy w strefie EET (Europa)
Regulamin