NPC na zam?wienie.

Status
Zamknięty.
Odp: NPC na zam?wienie.

#up
Z pewno?ci? jest jaki? spos?b by rozwi?za? to zadanie, ale nie mog? znale?? funkcji odpowiadaj?cej za sprawdzanie storage w plikach XML, a nawet je?li nie tam si? to robi to w pliku LUA te? nie wiem jak zrobi?, gdy? jak wiadomo napisanie:
PHP:
if msgcontains(msg, 'hi') then
Nic nam nie da. Je?li znasz odpowied? to podziel si? z ni? ze mn?.
A ja znam odpowied? na to pytanie: proste, u?yj innego systemu npc ;P
Ja nie mam nic ci??kiego, a nawet tylko robot? na jakie? pi?? minut. Potrzebuje NPC pod TFS 0.3.6 ma dzia?a? na zasadzie, je?li napisz hi to pierwszym razem odpowie "elo elo co tam", a je?li ju? kiedy? rozmawiali?my to napisze na przywitanie "co tam u ciebie |PLAYERNAME|".
A tak by wygl?da? taki NPCek:
PHP:
<?xml version="1.0"?>
<npc name="Ruby" floorchange="0" walkinterval="4000"  script="ruby.lua">
	<health now="150" max="150"/>
	<look type="133" head="20" body="120" legs="75" feet="13"/>
  <interaction range="3" idletime="30">
    <interact keywords="hi" focus="1">
      <keywords>hello</keywords>
      <response>
        <action name="script">
        <![CDATA[
          if(getPlayerStorageValue(cid, 4726)) == 0 then
            selfSay("Hello. What is your name?", cid)
			doPlayerSetStorageValue(cid, 4726, 1)
          elseif(getPlayerStorageValue(cid, 4726)) == 1 then
            selfSay("Hello |NAME|!", cid)
          end
        ]]>
        </action>
      </response>
    </interact>
    <interact keywords="bye" focus="0">
      <keywords>farewell</keywords>
      <response text="Goodbye, |NAME|.">
        <!--
        <action name="script">
          doRemoveCreature(getNpcCid());
        </action>
        -->
      </response>
    </interact>
  </interaction>
</npc>
 
Ostatnia edycja:
Odp: NPC na zam?wienie.

Wi?c chcia?bym zam?wi? sobie NPC-a pod Tibi? 8.54 TFS 0.3.6.
Powinien on w zale?no?ci od danego mu itemu zwraca? nam inny.Tylko prosi?bym o to aby by?o 6 r??nych itemk?w.Id podaj oboj?tne tylko ?eby si? da?o pozmienia? s?owa i id.
Rozmowa powinna wygl?da? np tak:
P:Hi
NPC:Hello [playername].I can repair your equipment or make new one.
P:Broken sword
NPC: I can repair it in a while.Do you want me to repair your sword??
P:Yes
i wtedy zabiera nam broken a daje zwyk?y.Tylko ?e chce ?eby by?o 6 r??nych tych wymian dlatego prosz? o ?atw? konfiguracje.
 
Odp: NPC na zam?wienie.

PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)            npcHandler:onCreatureDisappear(cid)            end
function onCreatureSay(cid, type, msg)            npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()                    npcHandler:onThink()                    end
function say(param)
            npcHandler:say(param.text,param.cid)
         end
    function delayedSay(text, delay, cid)
    if(not npcHandler:isFocused(cid)) then
                return FALSE
     else
         local param = {cid = cid, text = text}
            local delay = delay or 0
            addEvent(say, delay, param)
        end
    end
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
end
local config = {
				[1] = {co_trza_mowic = "broken sword", co_trza_miec = 2234, ile_tego = 1, co_dostaniemy = 2376},
				[2] = {co_trza_mowic = "broken halberd", co_trza_miec = 11329, ile_tego = 1, co_dostaniemy = 11317},
				[3] = {co_trza_mowic = "broken slicer", co_trza_miec = 11733, ile_tego = 1, co_dostaniemy = 11732}
				}
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
for i = 1, #config do
	if msgcontains(msg, config[i].co_trza_mowic) then
		selfSay("I can repair it in a while. Do you want me to repair your "..config[i].co_trza_mowic.."??", cid)
		talkState[talkUser] = 1	
	elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
		if getPlayerItemCount(cid, config[i].co_trza_miec) >= config[i].ile_tego then
			selfSay("Here you are, your new "..getItemNameById(config[i].co_dostaniemy)..".", cid)
			doPlayerRemoveItem(cid, config[i].co_trza_miec, config[i].ile_tego)
			doPlayerAddItem(cid, config[i].co_dostaniemy)
		end
	end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Masz tutaj przyk?ad trzech item?w, je?li nie wiesz jak pododawa? nowe to napisz.
 
Odp: NPC na zam?wienie.

Wi?c potrzebuje NPC na 8.42
Opis: NPC Daje zadanie zabicia potworka np. Demona. Na podr?? daje nam 100 UH. Je?eli zabijemy go, p?acimy NPCtowi 100 cc i dostajemy tuta. Tego Questa mo?e wykona? tylko dwie osoby na serwerze. Do tego sprzedaje same UHy.
Oto co sie pisze
Gracz: Hi
NPC: Siema Wedrowco (playername). Sprzedaje runy UH.
Gracz: quest
NPC: Hmm... Mam jednego questa na Tutora. Chcesz go poznac?
Gracz: yes
NPC: na gorze Senion ?yje gro?ne demon. Pokonaj do a dostaniesz Tutora. Uwa?aj jego uderzenia sa mocna. Masz 100 UH. Przydadza Ci sie.
Gracz: bya
NPC: Powodzenia

Je?eli gracz ju? wykona? ten quest

Gracz: hi
NPC: Siema Wedrowco (playername). Sprzedaje runy UH.
Gracz: quest
NPC: Ju? wykona?e? tego Questa!

Je?eli ju? 2 osoby na serverze wykona?y tego questa to:

