Gohans
Advanced User
- Joined
- May 16, 2008
- Messages
- 198
- Reaction score
- 15
Witam!
Je?li macie do?? kapitan?w na statkach, lub tych go?ci co teleportuj? i wolicie do ka?dego miasta wstawi? chocia? po JEDEN NPC kt?ry teleportuje do ka?dego miasta (Opr?cz tego kt?ry si? znajduje obok miasta na PACC i Rooka)
Zaczynajmy!!
W data\npc tworzymy Bananek.xml a w nim:
Potem w data\npc\scripts tworzymy teleport.lua a w nim:
Skrypt sprawdzony dzia?a mam nadzieje ?e si? przyda ;]
Je?li macie do?? kapitan?w na statkach, lub tych go?ci co teleportuj? i wolicie do ka?dego miasta wstawi? chocia? po JEDEN NPC kt?ry teleportuje do ka?dego miasta (Opr?cz tego kt?ry si? znajduje obok miasta na PACC i Rooka)
Zaczynajmy!!
W data\npc tworzymy Bananek.xml a w nim:
<?xml version="1.0"?>
<npc name="Bananek" script="data/npc/scripts/teleport.lua" autowalk="25">
<health now="40" max="40"/>
<look type="134" head="95" body="57" legs="113" feet="115"/>
</npc>
Potem w data\npc\scripts tworzymy teleport.lua a w nim:
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('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
if isPremium(cid) then
selfSay('Elo ' .. getCreatureName(cid) .. '! Mog? ci? przenie?? do:, Anshara, Inferna, Venore, pacc or Folda.(70gp everywhere)')
focus = cid
talk_start = os.clock()
else
selfSay('Sorry, only premium players can travel by boat.')
focus = 0
talk_start = 0
end
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'anshara') then
if pay(cid,50) then
travel(cid, 400, 481, 6)
selfSay('Let\'s go!')
focus = 0
talk_start = 0
else
selfSay('jestes splukany ziomus.')
end
elseif msgcontains(msg, 'karmia') then
if pay(cid,50) then
travel(cid, 453, 480, 6)
selfSay('Let\'s go!')
focus = 0
talk_start = 0
else
selfSay('jestes splukany ziomus.')
end
elseif msgcontains(msg, 'inferna') then
if pay(cid,50) then
travel(cid, 517, 439, 6)
selfSay('Let\'s go!')
focus = 0
talk_start = 0
else
selfSay('jestes splukany ziomus.')
end
elseif msgcontains(msg, 'venore') then
if pay(cid,50) then
travel(cid, 431, 421, 6)
selfSay('Let\'s go!')
focus = 0
talk_start = 0
else
selfSay('jestes splukany ziomus.')
end
elseif msgcontains(msg, 'folda') then
if pay(cid,50) then
travel(cid, 267, 317, 6)
selfSay('Let\'s go!')
focus = 0
talk_start = 0
else
selfSay('jestes splukany ziomus.')
end
elseif msgcontains(msg, 'pacc') then
if pay(cid,50) then
travel(cid, 430, 624, 7)
selfSay('Let\'s go!')
focus = 0
talk_start = 0
else
selfSay('jestes splukany ziomus.')
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('NO to pa, ' .. getCreatureName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if focus > 0 then
x, y, z = creatureGetPosition(focus)
myx, myy, myz = selfGetPosition()
if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then
selfTurn(1)
end
if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then
selfTurn(3)
end
if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then
selfTurn(2)
end
if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then
selfTurn(0)
end
if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(2)
end
if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(0)
end
if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(3)
end
if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(1)
end
if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(2)
end
if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(0)
end
if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(3)
end
if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(1)
end
if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(2)
end
if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(0)
end
if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(3)
end
if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(1)
end
end
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 sprawdzony dzia?a mam nadzieje ?e si? przyda ;]