• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[XML] 8.1 NPC Pomozcie z przerobieniem

Status
Not open for further replies.

Koci1994

Banned User
Joined
Dec 27, 2008
Messages
807
Reaction score
1
Siema.
Mam taki problem mam starego NPC z 8.1 i chciałbym go przerobić, żeby działa na TFS 0.3.5 . Pomoże mi ktoś ??
Oto ten NPC:
Jacek.xml
<?xml version="1.0"?>

<npc name="Jacek" script="data/npc/scripts/jacek.lua" access="1" lookdir="2" autowalk="25">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="151" head="77" body="108" legs="86" feet="0" addons="3"/>
</npc>
jacek.lua
Code:
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
  		selfSay('Witaj ' .. getCreatureName(cid) .. '! Moge udzielic ci wskazowek dotyczacych questow. Powiedz "wskazowki".')
  		focus = cid
  		talk_start = os.clock()

  	elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
  		selfSay('Przepraszam, ' .. getCreatureName(cid) .. '! Wlasnie rozmawiamy...')

  	elseif focus == cid then
		talk_start = os.clock()

	if msgcontains(msg, 'wskazowki') then
             selfSay('Chcesz uzyskac wskazowki dotyczace "strange rooms","death tower" czy "temple of time"?')
        elseif msgcontains(msg, 'strange rooms') then
             selfSay('Slyszalem, ze istnieja pomieszczenia, gdzie normalni ludzie dostawali obledu i nigdy nie wracali, lecz po rozwiazaniu zagadki czeka nagroda. Wejscie znajduje sie w starej kaplicy na poludnie od Enigmy.')
        elseif msgcontains(msg, 'death tower') then
             selfSay('Plotki glosza, ze na poludniowy-zachod od Grit Town jest wieza maga, u szczytu trzyma on swe skarby. Niestety, nie moge tego potwierdzic, bo kazdy kto sie tam zblizyl, juz nigdy nie powrocil.') 
        elseif msgcontains(msg, 'quest') then
             selfSay('Oh, jestes pewien, ze chcesz podjac to "wyzwanie"?.') 
        elseif msgcontains(msg, 'wyzwanie') then
             selfSay('Dobrze wiec. Moj przyjaciel Charlie wybral sie kilka dni temu na wyspe Demigod i już nie powrocil. Chcialbym, zebys go odnalazl.')
        elseif msgcontains(msg, 'broken amulet') then
             selfSay('O nie! To byl jego ulubiony amulet.. Przykro mi, ze Charlie nie zyje. Zatrzymaj jego amulet, zdaje sie, ze Soya bylaby nim zainteresowana.')
elseif msgcontains(msg, 'temple of time') then
             selfSay('Nie wiem zbyt wiele na ten temat, ale mozesz o to spytac maga Daroona. On sie na tym zna.') 

          






		elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
			selfSay('Zegnaj, ' .. creatureGetName(cid) .. '!')
			focus = 0
			talk_start = 0
		end
       end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
  	if (os.clock() - talk_start) > 15 then
  		if focus > 0 then
  			selfSay('Kiedys zdobede je wszytkie...')
  		end
  			focus = 0
  	end
 	if focus ~= 0 then
 		if getDistanceToCreature(focus) > 3 then
 			selfSay('Powodzenia!')
 			focus = 0
 		end
 	end
end
Nie chodzi mi o to, żeby ktoś to za mnie zrobił . Tylko żeby my powiedział jak to się robi.
 
Last edited:
Napisz do beatshif lub DomosNew, on robi NPC kompatybilne z najnowszymi TFS.
 
Mam jeszcze taki problem (może ktoś będzie wiedział jak to naprawić):
elseif msgcontains(msg, 'tak') and talk_state == 2 then
talk_state = 0
if doPlayerRemoveMoney(cid,10000) == 1 then
if doPlayerRemoveItem(cid,2160, 1) == TRUE then
local elvenamulet = doPlayerAddItem(cid,2198,1)
doSetItemActionId(elvenamulet,666)
setPlayerStorageValue(cid, 20000, 1)
Powinno to zabierać 1cc i dawać w zamian elven amulet o action id 666.
Proszę o pomoc.
 
Mam jeszcze taki problem (może ktoś będzie wiedział jak to naprawić):

Powinno to zabierać 1cc i dawać w zamian elven amulet o action id 666.
Proszę o pomoc.

Wywal if doPlayerRemoveMoney~ (teraz zabierasz 10k + 1cc).
 
Nie działa :
Code:
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('Zegnaj wiec!')
          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('Witaj ' .. getCreatureName(cid) .. '! Chcesz "cos" ode mnie kupic? Mam chyba przedmiot, ktory moze cie zainteresowac...')
  		focus = cid
  		talk_start = os.clock()

  	elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
  		selfSay('Przepraszam, ' .. getCreatureName(cid) .. '! Wlasnie rozmawiamy...')

  	elseif focus == cid then
		talk_start = os.clock()

	if msgcontains(msg, 'cos') then
             selfSay('Ta rzecz to specjalny "elven amulet". Slyszalem, ze dzieki niemu mozna przywolac Lorda Vampirow.')
             talk_state = 1
        elseif msgcontains(msg, 'elven amulet') and talk_state == 1 then
			if getPlayerItemCount(cid,2160) >= 1 then
				selfSay('Moge sprzedac ci go za 20 000 sztuk zlota. To cenna rzecz. Godzisz sie na to?')
				talk_state = 2
			else
				selfSay('Wygladasz na biedaka. Odejdz.')
				talk_state = 0
			end
        elseif msgcontains(msg, 'tak') and talk_state == 2 then
			talk_state = 0
			 if doPlayerRemoveMoney(cid,10000) == 1 then
			if doPlayerRemoveItem(cid,2160, 1) == TRUE then
           		local elvenamulet = doPlayerAddItem(cid,2198,1)
          		doSetItemActionId(elvenamulet,666)
				setPlayerStorageValue(cid, 20000, 1)
                        selfSay('Prosze. Przed wyprawa zaopatrz sie w inne amulety. Wydaje mi sie, ze posiadaja je Undin i Soel.')
			end
			else
				selfSay(havent_item)
			end
        elseif msgcontains(msg, 'aygiaykgfaog') then
             selfSay('Nie mow tego wiecej!') 

          






		elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
			selfSay('Zegnaj, ' .. creatureGetName(cid) .. '!')
			focus = 0
			talk_start = 0
		end
       end



function onCreatureChangeOutfit(creature)

end


function onThink()
  	if (os.clock() - talk_start) > 15 then
  		if focus > 0 then
  			selfSay('Trzymaj sie!')
  		end
  			focus = 0
  	end
 	if focus ~= 0 then
 		if getDistanceToCreature(focus) > 3 then
 			selfSay('Zegnaj!')
 			focus = 0
 		end
 	end
end
end
 
Last edited:
Code:
elseif msgcontains(msg, 'tak') and talk_state == 2 then
			talk_state = 0
			 if doPlayerRemoveMoney(cid,10000) == TRUE then
           		local elvenamulet = doPlayerAddItem(cid,2198,1)
          		doSetItemActionId(elvenamulet,666)
				setPlayerStorageValue(cid, 20000, 1)

To powinno być OK, pokazują się jakieś błędy w konsoli?
 
Dzięki idę testować.
Po prostu zabierało cc a nei dawało Elvena (konsola czytsa) i zamiast powiedziec
Flatron: Prosze. Przed wyprawa zaopatrz sie w inne amulety. Wydaje mi sie, ze posiadaja je Undin i Soel
mówił
Jak zrobiłem to co napisałeś to mi się end-y nie zgadzają.
iz0qxw.jpg

Już mi działa musiałem usunąć jedno end .
 
Last edited:
Już sobie poradziłem. Usunąłem jeden end :)
Ale mam jeszcze jeden problem . Gdy odejdę od NPC bez pożegnania(bye) to on mi sam tego nie mówi i nie przerywa rozmowy. Dopiero po wylogowaniu mogę ponownie z nim rozmawiać.
Skrypt:
Code:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false


function onCreatureDisappear(cid, pos)
  	if focus == cid then
          selfSay('Zegnaj i do zobaczenia!')
          focus = 0
          talk_start = 0
  	end
end

	
function onCreatureSay(cid, type, msg)
  	msg = string.lower(msg)
	
	
if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then
	selfSay('Witaj w naszej skromnej siedzibie '..getCreatureName(cid)..'! Odkryles tajne "wejscie"?.')
	focus = cid
	talk_start = os.clock()

	
  	elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
  		selfSay('Przepraszam, ' .. getCreatureName(cid) .. '! Wlasnie rozmawiamy...')

  	elseif focus == cid then
		talk_start = os.clock()

	if msgcontains(msg, 'wejscie') then
             selfSay('Tak, jak sie spodziewalem. Tylko jedna droga prowadzi tutaj... Chcialbys moze "obalic krola"?')
        elseif msgcontains(msg, 'obalic krola') then
             selfSay('Tak, wlasnie tak. Pewnie juz slyszales pogloski o naszej wspolpracy z "Grit Town"...')
        elseif msgcontains(msg, 'grit town') then
             selfSay('General Sanyo z Grit potrzebuje tajnego raportu wojskowego. Czy jestes w stanie odzyskac ten "raport"?.') 
        elseif msgcontains(msg, 'raport') then
             selfSay('Swietnie. Wedlug naszych informacji znajduje sie on w ukrytej bibliotece krola. Moge Ci powiedziec "jak tam dojsc".') 
        elseif msgcontains(msg, 'jak tam dojsc') then
             selfSay('Sluchaj uwaznie. Biblioteke otwiera przelacznik ukryty w malej jaskini pod zamkiem. Niestety droge do tej jaskini blokuje wielki "kamien".')
        elseif msgcontains(msg, 'kamien') then
             selfSay('Znalezlismy sposob jego usuniecia. Przeszukaj dokladnie tutejsze "podziemia".')
elseif msgcontains(msg, 'podziemia') then
             selfSay('Nie pamietam dokladnie jak usuwa sie ten glaz. Cos, pozostaje mi tylko zyczyc Ci powodzenia. Razem obalimy krola!.') 

          






		elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
			selfSay('Zegnaj, ' .. getCreatureName(cid) .. '!')
			focus = 0
			talk_start = 0
		end
       end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
  	if (os.clock() - talk_start) > 15 then
  		if focus > 0 then
  			selfSay('Przeklety krol...')
  		end
  			focus = 0
  	end
 	if focus ~= 0 then
 		if getDistanceToCreature(focus) > 2 then
 			selfSay('Precz z krolem!')
 			focus = 0
 		end
		end
		end
 
Last edited:
Status
Not open for further replies.
Back
Top