Gracz: Hi
NPC: Siema Wedrowco (playername). Sprzedaje runy UH.
Gracz: quest
NPC: Inni gracz Cie ju? wyprzedzili. Groza na gorze Senion zostala pokonana.


Po zabiciu potworka:

Gracz; Hi
NPC: Uda?o Ci si?. Daj mi 100 cc i masz tuta.

Daje mu 100 cc i daje nam tuta


My?l? ?e uda Ci si? to zrobi?
Powodzenia i z g?ry dzi?ki.

PS. 51 Post :lol:
 
Odp: NPC na zam?wienie.

Plik NPC:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)            npcHandler:onCreatureDisappear(cid)            end
function onCreatureSay(cid, type, msg)            npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()                    npcHandler:onThink()                    end
function say(param)
            npcHandler:say(param.text,param.cid)
         end
    function delayedSay(text, delay, cid)
    if(not npcHandler:isFocused(cid)) then
                return FALSE
     else
         local param = {cid = cid, text = text}
            local delay = delay or 0
            addEvent(say, delay, param)
        end
    end
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
end
local storage = 11111
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, "quest") then
	if isInArray({-1,0}, getGlobalStorageValue(storage)) then
		if getPlayerStorageValue(cid, storage) == -1 then
			selfSay("Hmm... Mam jednego questa na Tutora. Chcesz go poznac?", cid)
			talkState[talkUser] = 1
		elseif getPlayerStorageValue(cid, storage) == 0 then
			selfSay("Gdy zabijesz {demona} wroc do mnie.", cid)
		elseif getPlayerStorageValue(cid, storage) == 1 then
			if getPlayerItemCount(cid, 2160) >= 100 then
				selfSay("Udalo Ci sie. Daj mi 100 cc i masz tuta.", cid)
				doPlayerRemoveItem(cid, 2160, 100)
				doPlayerSetGroupId(cid, 2)
					if getGlobalStorageValue(storage) == -1 then
						setGlobalStorageValue(storage, 0)
					elseif getGlobalStorageValue(storage) == 0 then
						setGlobalStorageValue(storage, 1)
					end
			else
				selfSay("Nie masz 100 cc.", cid)
			end
		else
			selfSay("Juz wykonales tego Questa!", cid)
		end
	else
		selfSay("Inni gracze Cie juz wyprzedzili. Groza na gorze Senion zostala pokonana.", cid)
	end
elseif msgcontains(msg, "yes") then
	if talkState[talkUser] == 1 then
		selfSay("Na gorze {Senion} zyje grozny demon. Pokonaj do a dostaniesz {Tutora}. Uwazaj jego uderzenia sa mocne. Masz 100 UH. Przydadza Ci sie.", cid)
		doPlayerAddItem(cid, 2273, 100)
		setPlayerStorageValue(cid, storage, 0)
	end	
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Oraz creaturescripts:
PHP:
function onKill(cid, target)
local config = {	
	["demon"] = {storage = 11110, begin_storage_value = 0, finished_storage_value = 1, count = 1}
				}
local mob = config[string.lower(getCreatureName(target))]
if(not mob) then
return true
end
local main_storage = 11111
	if(isPlayer(target) ~= TRUE) then
		local killedMonsters = getPlayerStorageValue(cid, mob.storage)
			if(killedMonsters == -1) then
					killedMonsters = 1
			end
		if getPlayerStorageValue(cid, main_storage) == mob.begin_storage_value then
			setPlayerStorageValue(cid, mob.storage, killedMonsters + 1)
				if killedMonsters == mob.count then 
					setPlayerStorageValue(cid, main_storage, mob.finished_storage_value)
				end
		end
end
	return true
end
PHP:
<event type="kill" name="test" event="script" value="test.lua"/>
A do login.lua:
PHP:
registerCreatureEvent(cid, "test")
 
Odp: NPC na zam?wienie.

To ja tez co? zam?wi?, chcia?bym NPC kt?ry sprzedaje nam addony..

first addon - x gp
second addon - x gp

Sam ustawie ilo??, tylko ma to by? tak :

Gracz : Hi
NPC : Witaj [playername] sprzedaje wszystkie addony, jeden addon kosztuje x gp

Gracz : przyk?ad (buy first pirate addon)
NPC : ile? gp

Gracz : przyk?ad (buy second pite addon)
NPC : ile? gp

I ?eby tak by?o z ka?dym addonem..
Z g?ry dzi?kuje
 
Odp: NPC na zam?wienie.

Teraz ja o co? poprosze. Chcia?bym ?eby? zrobi? mi wz?r NPC kt?rego bede sobie potem edytowa?.
Tibia: 8.55
Silnik: TFS

Gracz: Hi
NPC: Witak. Napisz praca albo koniec jak ja wykona?es.
Gracz: praca
NPC: Przynies mi 50 iron ore i 100 royal steel i wro? do mnie.

Gracz: koniec
NPC: Dziekuje oto twoja zap?ata.

I czy da sie tak zrobi? ?eby t? prace mo?na wykonywac tylko na jakis danych lvl. Ze sprawdza jak gracz ma lvl i "if" ma 10 15 lub 20 lvl to pisze to co napisa?em wy?ej a jak mamy inny lvl to pisze wr?? tu kiedy zdobedziesz wi?cej doswiadczenia.
 
Odp: NPC na zam?wienie.

Oskar, sorry, ?e nie na temat ale znalaz?em co?:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) 			npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) 	npcHandler:onCreatureSay(cid, type, msg) end
function onThink() 						npcHandler:onThink() end

