NPC na zam?wienie.

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

jeszcze jakby? pom?g? po??czy? to z tym skryptem to by?oby super:
Kod:
------STORAGE-------
------200-------
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local item1 = 7378
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, 'fighting spirit')) then
selfSay('I think you are interested my outfit. I can give you fighting spirit, but bring me first 50 {royal spears}.', cid)
end
---------------------------------------------------------
if(msgcontains(msg, 'royal spears')) then
selfSay('You have collected all royal spears?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,200) > 0) then
selfSay('I cannot give you fighting spirit because you have done mission for me, magician adept or friendly barbarian.', cid)
else
if(doPlayerRemoveItem(cid, item1, 50) == TRUE) then
setPlayerStorageValue(cid,200,1)
doPlayerAddExperience(cid,10000)
doPlayerAddItem(cid, 5884, 1)
selfSay('There are yours fighting spirit. Thank you for help!', cid)
else
selfSay('Sorry man, i need 50 royal spears!', cid)
end
end
return true
end
----------------------------------------------------------

----------------------------------------------------------
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
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 item1 = 7378
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'fighting spirit')) then
	selfSay('I think you are interested my outfit. I can give you fighting spirit, but bring me first 50 {royal spears}.', cid)
elseif(msgcontains(msg, 'royal spears')) then
	selfSay('You have collected all royal spears?', cid)
	talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
	if (getPlayerStorageValue(cid,200) > 0) then
		selfSay('I cannot give you fighting spirit because you have done mission for me, magician adept or friendly barbarian.', cid)
	end
	if getPlayerItemCount(cid, item1) >= 50 then
		doPlayerRemoveItem(cid, item1, 50)
		setPlayerStorageValue(cid,200,1)
		doPlayerAddExperience(cid,10000)
		doSendAnimatedText(getPlayerPosition(cid),"10000", TEXTCOLOR_WHITE)
		doPlayerAddItem(cid, 5884, 1)
		selfSay('There are yours fighting spirit. Thank you for help!', cid)
	else
		selfSay('Sorry man, i need 50 royal spears!', cid)
	end
elseif 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())

#GmHeder
Za du?o roboty by wykona? ten skrypt, poza tym wi?kszo?? os?b kt?re go posiadaj? sprzedaj? go za pieni?dze, wi?c odmawiam zrobienia tego NPCta.
 
Ostatnia edycja:
Odp: NPC na zam?wienie.

Jeszcze odno?nie poprzedniego skryptu odnalaz?em do?? powa?nego buga, poniewa? je?li female chce zrobi? outfit, dostaje addony dla male ;/
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)
        delayedSay('With first level you may use only {utevo lux}, for second level you have {exura}.', 10000, 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 twenty {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('Well.. Go to magician adept house and try to find a key. After this, go to undergrounds with cave rats, and try to find a {basement}.', cid)
        talkState[talkUser] = 3
    elseif(msgcontains(msg, 'basement') and talkState[talkUser] == 3) then
        if (getPlayerStorageValue(cid,101) < 1) then
            selfSay('You lies! You arent been in my basement!', 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 me {mastermind shield} and optional {magic plate armor} for some addons. If you got it, tell me name of this items, and i will give you an addons.', cid)
        delayedSay('This both items can you loot from strange and powerful Demons.', 10000, cid)
        talkState[talkUser] = 4
    elseif(msgcontains(msg, 'demons') and talkState[talkUser] == 4) then
        if (getPlayerStorageValue(cid,101) < 1) then
            selfSay('You may find they out of castle.', 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! Now you can do an {outfit} missions.', 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('Now you have knightmare outfit and 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('Now you have second addon too.', 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())

//Done
 
Ostatnio edytowane przez moderatora:
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)
        delayedSay('With first level you may use only {utevo lux}, for second level you have {exura}.', 10000, 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 twenty {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('Well.. Go to magician adept house and try to find a key. After this, go to undergrounds with cave rats, and try to find a {basement}.', cid)
        talkState[talkUser] = 3
    elseif(msgcontains(msg, 'basement') and talkState[talkUser] == 3) then
        if (getPlayerStorageValue(cid,101) < 1) then
            selfSay('You lies! You arent been in my basement!', 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 me {mastermind shield} and optional {magic plate armor} for some addons. If you got it, tell me name of this items, and i will give you an addons.', cid)
        delayedSay('This both items can you loot from strange and powerful Demons.', 10000, cid)
        talkState[talkUser] = 4
    elseif(msgcontains(msg, 'demons') and talkState[talkUser] == 4) then
        if (getPlayerStorageValue(cid,101) < 1) then
            selfSay('You may find they out of castle.', 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! Now you can do an {outfit} missions.', cid)
        else
        selfSay('I need a report...', cid)
        end
    elseif(msgcontains(msg, 'mastermind shield')) then
        if getPlayerItemCount(cid, 2514) >= 1 then
			if getPlayerSex(cid) == 0 then
				doPlayerAddOutfit(cid, 269, 1)
			elseif getPlayerSex(cid) == 1 then
				doPlayerAddOutfit(cid, 268, 1)
			end
			doPlayerRemoveItem(cid, 2514, 1)
			selfSay('Now you have knightmare outfit and 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
			if getPlayerSex(cid) == 0 then
				doPlayerAddOutfit(cid, 269, 2)
			elseif getPlayerSex(cid) == 1 then
				doPlayerAddOutfit(cid, 268, 2)
			end
            doPlayerRemoveItem(cid, 2472, 1)
            selfSay('Now you have second addon too.', 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())
 
Odp: NPC na zam?wienie.

ehh chyba nigdy nie b?de mie? problem?w z npc ;p
Ot?? chodzi o to ?e storage co? szwankuje, tzn. t? sam? misj? mo?na wykona? kilkana?cie razy a przez to za 200gp mozna sobie wbic 3mln expa ; /
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 = 2666
local item2 = 5920
local item3 = 2160
local item4 = 2692
if isInArray({1,2,3,4,5,6,7,8}, getPlayerVocation(cid)) then
    if(msgcontains(msg, 'yes')) then
        selfSay('Okay you need {pass} to elite monsters first!', cid)
    elseif(msgcontains(msg, 'kurwzjnd')) then
        selfSay('As you reach higher level, you can use better spells. You can check your spells in magic spellbook.', cid)
        delayedSay('With first level you may use only {utevo lux}, for second level you have {exura}.', 10000, cid)
    elseif(msgcontains(msg, 'lsfksaf')) then
        selfSay('Well.. We are looking only finest hunters. I have to you: {rotworm hunting}, {dragon hunting}, or a {wyvern hunting}.', cid)
    elseif(msgcontains(msg, 'pass')) then
        selfSay('I can give you pass to {tiquanda revenge} only.', cid)
        delayedSay('This is very dangerous carniphila boss.', 10000, cid)
    elseif(msgcontains(msg, 'tiquanda revenge')) then
        selfSay('Okay. Please give me only five {meats} because im hungry! And i will give you pass instantly.', cid)
        talkState[talkUser] = 1
    elseif(msgcontains(msg, 'meats') and talkState[talkUser] == 1) then
        if (getPlayerStorageValue(cid, 700) > 0) then
            selfSay('We have hunted this monster. If you need something, ask me about {outfit}', cid)
        end
        if getPlayerItemCount(cid, item1) >= 5 then
            doPlayerRemoveItem(cid, item1, 5)
            setPlayerStorageValue(cid, 700, 1)
            doPlayerAddExperience(cid, 150000)
            doSendAnimatedText(getPlayerPosition(cid),"1500", TEXTCOLOR_WHITE)
            selfSay('You are now ready to battle! Good luck brave hunter!', cid)
        else
            selfSay('Sorry man, i need 5 meats!', cid)
        end
    elseif(msgcontains(msg, 'getdsgdsggdst')) then
        selfSay('My favorite! Just bring me 30 {green dragon scales}!', cid)
        talkState[talkUser] = 2
    elseif(msgcontains(msg, 'dsgsgdsg') and talkState[talkUser] == 2) then
        if (getPlayerStorageValue(cid,600) < 1) then
            selfSay('Just bring me green dragon scales', cid)
        elseif (getPlayerStorageValue(cid,601) > 0) then
            selfSay('You have done this mission. If you are interested, you can do shaman {outfit}', cid)
        end
        if getPlayerItemCount(cid, item2) >= 30 then
            doPlayerRemoveItem(cid, item2, 30)
            setPlayerStorageValue(cid,601,1)
            doPlayerAddExperience(cid,300000)
            doPlayerAddItem(cid, 2666, 3)
            selfSay('Thank you! You are now more experienced! You may eat some meat.', cid)
        else
            selfSay('I need 30 green dragon scales!', cid)
        end
    elseif(msgcontains(msg, 'rebsgsgdsfbds')) then
        selfSay('Wyverns... a boring monsters. I dont wanna overstrain you, then bring me only 10 {wyvern scales}.', cid)
        talkState[talkUser] = 3
    elseif(msgcontains(msg, 'sgfgftggddfg') and talkState[talkUser] == 3) then
        if (getPlayerStorageValue(cid,601) < 1) then
            selfSay('You got no wyvern scales!', cid)
        elseif (getPlayerStorageValue(cid,602) > 0) then
            selfSay('You have passed this mission. If you are interested, ask me about {outfit}', cid)
        end
        if getPlayerItemCount(cid, item3) >= 10 then
            doPlayerRemoveItem(cid, item3, 10)
            setPlayerStorageValue(cid,602,1)
            doPlayerAddExperience(cid,210000, 1, 1)
            selfSay('Finally! You are now more experienced hunter. You now can talk with my cheff over the bar.', cid)
        else
            selfSay('I need a wyvern scales...', cid)
        end
    elseif(msgcontains(msg, 'outfit')) then
        selfSay('If you wanna gain my outfit, bring me 15 crystal coins for {first addon} and 20 crystal coins for {second addon}. Remember: i accept only crystal coins!', cid)
        talkState[talkUser] = 4
    elseif(msgcontains(msg, 'lahnieszdres') and talkState[talkUser] == 4) then
        if (getPlayerStorageValue(cid,700) < 1) then
            selfSay('Ask my cheff about him!', cid)
        elseif (getPlayerStorageValue(cid,702) > 0) then
            selfSay('Ask my cheff about him.', cid)
        end
        if getPlayerItemCount(cid, item3) >= 1 then
            doPlayerRemoveItem(cid, item3, 15)
            setPlayerStorageValue(cid,702,1)
            doPlayerAddExperience(cid,7000, 1, 1)
            selfSay('Finally! Now you can do an {outfit} missions.', cid)
        else
        selfSay('I need a 15 crystal coins...', cid)
        end
    elseif(msgcontains(msg, 'first addon')) then
        if getPlayerItemCount(cid, 2160) >= 15 then
            if getPlayerSex(cid) == 0 then
                doPlayerAddOutfit(cid, 150, 1)
            elseif getPlayerSex(cid) == 1 then
                doPlayerAddOutfit(cid, 146, 1)
            end
            setPlayerStorageValue(cid,705,1)
            doPlayerRemoveItem(cid, 2160, 15)
            selfSay('Now you have oriental outfit and addon! And you are able to kill demodras!', cid)
        else
            selfSay('You dont have a cash!', cid)
        end
    elseif(msgcontains(msg, 'second addon')) then
        if getPlayerItemCount(cid, 2160) >= 20 then
            if getPlayerSex(cid) == 0 then
                doPlayerAddOutfit(cid, 150, 2)
            elseif getPlayerSex(cid) == 1 then
                doPlayerAddOutfit(cid, 146, 2)
            end
            doPlayerRemoveItem(cid, 2160, 20)
            selfSay('Now you have second addon too.', cid)
        else
            selfSay('You dont have a cash!', cid)
        end
    end
else
selfSay('Get out of here!', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
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 = 2666
local item2 = 5920
local item3 = 2160
local item4 = 2692
if isInArray({1,2,3,4,5,6,7,8}, getPlayerVocation(cid)) then
    if msgcontains(msg, 'yes') then
        selfSay('Okay you need {pass} to elite monsters first!', cid)
    elseif msgcontains(msg, 'kurwzjnd') then
        selfSay('As you reach higher level, you can use better spells. You can check your spells in magic spellbook.', cid)
        delayedSay('With first level you may use only {utevo lux}, for second level you have {exura}.', 10000, cid)
    elseif msgcontains(msg, 'lsfksaf') then
        selfSay('Well.. We are looking only finest hunters. I have to you: {rotworm hunting}, {dragon hunting}, or a {wyvern hunting}.', cid)
    elseif msgcontains(msg, 'pass') then
        selfSay('I can give you pass to {tiquanda revenge} only.', cid)
        delayedSay('This is very dangerous carniphila boss.', 10000, cid)
    elseif msgcontains(msg, 'tiquanda revenge') and getPlayerStorageValue(cid, 700) == -1 then
        selfSay('Okay. Please give me only five {meats} because im hungry! And i will give you pass instantly.', cid)
        setPlayerStorageValue(cid, 700, 0)
    elseif msgcontains(msg, 'meats') then
        if getPlayerStorageValue(cid, 700) == 1 then
            selfSay('We have hunted this monster. If you need something, ask me about {outfit}', cid)
        elseif getPlayerStorageValue(cid, 700) == 0 then
			if getPlayerItemCount(cid, item1) >= 5 then
				doPlayerRemoveItem(cid, item1, 5)
				setPlayerStorageValue(cid, 700, 1)
				doPlayerAddExperience(cid, 150000)
				doSendAnimatedText(getPlayerPosition(cid),"150000", TEXTCOLOR_WHITE)
				selfSay('You are now ready to battle! Good luck brave hunter!', cid)
			else
				selfSay('Sorry man, i need 5 meats!', cid)
			end
		end
    elseif msgcontains(msg, 'getdsgdsggdst') and getPlayerStorageValue(cid,701) == -1 then
        selfSay('My favorite! Just bring me 30 {green dragon scales}!', cid)
        setPlayerStorageValue(cid,701,0)
    elseif msgcontains(msg, 'dsgsgdsg') then
        if getPlayerStorageValue(cid,701) == 1 then
            selfSay('You have done this mission. If you are interested, you can do shaman {outfit}', cid)
        elseif getPlayerStorageValue(cid,701) == 0 then
			if getPlayerItemCount(cid, item2) >= 30 then
				doPlayerRemoveItem(cid, item2, 30)
				setPlayerStorageValue(cid,701,1)
				doPlayerAddExperience(cid,300000)
				doSendAnimatedText(getPlayerPosition(cid),"300000", TEXTCOLOR_WHITE)
				doPlayerAddItem(cid, 2666, 3)
				selfSay('Thank you! You are now more experienced! You may eat some meat.', cid)
			else
				selfSay('I need 30 green dragon scales!', cid)
			end
		end
    elseif msgcontains(msg, 'rebsgsgdsfbds') and getPlayerStorageValue(cid,702) == -1 then
        selfSay('Wyverns... a boring monsters. I dont wanna overstrain you, then bring me only 10 {wyvern scales}.', cid)
        setPlayerStorageValue(cid,702,0)
    elseif msgcontains(msg, 'sgfgftggddfg') then
        if getPlayerStorageValue(cid,702) == 1 then
            selfSay('You have passed this mission. If you are interested, ask me about {outfit}', cid)
        elseif getPlayerStorageValue(cid,702) == 0 then
			if getPlayerItemCount(cid, item3) >= 10 then
				doPlayerRemoveItem(cid, item3, 10)
				setPlayerStorageValue(cid,702,1)
				doPlayerAddExperience(cid, 210000)
				doSendAnimatedText(getPlayerPosition(cid),"210000", TEXTCOLOR_WHITE)
				selfSay('Finally! You are now more experienced hunter. You now can talk with my cheff over the bar.', cid)
			else
				selfSay('I need a wyvern scales...', cid)
			end
		end
    elseif msgcontains(msg, 'outfit') then
        selfSay('If you wanna gain my outfit, bring me 15 crystal coins for {first addon} and 20 crystal coins for {second addon}. Remember: i accept only crystal coins!', cid)
        talkState[talkUser] = 1
    elseif msgcontains(msg, 'lahnieszdres') and talkState[talkUser] == 1 then
        if getPlayerStorageValue(cid,700) < 0 then
            selfSay('Ask my cheff about him!', cid)
        elseif getPlayerStorageValue(cid,702) < 0 then
            selfSay('Ask my cheff about him.', cid)
        elseif (getPlayerStorageValue(cid,703) == -1) and getPlayerStorageValue(cid,702) > 0 and (getPlayerStorageValue(cid,701) > 0) and (getPlayerStorageValue(cid,700) > 0) then
			if getPlayerItemCount(cid, item3) >= 1 then
				doPlayerRemoveItem(cid, item3, 15)
				setPlayerStorageValue(cid,703,1)
				doPlayerAddExperience(cid,7000)
				doSendAnimatedText(getPlayerPosition(cid),"7000", TEXTCOLOR_WHITE)
				selfSay('Finally! Now you can do an {outfit} missions.', cid)
			else
				selfSay('I need a 15 crystal coins...', cid)
			end
		end
    elseif msgcontains(msg, 'first addon') then
		if getPlayerStorageValue(cid,703) == 1 and getPlayerStorageValue(cid,704) == -1 then
			if getPlayerItemCount(cid, 2160) >= 15 then
				if getPlayerSex(cid) == 0 then
					doPlayerAddOutfit(cid, 150, 1)
				elseif getPlayerSex(cid) == 1 then
					doPlayerAddOutfit(cid, 146, 1)
				end
				setPlayerStorageValue(cid,704,1)
				doPlayerRemoveItem(cid, 2160, 15)
				selfSay('Now you have oriental outfit and addon! And you are able to kill demodras!', cid)
			else
				selfSay('You dont have a cash!', cid)
			end
		end
    elseif msgcontains(msg, 'second addon') then
		if getPlayerStorageValue(cid,703) == 1 and getPlayerStorageValue(cid,705) == -1 and getPlayerStorageValue(cid,704) == 1 then
			if getPlayerItemCount(cid, 2160) >= 20 then
				if getPlayerSex(cid) == 0 then
					doPlayerAddOutfit(cid, 150, 2)
				elseif getPlayerSex(cid) == 1 then
					doPlayerAddOutfit(cid, 146, 2)
				end
				doPlayerRemoveItem(cid, 2160, 20)
				setPlayerStorageValue(cid,705,1)
				selfSay('Now you have second addon too.', cid)
			else
				selfSay('You dont have a cash!', cid)
			end
		end
    end
else
	selfSay('Get out of here!', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Odp: NPC na zam?wienie.

ehh teraz z kolei addony niedzialaja
jak sie pisze first addon to npc nie reaguje ;s

//I nie powinien reagowa?, dopiero po uko?czeniu wszystkich trzech misji b?dzie odpowiada?, uzna?em ?e tak b?dzie lepiej.

ok dzieki
 
Ostatnia edycja:
Odp: NPC na zam?wienie.

Okey to ja bym poprosi? o npc:

je?li by si? napisa?o X to odpowie Y takie co? z tabeli

?e dla np.:

local c = {
X= Siema Y= Elo
X= Kim jestes? Y= Jestem kowalem
X= Kt?ra godzina? Y= Tutaj sprawdza czas tibijski
X= Venore Y= Miasto na bagnach!
}

Napisz plx i ?eby potem to czyta?o jako? tak:
if msgcontains(msg, ..X..) then
selfSay(..Y.., cid)

Z g?ry thx :D
 
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 tabelka = {
				[1] = {co_gracz_mowi = "Kim jestes", co_odpowiada_NPC = "Jestem kowalem"},
				[2] = {co_gracz_mowi = "Ktora godzina", co_odpowiada_NPC = "Jest godzina "..getTibiaTime().."."},
				[3] = {co_gracz_mowi = "Venore", co_odpowiada_NPC = "Miasto na bagnach"}
				}
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
for i=1, #tabelka do
	if msgcontains(msg, tabelka[i].co_gracz_mowi) then
		selfSay(tabelka[i].co_odpowiada_NPC, cid)
	end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Odp: NPC na zam?wienie.

tibia 8.54 [TFS 0.3.6]

Wi?c chia?bym npc kt?ry sprzedaj? ringi
Dane:
Nazwa- Ringer
Wygl?d- ?eby mia? outfit citizen [ 1 addon]
Kolor- ca?y na czarno
Sprzedaj?:
Kod:
Axe Ring
Club Ring
Dwarven Ring
Energy Ring
Life Ring
Might ring
Power ring
Ring of Healing
Stealth ring
Sword ring
Time ring
Rozmowa:
Kod:
Player: Hi
Ringero: Witam sprzedaj? wszystkie pierscienie,co chesz kupic?
Player: Bye
Ringero: Dozobaczenia!
 
Odp: NPC na zam?wienie.

Potrzebuje npc kt?ry by skupywa? wszystkie trofea z potwork?w pod tibie 8.54/8.56
Dane:
Nazwa NPC :Tropher
Wygl?d : Full druid Addon bia?o czarny
Sprzedaje: Nic
Kupuje: Wszystkie dostepne trofea Trofea ? Tibia Wiki < tu masz liste>

Rozmowa:
Gracz:Hi
Tropher: Witaj skupuje wszystkie trofea.
Gracz: Trade <wyskakuje lista z all trofeami.>
Gracz: Bye
Tropher: Powodzenia.

//Brudnej roboty nie wykonam za Ciebie, ten skrypt wykona? dasz rad? sam, podam Ci tylko wz?r jak tego dokona?.
 
Ostatnio edytowane przez moderatora:
Odp: NPC na zam?wienie.

#dejwidmr
PHP:
<?xml version="1.0"?>
<npc name="Seller ringow" floorchange="0" walkinterval="2000" script="default.lua">
	<health now="150" max="150"/>
	<look type="128" head="113" body="113" legs="113" feet="113" addons="1"/>
<parameters>
	<parameter key="message_greet" value="Witaj |PLAYERNAME|!"/>
	<parameter key="module_shop" value="1"/>
	<parameter key="shop_buyable" value="axe ring,2208,100;sword ring,2207,100;club ring,2209,100;dwarven ring,2213,100;ring of healing,2214,100;might ring,2164,100;stealth ring,2165,100;power ring,2166,100;energy ring,2167,100;life ring,2168,100;time ring,2169,100;"/>
</parameters>
</npc>

#up
Robisz to na tej zasadzie:
PHP:
<?xml version="1.0"?>
<npc name="Ktos" floorchange="0" walkinterval="2000" script="default.lua">
	<health now="150" max="150"/>
	<look type="128" head="113" body="113" legs="113" feet="113" addons="1"/>
<parameters>
	<parameter key="message_greet" value="Witaj |PLAYERNAME|!"/>
	<parameter key="module_shop" value="1"/>
	<parameter key="shop_buyable" value="nazwa_itemu,ID_itemu,cena;nazwa_itemu,ID_itemu,cena;"/>
</parameters>
</npc>
 
Odp: NPC na zam?wienie.

Witam Was

Tu GmHeder :D

Zamawiam Npc

Kt?ry Daje Niesmiertelnosc Na 5 Minut :D

za 50 cc

REPUT CZEKA :D

//reload : Mowie

Ja -- HI
NPC -- Witaj Przedaje Magiczna Tarcze Kt?ra Broni Przed Wszystkim Na 5 Min. Tylko 50cc
Ja -- YES / NO
NPC -- Posiadasz Magiczna tarcze Na 5 Minut
GDY SIE NIE MA KASY

Niestac Cie Na Ta Magie

//Dawanie odporno?ci poprzez "czar"? Nigdy tego nie robi?em, jak si? naucz? to napisz? ten skrypt, ale p?ki co zam?wienie wstrzymane.
 
Ostatnio edytowane przez moderatora:
Odp: NPC na zam?wienie.

ELO
Oskarek :D

Chcia?bym
By? Mi Co? Zrobi?

To Znaczy :D


Npc.


Yi Han < --- NAME :D

JA : Hi
Yi Han : Witaj Wojowniku Czego Szukasz
JA : Chce Przej?c Do v2
Yi Han :Hmm... A Masz Przepustke ???
Ja : Mam
( TUTAJ NPC ODBIERA NAM ITEM (8981) <-- GAZETKA :p I TELEPORTUJE NAS W TO MIEJSCE

y=1100 x=1100 z=15 )

Dzieki :D

Reput Za Zrobienie ;]

//Done. Seminari zrobi? przede mn?.
 
Ostatnio edytowane przez moderatora:
Odp: NPC na zam?wienie.

Gm Heder:

Lua Script:

Kod:
-- start shit
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
--returns how many msgs he have said already
function cancelNPCTalk(events)
  local ret=1
  for aux=1,table.getn(events) do
     if events[aux].done==FALSE then
        stopEvent(events[aux].event)
     else
        ret=ret+1
     end
  end
  events=nil
  return(ret)
end
 
function doCreatureSayWithDelay(cid,text,type,delay,e)
   if delay<=0 then
      doCreatureSay(cid,text,type)
   else
      local func=function(pars)
                    doCreatureSay(pars.cid,pars.text,pars.type)
                    pars.e.done=TRUE
                 end
      e.done=FALSE
      e.event=addEvent(func,delay,{cid=cid, text=text, type=type, e=e})
   end
end

function doNPCTalkALot(msgs,interval)
  local e={}
  local ret={}
  if interval==nil then interval=3000 end --3 seconds is default time between messages
  for aux=1,table.getn(msgs) do
      e[aux]={}
      doCreatureSayWithDelay(getNpcCid(),msgs[aux],TALKTYPE_PRIVATE_NP,(aux-1)*interval,e[aux])
      table.insert(ret,e[aux])
  end
  return(ret)
end
--end shit :P





function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end      
-- zmienne lokalne
   local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local namee = getPlayerName(cid)

	
	local c = {
	teleportDone = {x=1100, y=1100, z=15},
	item1 = 8981,
	item1_count = 1,
	efekt = 19,
	}
	
	if msgcontains(msg, 'chce przejsc do v2') then
	   selfSay('Hmm... A masz przepustke?', cid)
	   talkState[talkUser] = 1
	end
	
	if msgcontains(msg, 'mam') then
	   if talkState[talkUser] == 1 and doPlayerTakeItem(cid, c.item1, c.item1_count) == TRUE then
	   doTeleportThing(cid, c.teleportDone)
	   doSendMagicEffect(getCreaturePosition(cid),c.efekt)
	   selfSay('Okey, tak wiec teleportuje Cie', cid)
	   elseif talkState[talkUser] == 1 and doPlayerTakeItem(cid, c.item1, c.item1_count) == FALSE then
	   selfSay('Czemu klamiesz? Nie masz przepustki!', cid)
	   end
	end
	return true
	end
	
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Plik xml:

Kod:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Yi Han" script="data/npc/scripts/Yi Han.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="73" head="0" body="0" legs="0" feet="0" addons="0"/>
<parameters>
        <parameter key="message_greet" value="Witaj wojowniku, czego szukasz?"/>
        <parameter key="message_farewell" value="Zegnaj wiec!"/>
    </parameters>
</npc>
 
Odp: NPC na zam?wienie.

@Oskar
Wielkie dzi?ki za pomoc, wszystko ?adnie, pi?knie i bez zarzutu dzia?a, co najlepsze, ?e nic nie by?o trzeba poprawia?.
Szacuneczek i dzi?ki raz jeszcze :)
 
Ostatnia edycja:
Odp: NPC na zam?wienie.

NPC1:
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 = 4325
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, "tell me your secret") or msgcontains(msg, "secret") then
	if getPlayerStorageValue(cid, storage) == -1 then
		selfSay("Do you want to know my secret "..getCreatureName(cid).."? Are you sure? Many ppls tried, but they died at the end.", cid)
		talkState[talkUser] = 1
	else
		selfSay("You already know my secret.", cid)
	end
elseif msgcontains(msg, "yes") then
	if talkState[talkUser] == 1 then
		selfSay("So my secret is... ( i teraz sobie cos dopisze bla bla ) I na koncu mowi, try to find my brother, he will give you more specific info about the quest.", cid)
		setPlayerStorageValue(cid, storage, 1)
	end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Paphe" script="paphe.lua" walkinterval="2000">
	<health now="150" max="150"/>
<look type="328" head="78" body="128" legs="86" feet="116" />
<parameters>
	<parameter key="message_greet" value="Hello |PLAYERNAME| how may I help you?"/>
</parameters>
</npc>

NPC2:
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 = 4325 
local ID_klucza = 2090
local AID_klucza = 6785
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid 
if msgcontains(msg, "yes") then 
    if getPlayerStorageValue(cid, storage) == 1 then 
        selfSay("Well, thats true, you talked with my brother and now you're one of us. I hope you can help us. Here is your info", cid) 
        setPlayerStorageValue(cid, storage, 2)
    else 
        selfSay("Well, get fuck of right now. You're one from Zoltan's army. Talk to my brother first, so I can know you're trustworthy.", cid) 
    end
elseif msgcontains(msg, "key") then
	if getPlayerStorageValue(cid, storage) == 2 then
		selfSay("You will need this key to pass doors to Demoz.", cid)
		local klucz = doPlayerAddItem(cid, ID_klucza, 1)
		doItemSetAttribute(klucz, "aid", AID_klucza)
		setPlayerStorageValue(cid, storage, 3)
	else
		selfSay("Sorry, I already gave you key. I do not have another one.", cid)
	end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new())
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Paphes Brother" script="Paphes Brother.lua" walkinterval="2000">
	<health now="150" max="150"/>
<look type="328" head="78" body="128" legs="86" feet="116" />
<parameters>
	<parameter key="message_greet" value="Well, my brother sends you to me? Wow... Next idiot which is gonna die. "/>
</parameters>
</npc>
 
Ostatnia edycja:
Odp: NPC na zam?wienie.

Widz? ?e nikt nie zg?osi? zam?wienia, wi?c mo?e rozwa?ysz pomoc w moim problemie. Napisa?em skrypt dla npc - wilko?aka, kt?ry prosi nas o sko?czenie jego m?ki {end}, lecz mo?emy go te? wyleczy? {doctor} (idziemy do innego npc z prostym skryptem kt?rego napisa?em). Mam jednak par? problem?w i pyta?:
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 creatureSayCallback(cid, type, msg)

        if(not npcHandler:isFocused(cid)) then
                return false
		end		

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
local storage = 10304


	if(msgcontains(msg, 'doctor')) then
		if(getPlayerStorageValue(cid, storage) < 3) then
			npcHandler:say("Find the doctor ble ble", cid)
			setPlayerStorageValue(cid, storage, 3)			
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Quest Update: The Beast")
		elseif(getPlayerStorageValue(cid, storage) > 2) and (getPlayerStorageValue(cid, storage) < 5) then
			npcHandler:say("Did you find the doctor ble ble?", cid)
			talkState[talkUser] = 2
		elseif(getPlayerStorageValue(cid, storage) == 7) then
			npcHandler:say("Thanks again ble ble", cid)
		end
	elseif(msgcontains(msg, 'yes')) and (getPlayerStorageValue(cid, storage) == 4) then
		if talkState[talkUser] = 2 then
			npcHandler:say("Thanks ble ble.", cid)
					npcHandler:say("x", cid,5)
					npcHandler:say("x", cid,10)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Quest Completed: The Beast")
			setPlayerStorageValue(cid, storage, 7)
			setPlayerStorageValue(cid, 15000) +1 albo -1
			talkState[talkUser] = 0
		end	
	elseif(msgcontains(msg, 'no')) then
		if talkState[talkUser] = 2 then
		npcHandler:say("Then {END} my suffering ble ble", cid)
		talkState[talkUser] = 0
		end
	end	

	if(msgcontains(msg, 'end')) then
		if (getPlayerStorageValue(cid, storage) < 6) then
		npcHandler:say("Kill me ble ble", cid)
			npcHandler:say("x", cid,4)
		talkState[talkUser] = 1
		end
	elseif(msgcontains(msg, 'yes')) and (isPlayer(cid)) and (getPlayerStorageValue(cid, storage) < 6) then
		if talkState[talkUser] == 1 then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Kill the Beast!")
			doTeleportThing(cid, {x = 1081, y = 896, z = 7})
		talkState[talkUser] = 0
	elseif(msgcontains(msg, 'no')) and (talkState[talkUser] > 0) then
		npcHandler:say("Then get away from me ble ble", cid)
		talkState[talkUser] = 0
		end
	end
	return true

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

1. Cz??c z keywordem {doctor} ma b??d. Po usuni?ciu linijki talkState[talkUser] = 2 skrypt dzia?a, co m?wi nam ?e prawdopodobnie nie radz? sobie z paroma talkstate'ami w skrypcie.

2. Czy mo?na doda? +1 albo -1 do jakiego? storageid komend? (setplayerstoragevalue (cid, storage))? Wiem ?e zapis w skrypcie jest b??dny, to tylko przyk?ad jak chcia?bym by to wygl?da?o.

3a. Rozwi?za?em problem zabijania wilko?aka (npc) za pomoc? teleportowania gracza poziom ni?ej, do takiego samego pomieszczenia, ale ju? z mobem - werewolf. Nie wiem jak zwr?ci? false gdy nie jest zrespawnowany. Po wyj?ciu schodami z pomieszczenia wracamy na ten sam poziom jak po wyj?ciu z pomieszczenia npc, oczywi?cie. Mo?emy teleportowa? si? rozmow? tak d?ugo jak nie b?dziemy mie? storageid = 6 i tu pojawia si? nowa pro?ba. Potrzebuj? skrypt onkill - ustawienie storage id = 6 po zabiciu wilko?aka. Za schodami stoj? jeszcze drzwi kt?re nie wpuszcz? nas do wilko?aka gdy storageid > od 5, chyba logiczne ?e potrzebujemy czego? takiego.

3b. Mo?e masz inny pomys? na rozwi?zanie tego? Np. u?ycie dosummon i doremove creature?
 
Ostatnia edycja:
Odp: NPC na zam?wienie.

Widz? ?e nikt nie zg?osi? zam?wienia, wi?c mo?e rozwa?ysz pomoc w moim problemie. Napisa?em skrypt dla npc - wilko?aka, kt?ry prosi nas o sko?czenie jego m?ki {end}, lecz mo?emy go te? wyleczy? {doctor} (idziemy do innego npc z prostym skryptem kt?rego napisa?em). Mam jednak par? problem?w i pyta?:
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 creatureSayCallback(cid, type, msg)
        if(not npcHandler:isFocused(cid)) then
                return false
		end		
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
local storage = 10304
	if(msgcontains(msg, 'doctor')) then
		if(getPlayerStorageValue(cid, storage) < 3) then
			npcHandler:say("Find the doctor ble ble", cid)
			setPlayerStorageValue(cid, storage, 3)			
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Quest Update: The Beast")
		elseif(getPlayerStorageValue(cid, storage) > 2) and (getPlayerStorageValue(cid, storage) < 5) then
			npcHandler:say("Did you find the doctor ble ble?", cid)
			talkState[talkUser] = 2
		elseif(getPlayerStorageValue(cid, storage) == 7) then
			npcHandler:say("Thanks again ble ble", cid)
		end
	elseif(msgcontains(msg, 'yes')) and (getPlayerStorageValue(cid, storage) == 4) then
		if talkState[talkUser] = 2 then
			npcHandler:say("Thanks ble ble.", cid)
					npcHandler:say("x", cid,5)
					npcHandler:say("x", cid,10)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Quest Completed: The Beast")
			setPlayerStorageValue(cid, storage, 7)
			setPlayerStorageValue(cid, 15000) +1 albo -1
			talkState[talkUser] = 0
		end	
	elseif(msgcontains(msg, 'no')) then
		if talkState[talkUser] = 2 then
		npcHandler:say("Then {END} my suffering ble ble", cid)
		talkState[talkUser] = 0
		end
	end	
	if(msgcontains(msg, 'end')) then
		if (getPlayerStorageValue(cid, storage) < 6) then
		npcHandler:say("Kill me ble ble", cid)
			npcHandler:say("x", cid,4)
		talkState[talkUser] = 1
		end
	elseif(msgcontains(msg, 'yes')) and (isPlayer(cid)) and (getPlayerStorageValue(cid, storage) < 6) then
		if talkState[talkUser] == 1 then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Kill the Beast!")
			doTeleportThing(cid, {x = 1081, y = 896, z = 7})
		talkState[talkUser] = 0
	elseif(msgcontains(msg, 'no')) and (talkState[talkUser] > 0) then
		npcHandler:say("Then get away from me ble ble", cid)
		talkState[talkUser] = 0
		end
	end
	return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Nie mo?esz robi? elseif do msg je?li ma talkstate

Zmie? to:
Kod:
elseif(msgcontains(msg, 'yes')) and (getPlayerStorageValue(cid, storage) == 4) then
Na to:
Kod:
if(msgcontains(msg, 'yes')) and (getPlayerStorageValue(cid, storage) == 4) then

I dodaj end przez tym if msgcontains...
I zr?b tak z dalszymi to powinno dzia?a?
 
Odp: NPC na zam?wienie.

#up
Znawca?
Pewnie ?e mo?e u?ywa? elseif >.< My?la?em, ?e takie rzeczy to Ty ju? wiesz.
 
Status
Zamknięty.
Back
Do góry