Skarbnica OTS

Wszystko Do Twojego Ots'a :)


  • Index
  •  » Skrypty
  •  » [8.1][npc] Npc Telemportujący na wyspe

#1 01-05-2008 18:25:04

mikier

Administrator

Zarejestrowany: 02-03-2008
Posty: 12
Punktów :   

[8.1][npc] Npc Telemportujący na wyspe

Witam mam dla was do zaoferowania npc co przenosi na rozne wyspy powiem wam jak to robić i sie nauczycie
UWAGA jak sie niema pacca npc nie teleportuje ;/

wchodzmy w Npc i tworzymy nowy plik XML o nazwie Nimral a wnim w klejamy:

Kod:

<?xml version="1.0"?>

<npc name="Captain Nimral" script="data/npc/scripts/Teleport.lua" autowalk="25">
	<health now="40" max="40"/>
	<look type="133" head="114" body="119" legs="132" feet="114"/>
</npc>

Dalej w chodzmy w npc /script tworzymi plik lua Teleport (lub teleportacja jak tam chcecie)

wklejamy to :

Kod:

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('Hello ' .. getCreatureName(cid) .. '!I can take you to Folda, Vega, or Senya.(Cost 100gp everywhere)')
			focus = cid
			talk_start = os.clock()
		else
			selfSay('Sorry, only premium players can fly on Carpet.')
			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, 'folda') then
			if pay(cid,50) then
			    selfSay('Let\'s go!')
				travel(cid,388, 400, 7 )
				focus = 0
				talk_start = 0
			else
				selfSay('Sorry, you don\'t have enough money.')
			end

		elseif msgcontains(msg, 'vega') then
			if pay(cid,50) then
			    selfSay('Let\'s go!')
				travel(cid, 369, 509, 7)
				focus = 0
				talk_start = 0
			else
				selfSay('Sorry, you don\'t have enough money.')
			end

		elseif msgcontains(msg, 'senya') then
			if pay(cid,50) then
			    selfSay('Let\'s go!')
				travel(cid, 468, 486, 7)
				focus = 0
				talk_start = 0
			else
				selfSay('Sorry, you don\'t have enough money.')
			end

		elseif msgcontains(msg, 'tibia') then
			if pay(cid,0) then
			    selfSay('Let\'s go!')
				travel(cid,578, 494, 7 )
				focus = 0
				talk_start = 0
			else
				selfSay('Sorry, you don\'t have enough money.')
			end				
	
		elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
			selfSay('Good bye, ' .. 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

Tak gdzie są miasto np

Kod:

	if msgcontains(msg, 'folda') then
			if pay(cid,50) then
			    selfSay('Let\'s go!')
				travel(cid,388, 400, 7 )
				focus = 0
				talk_start = 0
			else
				selfSay('Sorry, you don\'t have enough money.

To Trzeba zmienić Gdzie cie teleportuje I Co trzeba Powiedzieć żeby nas teleportowało I za ile pieniedzy


http://www.ubar.pl/www/img_14800_normal.gif
http://www.ubar.pl/www/img_14611_normal.gif

Offline

 
  • Index
  •  » Skrypty
  •  » [8.1][npc] Npc Telemportujący na wyspe

Stopka forum

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


Darmowe Forum | Ciekawe Fora | Darmowe Fora
www.narutozone.pun.pl www.otservers.pun.pl www.bakugan-adventures.pun.pl www.firataleague.pun.pl www.siostry-hallywell.pun.pl