function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and not npcHandler:isFocused(cid) then
		if getCreatureHealth(cid) < 65 then
			npcHandler:say("Hello, "..getCreatureName(cid).."! You are looking really bad. Let me heal your wounds.", cid)
			doCreatureAddHealth(cid, 65 - getCreatureHealth(cid))
			doSendMagicEffect(getCreaturePosition(cid), 12)
		else
			selfSay("Hello, "..getCreatureName(cid).."! I'll {heal} you if you are badly injured or poisoned. Feel free to ask me for {help} or general {hints}.", cid, TRUE)
			npcHandler:addFocus(cid)
		end
		return true
	end
	if(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
		selfSay("Farewell, " .. getCreatureName(cid) .. "!", cid, TRUE)
		npcHandler:releaseFocus(cid)
	elseif msgcontains(msg, "heal") then
		if getCreatureCondition(cid, CONDITION_FIRE) == TRUE then
			npcHandler:say("You are burning. I will help you.", cid)
			doRemoveCondition(cid, CONDITION_FIRE)
			doSendMagicEffect(getCreaturePosition(cid), 14)
		elseif getCreatureCondition(cid, CONDITION_POISON) == TRUE then
			npcHandler:say("You are poisoned. I will help you.", cid)
			doRemoveCondition(cid, CONDITION_POISON)
			doSendMagicEffect(getCreaturePosition(cid), 13)
		elseif getCreatureHealth(cid) < 65 then
			npcHandler:say("You are looking really bad. Let me heal your wounds.", cid)
			doCreatureAddHealth(cid, 65 - getCreatureHealth(cid))
			doSendMagicEffect(getCreaturePosition(cid), 12)
		else
			npcHandler:say("You aren't looking really bad, " .. getCreatureName(cid) .. ". I only help in cases of real emergencies. Raise your health simply by eating {food}.", cid)
		end
	end
	return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Well, bye then.")
Mo?e b?dzie dzia?a?? Chodzi mi o te "hi" :P
 
Odp: NPC na zam?wienie.

Witam ,potrzebuje skryptu na npc. M.in gdy np. rozmawiam z npc to nie musze pisac np. "Travel" u takiego dimrala tylko napisac "1" a to bedzie jako "travel" lub gdy napisze travel i wyskocza miasta do ktorych mozna plynac to zeby bylo tak

{1}-Rhyves
{2}-Varak itp. Umiesz tak ? Bo widzialem na wielu ots'ach to :/
 
Odp: NPC na zam?wienie.

PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)            npcHandler:onCreatureDisappear(cid)            end
function onCreatureSay(cid, type, msg)            npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()                    npcHandler:onThink()                    end
function say(param)
            npcHandler:say(param.text,param.cid)
         end
    function delayedSay(text, delay, cid)
    if(not npcHandler:isFocused(cid)) then
                return FALSE
     else
         local param = {cid = cid, text = text}
            local delay = delay or 0
            addEvent(say, delay, param)
        end
    end
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, "travel") or msgcontains(msg, "1") then
	selfSay("{1} - Rhyves,", cid)
	selfSay("{2} - Varak,", cid)
	selfSay("{3} - Miasto,", cid)
	selfSay("{4} - ...,", cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Odp: NPC na zam?wienie.

Tak wiec ja chcialbym NPC Changer [wygladalby jak 7 full meskich outfitow: nightmare, jester, citizen, warmaster, knight, shaman, mage. Oczywiscie zmienialby co jakis czas (szybko) Kolory to zielono biale.

Ten NPC Changer zmienialby plec i zamienialby nas do czasu logout.
Wiec to jest NPC na tibie. 8.54 tfs 0.3.6

Wiec rozmowa bedzie nastepujaca:
Kod:
>HI
<What do you want from me? 
>Change Sex
<Do you want to change sex for 5 crystal coins?
>Yes
<Ok, bye!

To jest wersja ang.
A polska

Kod:
>Witaj / Siemka / Jol / Czesc / Witam
<Ooo! Jak milo Cie widzie [nick gracza]! Co Cie sprowadza do mnie?
>zmiana plci
<Az tak ci zle ze soba? No coz... Chcesz zmienic plec za 5 krysztalowych monet?
>Tak
<Prosze bardzo!

NPC Dodatkowo zmienia outfity graczy do czasu gdy sie wylogujemy rozmowa

Kod:
>Hi
<Hello [nick] What do you want from me?
>change outfit
<Are you serious? 
>Yes
<So, your outfit is changed.
>Bye

To jest wersja angielska

Kod:
> Siemka / Witaj/ Jol / Witam / Czesc
< Ooo! Jak milo Cie widzie [nick gracza]! Co Cie sprowadza do mnie?
>zmiana outfitu
<Ale zabawne! Chcesz naprawde zmienic swoj stroj? Wygladasz przeciez ekhe... yy.. no ladnie!
>Tak
<BANG! Prosze Bardzo! Zniknie jak sie wylogujesz! 
<Bye

NPC, jak odpowiada na gracza YES wytwarza efekt Green Shrimmer (czy jak to sie pisze) na graczu i przystepuje do zmian. Ws zmiany plci to oczywiste, ze zmieni plec na przeciwna, a w sprawie zmiany outfitu to potwory w jakie bedzie zmienial to:

-Juggernaut
-Demon
-Blightwalker
-Betrayed Wrath
-Mutated Pumpkin
-Ghost
-Minotaur Guard
-Ghul
-Ice Overlord
-Earth Overlord
-Fire Overlord
-Energy Overlord
-Hydra
-Draken Spellweaver
-Lizardy nowe
-Draken Warmaster
-Cyclop Smith
-Cyclop Drone
-War Golem
-Defiler
-Azerus
-Wailing Widow
-Wisp
-Beholder
-Mutated Bat
-Chakoya Tribewarden
-Orc Marauder

Wsio :)
 
Ostatnia edycja:
Odp: NPC na zam?wienie.

@edit
ju? sobie z tym poradzi?em.
Teraz potrzebuje npc kt?ry rozmawia tylko z wybran? profesj?.
 
Ostatnia edycja:
Odp: NPC na zam?wienie.

PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)            npcHandler:onCreatureDisappear(cid)            end
function onCreatureSay(cid, type, msg)            npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()                    npcHandler:onThink()                    end
function say(param)
            npcHandler:say(param.text,param.cid)
         end
    function delayedSay(text, delay, cid)
    if(not npcHandler:isFocused(cid)) then
                return FALSE
     else
         local param = {cid = cid, text = text}
            local delay = delay or 0
            addEvent(say, delay, param)
        end
    end
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
end
local pos = getCreaturePosition(cid)
local mob = {"juggernaut", "demon", "blightwalker", "betrayed wrath", "mutated pumpkin", "ghost", "ice overlord", "earth overlord", "fire overlord", "energy overlord", "hydra", "draken spellweaver", "draken warmaster", "lizard hight guard", "lizard chosen", "lizard dragon priest", "lizard legionnaire", "lizard zaogun", "cyclops smith", "cyclops drone", "war golem", "defiler", "azerus", "wailing widow", "wisp", "beholder", "mutated rat", "chakoya tribewarden", "orc marauder"}
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, "change sex") then
	selfSay("Do you want to change sex for 5 crystal coins?", cid)
	talkState[talkUser] = 1
