Witajcie. Jestem dopiero pocz?tkuj?cym skrypterem, wi?c nie bijcie, bo wiem, ?e to zapewne bardzo proste.
A wi?c stworzy?em NPC, kt?ry gdy do niego powiemy 'plotki' powie nam co? ciekawego, ale chcia?em zrobi?, ?e je?li LVL naszej postaci jest wi?kszy od np. 40 to m?wi co innego, jednak mi to nie wysz?o.
Tutaj podaje skrypt:
Mo?ecie mi pom?c?
A wi?c stworzy?em NPC, kt?ry gdy do niego powiemy 'plotki' powie nam co? ciekawego, ale chcia?em zrobi?, ?e je?li LVL naszej postaci jest wi?kszy od np. 40 to m?wi co innego, jednak mi to nie wysz?o.
Tutaj podaje skrypt:
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('Do widzenia!')
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, 'witaj') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Witaj, ' .. creatureGetName(cid) .. '! Co moge dla ciebie zrobic? Chcialbys poznac jakies ciekawe plotki?')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'witaj') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Przepraszam, ' .. creatureGetName(cid) .. '! Jestem zajety, przyjdz za chwilke.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'plotki') and getPlayerLevel(cid) <= 40 then
selfSay('Slyszalem, ze na szczycie ktorejs wiezy w swiatyni znajduje sie jakis cenny przedmiot. Sprawdz to, jesli chcesz.')
elseif msgcontains(msg, 'plotki') and getPlayerLevel(cid) >= 40 then
selfSay('Niestety, nie mam Ci nic waznego do powiedzenia.')
focus = cid
elseif msgcontains(msg, 'zegnaj') and getDistanceToCreature(cid) < 4 then
selfSay('Zegnaj, ' .. 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('A ty co tak stoisz i sie gapisz?')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Do widzenia, przyjacielu!')
focus = 0
end
end
end