Centrum Ots

Forum Poświęcone OTS

  • Nie jesteś zalogowany.
  • Polecamy: Komputery

Ogłoszenie

°Witaj Na Forum !!°
ZAPRASZAMY DO REJESTRACJI!

#1 2008-07-29 14:27:03

wieczny

http://www.opentibia.grupy-dyskusyjne.pl/images/ranks/999_moderator.png

Zarejestrowany: 2008-07-20
Posty: 38
Punktów :   -2 

8.0+ NPC sprzedający Blessy!

Spoiler:

Kod:

local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
      if focus == cid then
          selfSay('Pa.')
          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('Witaj ' .. getCreatureName(cid) .. ' Sprzedaje "5 blesow" 1 kosztuje 10.000.')
          focus = cid
          talk_start = os.clock()

      elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
          selfSay('Przepraszam, ' .. getCreatureName(cid) .. '! ale rozmawiam z kims.')

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

    elseif msgcontains(msg, '5 Blesow') then
                 if pay(cid,10000) then
            selfSay('Dodalem Ci blessy.')
            doPlayerAddBlessing(cid, 5)
                 else 
            selfSay('Sorry, you do not have enough gold')
            bless_state = 0
        end
       end
end


function onCreatureChangeOutfit(creature)

end

function onThink()

if (os.clock() - talk_start) > 30 then
          if focus > 0 then
              selfSay('Nastepny Prosze')
          end
              focus = 0
      end
    if focus ~= 0 then
        if getDistanceToCreature(focus) > 5 then
            selfSay('Pa.')
            focus = 0
        end
    end
end

A potem w data/npc tworzymy plik o nazwie : Banor the blessed

Potem wklejamy do niego:

Kod:

Spoiler:

Kod:

<npc name="Banor the blessed" script="data/npc/scripts/blessings.lua" autowalk="25" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="129" head="114" body="119" legs="114" feet="114" corpse="2212"/>

<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell the five blessings (10k each), for each just say first bless, second bless, etc..." />
</parameters>
</npc>

Mam Nadzieje Że Pomogłem:P

Ostatnio edytowany przez wieczny (2008-07-29 15:01:54)

Offline

 

Stopka forum

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

[ Generated in 0.064 seconds, 10 queries executed ]


Darmowe Forum | Ciekawe Fora | Darmowe Fora
www.zimlublin.pun.pl www.antymugole.pun.pl www.slodkiflirtrpg.pun.pl www.bolecairsoft.pun.pl www.narwancy-team.pun.pl