elseif msgcontains(msg, "change outfit") then
	selfSay("Are you serious?", cid)
	talkState[talkUser] = 2
elseif msgcontains(msg, "yes") then
	if talkState[talkUser] == 1 then
		if getPlayerItemCount(cid, 2160) >= 5 then
			if getPlayerSex(cid) == 0 then
				doPlayerSetSex(cid, 1)
			elseif getPlayerSex(cid) == 1 then
				doPlayerSetSex(cid, 0)
			end
		selfSay("Ok, bye!", cid)
		doPlayerRemoveItem(cid, 2160, 5)
		else
			selfSay("You don't have enough money!", cid)
		end
	elseif talkState[talkUser] == 2 then
		selfSay("So, your outfit is changed.", cid)
		doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN)
		doSetMonsterOutfit(cid, mob[math.random(1, #mob)], 100*100*100*1000)
	end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Plik XML sam dasz rad? zrobi?.
Masz tutaj tylko wersj? angielsk?. Sam nie wiem po co dodawa?e? polsk?, ale mniejsza.

#up
Je?li chcesz by NPC rozmawia? tylko z dan? profesj? musisz da? taki warunek:
PHP:
if isInArray({id profesji, np 1,2,3,4}, getPlayerVocation(cid)) then
 
Odp: NPC na zam?wienie.

t? funkcje dodaje si? do lua rozumiem?
i w jakim miejscu?
Og?lnie skrypt wygl?da tak:
Kod:
------STORAGE-------
------100 do 104-------
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local item1 = 5921
local item2 = 2194
local item3 = 2087
local item4 = 2692
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'equipment')) then
selfSay('If you need better equipment, check this old weapon rack, armor rack and chest. Maybe you will find something interesting', cid)
end
if(msgcontains(msg, 'spells')) then
selfSay('As you reach higher level, you can use better spells. You can check your spells in magic spellbook.', cid)
end
if(msgcontains(msg, 'experience')) then
selfSay('Check castle undergrounds. There are a lot of Rats! I think you can kill this plague. Check this out!', cid)
end
if(msgcontains(msg, 'job')) then
selfSay('Well... you are newbie now, but i can give you chance to gain some experience. I have five jobs to you: {Ruthless Murderer}, {Cave Hunter}, and a {Fearless Hunter}.', cid)
end
---------------------------------------------------------
if(msgcontains(msg, 'ruthless murderer')) then
selfSay('We have plague of rats in our castle undergrounds! They are eats all supplies! Do something! Bring me {heaven blossoms} and you will get your reward.', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'heaven blossoms') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,100) > 0) then
selfSay('Finally, you have done your mission. Now ask me about {outfit}', cid)
else
if(doPlayerRemoveItem(cid, item1, 20) == TRUE) then
setPlayerStorageValue(cid,100,1)
doPlayerAddExperience(cid,1500)
doPlayerAddItem(cid, 2491, 1)
selfSay('Thank you for help! You are now more experienced', cid)
else
selfSay('Sorry man, i need 20 heaven blossoms to trust you!', cid)
end
end
return true
end
----------------------------------------------------------
if(msgcontains(msg, 'cave hunter')) then
selfSay('There are rumors about strange monster called {Munster}. Probably he have mysterious fetish! Go to castle undergrounds and kill em!', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'munster') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,100) < 1) then
selfSay('Just bring me mysterious fetish', cid)
else
if (getPlayerStorageValue(cid,101) > 0) then
selfSay('You have done this mission. If you are interested, you can do knight {outfit}', cid)
else
if(doPlayerRemoveItem(cid, item2, 1) == TRUE) then
setPlayerStorageValue(cid,101,1)
doPlayerAddExperience(cid,3000)
doPlayerAddItem(cid, 7730, 1)
selfSay('Thank you! You are now more experienced!', cid)
else
selfSay('I need one mysterious fetish!', cid)
end
end
end
return true
end
----------------------------------------------------------
if(msgcontains(msg, 'fearless hunter')) then
selfSay('Take this key and go to basement, and check a chest. There you got your reward. But remember: Come back here and put a {report}.', cid)
doPlayerAddItem(cid, 2087, 1)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'report') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,101) < 1) then
selfSay('Just set a {report}!', cid)
else
if (getPlayerStorageValue(cid,102) > 0) then
selfSay('You have passed this mission. If you are interested, ask me about {outfit}', cid)
else
if(doPlayerRemoveItem(cid, item3, 1) == TRUE) then
setPlayerStorageValue(cid,102,1)
doPlayerAddExperience(cid,7000, 1, 1)
selfSay('Finally! Im gonna pay you fifty thousands for addtional reward.', cid)
else
selfSay('I need a report...', cid)
end
end
end
return true
end
----------------------------------------------------------
if(msgcontains(msg, 'outfit')) then
selfSay('If you wanna gain my outfit, bring {mastermind shield} and optional {magic plate armor} for some addons to Terry.', cid)
selfSay('This both items can you loot from strange and powerful Demons.', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'gddsdgfbsghghs') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,101) < 1) then
selfSay('Just set a {report}!', cid)
else
if (getPlayerStorageValue(cid,102) > 0) then
selfSay('You have passed this mission. If you are interested, ask me about {outfit}', cid)
else
if(doPlayerRemoveItem(cid, item3, 1) == TRUE) then
setPlayerStorageValue(cid,102,1)
doPlayerAddExperience(cid,7000, 1, 1)
selfSay('Finally! Im gonna pay you fifty thousands for addtional reward.', cid)
else
selfSay('I need a report...', cid)
end
end
end
return true
end
----------------------------------------------------------

----------------------------------------------------------
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Czyli jak ma to wygl?da? aby npc rozmawia? tylko z knightem?
I jeszcze potrzebuje doda? do tego npc co? takiego, ?e je?li player powie s?owo Mastermind Shield to zabiera mu mms i dodaje outfit i pierwszy addon Nightmare knight, a je?li powie Magic Plate Armor, to zabiera mu mpa i dodaje drugi addon nightmare knights.
 
Odp: NPC na zam?wienie.

PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)            npcHandler:onCreatureDisappear(cid)            end
function onCreatureSay(cid, type, msg)            npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()                    npcHandler:onThink()                    end
function say(param)
            npcHandler:say(param.text,param.cid)
         end
    function delayedSay(text, delay, cid)
    if(not npcHandler:isFocused(cid)) then
                return FALSE
     else
         local param = {cid = cid, text = text}
            local delay = delay or 0
            addEvent(say, delay, param)
        end
    end
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
end
local pos = getCreaturePosition(cid)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local item1 = 5921
local item2 = 2194
local item3 = 2087
local item4 = 2692
if isInArray({4,8}, getPlayerVocation(cid)) then
	if(msgcontains(msg, 'equipment')) then
		selfSay('If you need better equipment, check this old weapon rack, armor rack and chest. Maybe you will find something interesting', cid)
	elseif(msgcontains(msg, 'spells')) then
		selfSay('As you reach higher level, you can use better spells. You can check your spells in magic spellbook.', cid)
	elseif(msgcontains(msg, 'experience')) then
		selfSay('Check castle undergrounds. There are a lot of Rats! I think you can kill this plague. Check this out!', cid)
	elseif(msgcontains(msg, 'job')) then
		selfSay('Well... you are newbie now, but i can give you chance to gain some experience. I have five jobs to you: {Ruthless Murderer}, {Cave Hunter}, and a {Fearless Hunter}.', cid)
	elseif(msgcontains(msg, 'ruthless murderer')) then
		selfSay('We have plague of rats in our castle undergrounds! They are eats all supplies! Do something! Bring me {heaven blossoms} and you will get your reward.', cid)
		talkState[talkUser] = 1
	elseif(msgcontains(msg, 'heaven blossoms') and talkState[talkUser] == 1) then
		if (getPlayerStorageValue(cid, 100) > 0) then
			selfSay('Finally, you have done your mission. Now ask me about {outfit}', cid)
		end
		if getPlayerItemCount(cid, item1) >= 20 then
			doPlayerRemoveItem(cid, item1, 20)
			setPlayerStorageValue(cid, 100, 1)
			doPlayerAddExperience(cid, 1500)
			doSendAnimatedText(getPlayerPosition(cid),"1500", TEXTCOLOR_WHITE)
			doPlayerAddItem(cid, 2491, 1)
			selfSay('Thank you for help! You are now more experienced', cid)
		else
			selfSay('Sorry man, i need 20 heaven blossoms to trust you!', cid)
		end
	elseif(msgcontains(msg, 'cave hunter')) then
		selfSay('There are rumors about strange monster called {Munster}. Probably he have mysterious fetish! Go to castle undergrounds and kill em!', cid)
		talkState[talkUser] = 2
	elseif(msgcontains(msg, 'munster') and talkState[talkUser] == 2) then
		if (getPlayerStorageValue(cid,100) < 1) then
			selfSay('Just bring me mysterious fetish', cid)
		elseif (getPlayerStorageValue(cid,101) > 0) then
			selfSay('You have done this mission. If you are interested, you can do knight {outfit}', cid)
		end
		if getPlayerItemCount(cid, item2) >= 1 then
			doPlayerRemoveItem(cid, item2, 1)
			setPlayerStorageValue(cid,101,1)
			doPlayerAddExperience(cid,3000)
			doPlayerAddItem(cid, 7730, 1)
			selfSay('Thank you! You are now more experienced!', cid)
		else
			selfSay('I need one mysterious fetish!', cid)
		end
	elseif(msgcontains(msg, 'fearless hunter')) then
		selfSay('Take this key and go to basement, and check a chest. There you got your reward. But remember: Come back here and put a {report}.', cid)
		doPlayerAddItem(cid, 2087, 1)
		talkState[talkUser] = 3
	elseif(msgcontains(msg, 'report') and talkState[talkUser] == 3) then
		if (getPlayerStorageValue(cid,101) < 1) then
			selfSay('Just set a {report}!', cid)
		elseif (getPlayerStorageValue(cid,102) > 0) then
			selfSay('You have passed this mission. If you are interested, ask me about {outfit}', cid)
		end
		if getPlayerItemCount(cid, item3) >= 1 then
			doPlayerRemoveItem(cid, item3, 1)
			setPlayerStorageValue(cid,102,1)
			doPlayerAddExperience(cid,7000, 1, 1)
			selfSay('Finally! Im gonna pay you fifty thousands for addtional reward.', cid)
		else
			selfSay('I need a report...', cid)
		end
	elseif(msgcontains(msg, 'outfit')) then
		selfSay('If you wanna gain my outfit, bring {mastermind shield} and optional {magic plate armor} for some addons to Terry.', cid)
		delayedSay('This both items can you loot from strange and powerful Demons.', 10000, cid)
		talkState[talkUser] = 4
	elseif(msgcontains(msg, 'gddsdgfbsghghs') and talkState[talkUser] == 4) then
		if (getPlayerStorageValue(cid,101) < 1) then
			selfSay('Just set a {report}!', cid)
		elseif (getPlayerStorageValue(cid,102) > 0) then
			selfSay('You have passed this mission. If you are interested, ask me about {outfit}', cid)
		end
		if getPlayerItemCount(cid, item3) >= 1 then
			doPlayerRemoveItem(cid, item3, 1)
			setPlayerStorageValue(cid,102,1)
			doPlayerAddExperience(cid,7000, 1, 1)
			selfSay('Finally! Im gonna pay you fifty thousands for addtional reward.', cid)
		else
		selfSay('I need a report...', cid)
		end
	elseif(msgcontains(msg, 'mastermind shield') then
		if getPlayerItemCount(cid, 2514) >= 1 then
			doPlayerAddOutfit(cid, 269, 1)
			doPlayerRemoveItem(cid, 2514, 1)
			selfSay('Here you are, first nightmare addon.', cid)
		else
			selfSay('You don\'t have a mastermind shield!', cid)
		end
	elseif(msgcontains(msg, 'magic plate armor') then
		if getPlayerItemCount(cid, 2472) >= 1 then
			doPlayerAddOutfit(cid, 269, 2)
			doPlayerRemoveItem(cid, 2472, 1)
			selfSay('Here you are, second nightmare addon.', cid)
		else
			selfSay('You don\'t have a Magic Plate Armor!', cid)
		end
	end
	end
	end
else
	selfSay('You aren\'t a knight!', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Co? mi end?w za du?o wysz?o... Skryptu nie testowa?em...
 
Ostatnia edycja:
Odp: NPC na zam?wienie.

Kod:
[05/08/2010 23:00:41] [Error - LuaScriptInterface::loadFile] data/npc/scripts/knight.lua:130: '<eof>' expected near 'else'
[05/08/2010 23:00:41] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/knight.lua
[05/08/2010 23:00:41] data/npc/scripts/knight.lua:130: '<eof>' expected near 'else'

By? ma?y b??d, ale poprawi?em i teraz na linii 130 wyst?puje: Unexpected else near <eof> czy cos takiego, a tego za cholere nie potrafie rozwiklac ;/
Kod:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)            npcHandler:onCreatureDisappear(cid)            end
function onCreatureSay(cid, type, msg)            npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()                    npcHandler:onThink()                    end
function say(param)
            npcHandler:say(param.text,param.cid)
         end
    function delayedSay(text, delay, cid)
    if(not npcHandler:isFocused(cid)) then
                return FALSE
     else
         local param = {cid = cid, text = text}
            local delay = delay or 0
            addEvent(say, delay, param)
        end
    end
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
end
local pos = getCreaturePosition(cid)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local item1 = 5921
local item2 = 2194
local item3 = 2087
local item4 = 2692
if isInArray({4,8}, getPlayerVocation(cid)) then
    if(msgcontains(msg, 'equipment')) then
        selfSay('If you need better equipment, check this old weapon rack, armor rack and chest. Maybe you will find something interesting', cid)
    elseif(msgcontains(msg, 'spells')) then
        selfSay('As you reach higher level, you can use better spells. You can check your spells in magic spellbook.', cid)
    elseif(msgcontains(msg, 'experience')) then
        selfSay('Check castle undergrounds. There are a lot of Rats! I think you can kill this plague. Check this out!', cid)
    elseif(msgcontains(msg, 'job')) then
        selfSay('Well... you are newbie now, but i can give you chance to gain some experience. I have five jobs to you: {Ruthless Murderer}, {Cave Hunter}, and a {Fearless Hunter}.', cid)
    elseif(msgcontains(msg, 'ruthless murderer')) then
        selfSay('We have plague of rats in our castle undergrounds! They are eats all supplies! Do something! Bring me {heaven blossoms} and you will get your reward.', cid)
        talkState[talkUser] = 1
    elseif(msgcontains(msg, 'heaven blossoms') and talkState[talkUser] == 1) then
        if (getPlayerStorageValue(cid, 100) > 0) then
            selfSay('Finally, you have done your mission. Now ask me about {outfit}', cid)
        end
        if getPlayerItemCount(cid, item1) >= 20 then
            doPlayerRemoveItem(cid, item1, 20)
            setPlayerStorageValue(cid, 100, 1)
            doPlayerAddExperience(cid, 1500)
            doSendAnimatedText(getPlayerPosition(cid),"1500", TEXTCOLOR_WHITE)
            doPlayerAddItem(cid, 2491, 1)
            selfSay('Thank you for help! You are now more experienced', cid)
        else
            selfSay('Sorry man, i need 20 heaven blossoms to trust you!', cid)
        end
    elseif(msgcontains(msg, 'cave hunter')) then
        selfSay('There are rumors about strange monster called {Munster}. Probably he have mysterious fetish! Go to castle undergrounds and kill em!', cid)
        talkState[talkUser] = 2
    elseif(msgcontains(msg, 'munster') and talkState[talkUser] == 2) then
        if (getPlayerStorageValue(cid,100) < 1) then
            selfSay('Just bring me mysterious fetish', cid)
        elseif (getPlayerStorageValue(cid,101) > 0) then
            selfSay('You have done this mission. If you are interested, you can do knight {outfit}', cid)
        end
        if getPlayerItemCount(cid, item2) >= 1 then
            doPlayerRemoveItem(cid, item2, 1)
            setPlayerStorageValue(cid,101,1)
            doPlayerAddExperience(cid,3000)
            doPlayerAddItem(cid, 7730, 1)
            selfSay('Thank you! You are now more experienced!', cid)
        else
            selfSay('I need one mysterious fetish!', cid)
        end
    elseif(msgcontains(msg, 'fearless hunter')) then
        selfSay('Take this key and go to basement, and check a chest. There you got your reward. But remember: Come back here and put a {report}.', cid)
        doPlayerAddItem(cid, 2087, 1)
        talkState[talkUser] = 3
    elseif(msgcontains(msg, 'report') and talkState[talkUser] == 3) then
        if (getPlayerStorageValue(cid,101) < 1) then
            selfSay('Just set a {report}!', cid)
        elseif (getPlayerStorageValue(cid,102) > 0) then
            selfSay('You have passed this mission. If you are interested, ask me about {outfit}', cid)
        end
        if getPlayerItemCount(cid, item3) >= 1 then
            doPlayerRemoveItem(cid, item3, 1)
            setPlayerStorageValue(cid,102,1)
            doPlayerAddExperience(cid,7000, 1, 1)
            selfSay('Finally! Im gonna pay you fifty thousands for addtional reward.', cid)
        else
            selfSay('I need a report...', cid)
        end
    elseif(msgcontains(msg, 'outfit')) then
        selfSay('If you wanna gain my outfit, bring {mastermind shield} and optional {magic plate armor} for some addons to Terry.', cid)
        delayedSay('This both items can you loot from strange and powerful Demons.', 10000, cid)
        talkState[talkUser] = 4
    elseif(msgcontains(msg, 'gddsdgfbsghghs') and talkState[talkUser] == 4) then
        if (getPlayerStorageValue(cid,101) < 1) then
            selfSay('Just set a {report}!', cid)
        elseif (getPlayerStorageValue(cid,102) > 0) then
            selfSay('You have passed this mission. If you are interested, ask me about {outfit}', cid)
        end
        if getPlayerItemCount(cid, item3) >= 1 then
            doPlayerRemoveItem(cid, item3, 1)
            setPlayerStorageValue(cid,102,1)
            doPlayerAddExperience(cid,7000, 1, 1)
            selfSay('Finally! Im gonna pay you fifty thousands for addtional reward.', cid)
        else
        selfSay('I need a report...', cid)
        end
    elseif(msgcontains(msg, 'mastermind shield')) then
        if getPlayerItemCount(cid, 2514) >= 1 then
            doPlayerAddOutfit(cid, 269, 1)
            doPlayerRemoveItem(cid, 2514, 1)
            selfSay('Here you are, first nightmare addon.', cid)
        else
            selfSay('You don\'t have a mastermind shield!', cid)
        end
    elseif(msgcontains(msg, 'magic plate armor')) then
        if getPlayerItemCount(cid, 2472) >= 1 then
            doPlayerAddOutfit(cid, 269, 2)
            doPlayerRemoveItem(cid, 2472, 1)
            selfSay('Here you are, second nightmare addon.', cid)
        else
            selfSay('You don\'t have a Magic Plate Armor!', cid)
        end
    end
    end
    end
    else
    selfSay('You aren\'t a knight!', cid)
    end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

serwer czepia si? tego miejsca pod koniec skryptu:
Kod:
    else
    selfSay('You aren\'t a knight!', cid)
 
Ostatnia edycja:
Odp: NPC na zam?wienie.

PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)            npcHandler:onCreatureDisappear(cid)            end
function onCreatureSay(cid, type, msg)            npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()                    npcHandler:onThink()                    end
function say(param)
            npcHandler:say(param.text,param.cid)
         end
    function delayedSay(text, delay, cid)
    if(not npcHandler:isFocused(cid)) then
                return FALSE
     else
         local param = {cid = cid, text = text}
            local delay = delay or 0
            addEvent(say, delay, param)
        end
    end
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
end
local pos = getCreaturePosition(cid)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local item1 = 5921
local item2 = 2194
local item3 = 2087
local item4 = 2692
if isInArray({4,8}, getPlayerVocation(cid)) then
    if(msgcontains(msg, 'equipment')) then
        selfSay('If you need better equipment, check this old weapon rack, armor rack and chest. Maybe you will find something interesting', cid)
	elseif(msgcontains(msg, 'spells')) then
        selfSay('As you reach higher level, you can use better spells. You can check your spells in magic spellbook.', cid)
    elseif(msgcontains(msg, 'experience')) then
        selfSay('Check castle undergrounds. There are a lot of Rats! I think you can kill this plague. Check this out!', cid)
    elseif(msgcontains(msg, 'job')) then
        selfSay('Well... you are newbie now, but i can give you chance to gain some experience. I have five jobs to you: {Ruthless Murderer}, {Cave Hunter}, and a {Fearless Hunter}.', cid)
    elseif(msgcontains(msg, 'ruthless murderer')) then
        selfSay('We have plague of rats in our castle undergrounds! They are eats all supplies! Do something! Bring me {heaven blossoms} and you will get your reward.', cid)
        talkState[talkUser] = 1
    elseif(msgcontains(msg, 'heaven blossoms') and talkState[talkUser] == 1) then
        if (getPlayerStorageValue(cid, 100) > 0) then
            selfSay('Finally, you have done your mission. Now ask me about {outfit}', cid)
        end
        if getPlayerItemCount(cid, item1) >= 20 then
            doPlayerRemoveItem(cid, item1, 20)
            setPlayerStorageValue(cid, 100, 1)
            doPlayerAddExperience(cid, 1500)
            doSendAnimatedText(getPlayerPosition(cid),"1500", TEXTCOLOR_WHITE)
            doPlayerAddItem(cid, 2491, 1)
            selfSay('Thank you for help! You are now more experienced', cid)
        else
            selfSay('Sorry man, i need 20 heaven blossoms to trust you!', cid)
        end
    elseif(msgcontains(msg, 'cave hunter')) then
        selfSay('There are rumors about strange monster called {Munster}. Probably he have mysterious fetish! Go to castle undergrounds and kill em!', cid)
        talkState[talkUser] = 2
    elseif(msgcontains(msg, 'munster') and talkState[talkUser] == 2) then
        if (getPlayerStorageValue(cid,100) < 1) then
            selfSay('Just bring me mysterious fetish', cid)
        elseif (getPlayerStorageValue(cid,101) > 0) then
            selfSay('You have done this mission. If you are interested, you can do knight {outfit}', cid)
        end
        if getPlayerItemCount(cid, item2) >= 1 then
            doPlayerRemoveItem(cid, item2, 1)
            setPlayerStorageValue(cid,101,1)
            doPlayerAddExperience(cid,3000)
            doPlayerAddItem(cid, 7730, 1)
            selfSay('Thank you! You are now more experienced!', cid)
        else
            selfSay('I need one mysterious fetish!', cid)
        end
    elseif(msgcontains(msg, 'fearless hunter')) then
        selfSay('Take this key and go to basement, and check a chest. There you got your reward. But remember: Come back here and put a {report}.', cid)
        doPlayerAddItem(cid, 2087, 1)
        talkState[talkUser] = 3
    elseif(msgcontains(msg, 'report') and talkState[talkUser] == 3) then
        if (getPlayerStorageValue(cid,101) < 1) then
            selfSay('Just set a {report}!', cid)
        elseif (getPlayerStorageValue(cid,102) > 0) then
            selfSay('You have passed this mission. If you are interested, ask me about {outfit}', cid)
        end
        if getPlayerItemCount(cid, item3) >= 1 then
            doPlayerRemoveItem(cid, item3, 1)
            setPlayerStorageValue(cid,102,1)
            doPlayerAddExperience(cid,7000, 1, 1)
            selfSay('Finally! Im gonna pay you fifty thousands for addtional reward.', cid)
        else
            selfSay('I need a report...', cid)
        end
    elseif(msgcontains(msg, 'outfit')) then
        selfSay('If you wanna gain my outfit, bring {mastermind shield} and optional {magic plate armor} for some addons to Terry.', cid)
        delayedSay('This both items can you loot from strange and powerful Demons.', 10000, cid)
        talkState[talkUser] = 4
    elseif(msgcontains(msg, 'gddsdgfbsghghs') and talkState[talkUser] == 4) then
        if (getPlayerStorageValue(cid,101) < 1) then
            selfSay('Just set a {report}!', cid)
        elseif (getPlayerStorageValue(cid,102) > 0) then
            selfSay('You have passed this mission. If you are interested, ask me about {outfit}', cid)
        end
        if getPlayerItemCount(cid, item3) >= 1 then
            doPlayerRemoveItem(cid, item3, 1)
            setPlayerStorageValue(cid,102,1)
            doPlayerAddExperience(cid,7000, 1, 1)
            selfSay('Finally! Im gonna pay you fifty thousands for addtional reward.', cid)
        else
        selfSay('I need a report...', cid)
        end
	elseif(msgcontains(msg, 'mastermind shield')) then
        if getPlayerItemCount(cid, 2514) >= 1 then
            doPlayerAddOutfit(cid, 269, 1)
            doPlayerRemoveItem(cid, 2514, 1)
            selfSay('Here you are, first nightmare addon.', cid)
        else
            selfSay('You dont have a mastermind shield!', cid)
        end
    elseif(msgcontains(msg, 'magic plate armor')) then
        if getPlayerItemCount(cid, 2472) >= 1 then
            doPlayerAddOutfit(cid, 269, 2)
            doPlayerRemoveItem(cid, 2472, 1)
            selfSay('Here you are, second nightmare addon.', cid)
        else
            selfSay('You dont have a Magic Plate Armor!', cid)
        end
    end
else
    selfSay('You arent a knight!', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Teraz dzia?a.
 
Odp: NPC na zam?wienie.

OK OSKARKU
MAM DLA CIEBIE
BARDZO TRUDNE ZADANIE
JEZELI ZDO?ASZ MASZ REPUTA
Potrzbuje NPC
Kowal
Wyglad Cos W Stylu Kowala
Co Ma Robic
Mam Polozyc item w miejsce
y = 1000
x = 1000
z = 7

musze napisac
JA - HI
KOWAL - Witam Cie Czy Mam Ci Uleprzyc ITEM ???
JA - tak
Kowal - Moge Ci Uleprzyc Do +9 ale niezawsze sie udaje
KOWAL - chesz uleprzyc (ITEM) NA (+LICZBA) ???
ILE % Na ULEPRZENIE
+1 = 100%
+2 = 95%
+3 = 85%
+4 = 70%
+5 = 55%
+6 = 45%
+7 = 35%
+8 = 25%
+9 = 10%
I JAK NIEULEPRZY TO NISZCZY ITEM
CENY
+1 - 5cc
+2 - 10cc
+3 - 25cc
+4 - 35cc
+5 - 50cc
+6 - 65cc
+7 - 85cc
+8 - 95cc
+9 - 125cc


to na tyle chyba wiesz o co tu chodzi ???
REPUT CZEMA ... :D
 
Odp: NPC na zam?wienie.

Jeszcze taka ma?a pro?ba.
Mam takiego zamkowego gatekeepera kt?ry ma przepuszcza? za bramy zamku.
Kod:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Gatekeeper Jim" script="misja.lua" walkinterval="0" floorchange="0">
	<health now="150" max="150"/>
	<look type="152" head="114" body="119" legs="114" feet="114" corpse="2212"/>
    <parameters>
        <parameter key="module_travel" value="1"/>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. You need pass to {castle} or {outside}?"/>
        <parameter key="travel_destinations" value="castle,983,1000,7,0;outside,978,1000,7,0;"/>
    </parameters>
</npc>

wszystko okej tylko ?e on pyta "You wanna travel to castle for 0 gold?"
a ma dzia?a? na zasadzie tych przepuszczaczy z yalaharu ;D
 
Odp: NPC na zam?wienie.

Usu? to:
PHP:
<parameter key="travel_destinations" value="castle,983,1000,7,0;outside,978,1000,7,0;"/>
I zr?b nowy plik LUA:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)            npcHandler:onCreatureDisappear(cid)            end
function onCreatureSay(cid, type, msg)            npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()                    npcHandler:onThink()                    end
function say(param)
            npcHandler:say(param.text,param.cid)
         end
    function delayedSay(text, delay, cid)
    if(not npcHandler:isFocused(cid)) then
                return FALSE
     else
         local param = {cid = cid, text = text}
            local delay = delay or 0
            addEvent(say, delay, param)
        end
    end
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
end
local pos = getCreaturePosition(cid)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, "castle") then
	selfSay("Here we go.", cid)
	doTeleportThing(cid, {x=983,y=1000,z=7})
elseif msgcontains(msg, "outside") then
	selfSay("Here we go.", cid)
	doTeleportThing(cid, {x=978,y=1000,z=7})
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Status
Zamknięty.
Back
Do góry