#1 2008-02-24 11:36:30

Rah Vook

http://img170.imageshack.us/img170/1838/moderatorcq9.png

7186578
Skąd: Exiva "Me
Zarejestrowany: 2008-02-24
Posty: 26
Punktów :   

!NPC sprzedajacy blessy!

Witam!Zaprezentuje teraz skrypt na NPC sprzedajacego blessy(blogoslawienstwa):
Na poczatku w data/npc/scripts tworzymy plik o nazwie blessings.lua
Wklejamy do niego:

Spoiler:

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:

Spoiler:

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

NPC przeedytowany przez:Vook ; )

Offline

 

Stopka forum

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


Darmowe Forum | Ciekawe Fora | Darmowe Fora
piosenka o psie www.zoomaniak.pl