Alfons II
Stały Gość
Dołączył: 17 Lis 2005
Posty: 59
Przeczytał: 0 tematów
Ostrzeżeń: 1/10
Skąd: KRAKÓW !!!
|
Npc Sprzedający Ringi w YourOts
Chciałbym wam zaprezentowac moje dzielo npc sprzedajacy ringi Very Happy
1. Najpierw wpisujemy w notatniku takie cos :
<?xml version="1.0"?>
<npc name="RingNoob" script="data/npc/scripts/ring.lua" acces="1" lookdir="3">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="134" head="2" body="95" legs="60" feet="132"/>
</npc>
Zapisujemy to jako RingNoob.xml
i wklejamy to do folderu data\npc
2 wchodzimy w folder scripts w folderze \data\npc\scripts
i w notatniku wpisujemy takie cos :
-- Npc RingNoob by Eddyxon --
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) < 3 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I sell power rings, time rings, sword rings, axe rings, club rings, energy ring and might ring .')
focus = cid
talk_start = os.clock()
elseif string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 3 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.') elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'power ring') then
buy(cid,2988,1,10000)
elseif msgcontains(msg, 'time ring') then
buy(cid,2991,1,10000)
elseif msgcontains(msg, 'sword ring') then
buy(cid,3029,1,10000)
elseif msgcontains(msg, 'axe ring') then
buy(cid,3030,1,10000)
elseif msgcontains(msg, 'club ring') then
buy(cid,3031,1,10000)
elseif msgcontains(msg, 'energy ring') then
buy(cid,2989,1,10000)
elseif msgcontains(msg, 'might ring') then
buy(cid,2986,1,10000)
elseif msgcontains(msg, 'rings') then
selfSay('I sell power (10k), time (10k), axe (10k), sword (10k), club (10k), energy (10k), and might (10k) .')
elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 3 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
end
Post został pochwalony 0 razy
|