- Dołączył
- Październik 31, 2008
- Posty
- 41
- Liczba reakcji
- 4
witam przedstawiam wam 2 prezydatne npc
Gary-Sprzedaje Kolorowe Backpack
skrypt:
colorbackpack.lua:
Gary.xml
skrypt:
NPC Folly-sprzedaje lifefluids i manafluids
Folly.lua
skrypt:
Folly.xml
skrypt:
Gary-Sprzedaje Kolorowe Backpack
skrypt:
colorbackpack.lua:
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 ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello, ' .. creatureGetName(cid) .. 'I sell blue backpack(40gp),red backpack(40gp),Orange backpack(40gp),pink backpack(40gp),green backpack(40gp) and yellow backpack(40gp). ')
focus = cid
talk_start = os.clock()
end
if string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Leave us alone, ' .. creatureGetName(cid) .. '!')
end
if msgcontains(msg, 'blue backpack') and focus == cid then
buy(cid,2380,1,40)
talk_start = os.clock()
end
if msgcontains(msg, 'red backpack') and focus == cid then
buy(cid,2386,1,40)
talk_start = os.clock()
end
if msgcontains(msg, 'orange backpack') and focus == cid then
buy(cid,2385,1,40)
talk_start = os.clock()
end
if msgcontains(msg, 'pink backapck') and focus == cid then
buy(cid,2384,1,40)
talk_start = os.clock()
end
if msgcontains(msg, 'green backapck') and focus == cid then
buy(cid,2384,1,40)
talk_start = os.clock()
end
if msgcontains(msg, 'yellow backpack) and focus == cid then
buy(cid,2384,1,40)
talk_start = os.clock()
end
if msgcontains(msg, 'quest') and focus == cid then
talk_start = os.clock()
queststatus = getPlayerStorageValue(cid,5019)
if queststatus == -1 then
selfSay('When I was leaving my ship, I hide priceless artifact in one of the barrels. You could bring it to me.')
else
selfSay('Bloody adventurers, always looking for trouble!')
end
end
if msgcontains(msg, 'ship') and focus == cid then
selfSay('My ship is on the desert. It doesn\'t look well but still can sail. Of course if you know how to steer it.')
talk_start = os.clock()
end
if msgcontains(msg, 'steer') and focus == cid then
talk_start = os.clock()
queststatus = getPlayerStorageValue(cid,5019)
if queststatus == -1 then
selfSay('If you want to learn steering, bring me artifact from the ship.')
else
selfSay('You know everything I do.')
end
end
if msgcontains(msg, 'artifact') and focus == cid then
talk_start = os.clock()
queststatus = getPlayerStorageValue(cid,5019)
if queststatus == -1 then
itemstatus = doPlayerRemoveItem(cid,2342)
if itemstatus == -1 then
selfSay('It\'s in one of the barrels. Look under the deck.')
else
setPlayerStorageValue(cid,5019,1)
selfSay('Thank you! To steer a ship, just use a steering wheel.')
end
else
selfSay('This helmet belongs to me.')
end
end
if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 4 then
selfSay('Good bye , ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
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('Good bye then.')
focus = 0
end
end
end
skrypt:
Kod:
<?xml version="1.0"?>
<npc name="Davide" script="data/npc/scripts/itembuy.lua" access="3">
<look type="128" head="24" body="77" legs="10" feet="20"/>
</npc>
NPC Folly-sprzedaje lifefluids i manafluids
Folly.lua
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('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('Hello ' .. creatureGetName(cid) .. '! I sell lifefluids(60gp) and manafluids(100gp).')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
end
if msgcontains(msg, 'lifefluids') and focus == cid then
buy(cid,2006,10,60)
talk_start = os.clock()
end
if msgcontains(msg, 'manafluids') and focus == cid then
buy(cid,2006,7,100)
talk_start = os.clock()
elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. 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('Good bye then.')
focus = 0
end
end
end
skrypt:
Kod:
<?xml version="1.0"?>
<npc name="Folly" script="data/npc/scripts/folly.lua" access="3">
<look type="130" head="0" body="97" legs="76" feet="0"/>
</npc>
Ostatnio edytowane przez moderatora:

