TNET
English French German Spain Italian Dutch Russian Portuguese Japanese Korean Arabic Chinese Simplified

Wróć   Tibia.net.pl > OpenTibia > Skrypty - pozostałe > Pomoc

Odpowiedz


 
22-07-10, 11:19  
serwisps2
Czeladnik
 
Użytkownik serwisps2 na Tibia.net.pl

an npc request


Hello im from other country.
I need an NPC who can learn us a spells from skills!
TFS 0.3.5pl1

NPC:
Cytat:
Vocations id: 1,2,3,4,5,51,87.
If you aren't this vocation npc say: "Sorry you cannot learn these skills!"
If you aren't get required level or skill npc say: "Back, when you are stronger!"


If you say : spells npc show you list of these:

Spells to learn:
- Utamo vita - 15 lvl, 35 club fighting
- Utevo lux - 30 lvl, 50 club fighting
- Exura gran - 40 lvl, 65 club fighting
- Utani gran hur - 90 lvl, 75 club fighting
- Exevo gran mas frigo - 100 lvl, 100 club fighting
- Exevo frigo hur - 110 lvl, 110 club fighting
WARNING ! If you got enough Club fighting and learn spells NPC not REMOVE required club to learn spells !


Can you do it ?
 
Linki sponsorowane
Adwert
Informator
Grasz?

22-07-10, 12:19  
Miziak
Przodownik
 
Użytkownik Miziak na Tibia.net.pl

Odp: an npc request


Hi,
I'm write this script but is not tested.

Kod:
local spells, voc = {
					{name="utamo vita", lvl=15, club=35, xml="Magic Shield"},
					{name="utevo lux", lvl=30, club=50, xml="Light"},
					{name="exura gran", lvl=40, club=65, xml="Intense Healing"},
					{name="utani gran hur", lvl=90, club=75, xml="Strong Haste"},
					{name="exevo gran mas frigo", lvl=100, club=100, xml="Eternal Winter"},
					{name="exevo frigo hur", lvl=110, club=110, xml="Ice Wave"},
					--etc
					}, {1,2,3,4,5,51,87}
local function isVocation(cid, voc)
	for _,v in pairs(voc) do
		if(getPlayerVocation(cid) == v)then
			return true
		end
	end
return false
end
local function loadSpellsList(spells)
local out, str = "", ""
	for i,_ in pairs(spells) do
		local v = spells[i]
		out = out .. v.name .. "(lvl "..v.lvl.."; club "..v.club.."),\n"
	end
	str = out:sub(1, out:len()-2) .. "."
return str
end
local focuses = {}
local talkStates = {}
local function isFocused(cid)
	for i, v in pairs(focuses) do
		if(v == cid) then
			return true
		end
	end
	return false
end
local function addFocus(cid)
	if(not isFocused(cid)) then
		table.insert(focuses, cid)
	end
end
local function removeFocus(cid)
	for i, v in pairs(focuses) do
		if(v == cid) then
			table.remove(focuses, i)
			break
		end
	end
end
local function lookAtFocus()
	for i, v in pairs(focuses) do
		if(isPlayer(v)) then
			doNpcSetCreatureFocus(v)
			return
		end
	end
	doNpcSetCreatureFocus(0)
end
local function isTalkState(cid)
	for _, v in pairs(talkStates) do
		if(v[1] == cid) then
			return true
		end
	end
	return false
end
local function setTalkState(cid, state)
	if(not isTalkState(cid)) then
		table.insert(talkStates, {cid, state})
	else
		for _, v in pairs(talkStates) do
			if(v[1] == cid) then
				v[2] = state
				break
			end
		end
	end
end
local function removeTalkState(cid)
	for i, v in pairs(talkStates) do
		if(v[1] == cid) then
			table.remove(talkStates, i)
			break
		end
	end
end
local function getTalkState(cid)
	for _, v in pairs(talkStates) do
		if(v[1] == cid) then
			return v[2]
		end
	end
	return 0
end
function onCreatureAppear(cid)
end
function onCreatureDisappear(cid)
	if(isFocused(cid)) then
		selfSay("Hmph!")
		removeFocus(cid)
		if(isPlayer(cid)) then --Be sure he's online
			closeShopWindow(cid)
		end
	end
end
function onCreatureSay(cid, type, msg)
	if((msg == "hi") and not (isFocused(cid))) then
		selfSay("Welcome, ".. getCreatureName(cid) ..".", cid, true)
		selfSay("I'm lern {spells} if you have skills and level!", cid)
		addFocus(cid)
	elseif((isFocused(cid)) and (msg == "spell" or msg == "spells")) then
		selfSay("I lern:\n"..loadSpellsList(spells), cid)
		setTalkState(cid, 1)
	elseif(isFocused(cid) and getTalkState(cid) == 1 and (msg ~= "" or msg ~= " "))then
		for _,v in pairs(spells) do
			if(v.name == msg)then
				if(isVocation(cid, voc))then
					if(v.lvl >= getPlayerLevel(cid) and v.club >= getPlayerSkillLevel(cid, SKILL_CLUB))then
						doPlayerLearnInstantSpell(cid, v.xml)
						selfSay("You learned " .. v.xml .. ".", cid)
						doSendMagicEffect(getCreaturePosition(cid), 12)
						break
					else
						selfSay("Back, when you are stronger!", cid)
						break
					end
				else
					selfSay("Sorry you cannot learn these skills!", cid)
					break
				end
			end
		end
	elseif((isFocused(cid)) and (msg == "bye" or msg == "goodbye" or msg == "cya")) then
		selfSay("Goodbye!", cid, true)
		removeFocus(cid)
	end
end
function onPlayerCloseChannel(cid)
	if(isFocused(cid)) then
		selfSay("Hmph!")
		removeFocus(cid)
	end
end
function onPlayerEndTrade(cid)
	selfSay("It was a pleasure doing business with you.", cid)
end
function onThink()
	for i, focus in pairs(focuses) do
		if(not isCreature(focus)) then
			removeFocus(focus)
		else
			local distance = getDistanceTo(focus) or -1
			if((distance > 4) or (distance == -1)) then
				selfSay("Hmph!")
				removeFocus(focus)
			end
		end
	end
	lookAtFocus()
end
Yours(Pozdrawiam),
Miziak
 


7 do setki

Odpowiedz

Narzędzia tematu
Wygląd


Podobne wątki
Wątek Autor wątku Forum Odpowiedzi Ostatni post / autor
Tibia 8.41 Request
Witam!! Poszukuje real mapy do mojego ots 8.41 razem z npc oraz yalahara poi inq anhi itp. Jakby mogl ktos podrzucic bylbym wdzieczny. Link podac...
Okinahs Request 1 09-04-09 22:51
[x.x][Request]KOŃ
Witam mam pytanie można zrobić konia do tibi zęby można było na nim jeździć ?:D czekam na odp...
linke1990 Kosz 12 07-02-09 12:32

Tibia.net.pl: Pomoc (Miejsce na pomoc w utworzeniu skryptu.)
Temat: an npc request Hello im from other country. I need an NPC who [...]


Przeróbka skryptu - Scootyy (1) 06-09-10 22:21 Zły exp - Dj Matis (1) 02-09-10 15:25 teleport zmieniający voc - master sraster (6) 01-09-10 17:47 NPC nauczyciel - master sraster (2) 03-09-10 14:56 Problem z acc makerem by Gesior 0.3.6 - spychar (0) 31-08-10 22:15


Czas w strefie GMT +2. Teraz jest 04:00.




Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.3.0 © 2009, Crawlability, Inc.
Tibia.net.pl 2007-2010