|
- Forum nie tylko o Tibii i OTS... http://www.tibia11.pun.pl/index.php - Skrypty do OTS http://www.tibia11.pun.pl/viewforum.php?id=11 - [NPC] Quest man(daje misje do wykonania i dostajesz nagrode) http://www.tibia11.pun.pl/viewtopic.php?id=5257 |
| kamildeder - 2008-06-19 21:49:59 |
W data/npc/ tworzysz plik Quest Changer.Xml i spisujesz w nim to: Kod:<npc name="Quest Changer" script="data/npc/scripts/quest.lua" lookdir="3" autowalk="25"> <health now="500" max="500"/> <look type="111" head="0" body="0" legs="0" feet="0"/> <parameters> <parameter key="message_greet" value="Witam |PLAYERNAME|. Zamieniam itemki z questo na nagrody powiec 'pomoc'." /> <parameter key="message_needmoremoney" value="Niemasz tyle kasy." /> <parameter key="message_decline" value="Czy |TOTALCOST| to za duzo dla ciebie?" /> </parameters> </npc> Potem wejdź w /data/npc scripts stworz plik quest.Lua i wpisz w nim to: Kod:local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end
addon_need_premium = 'Sorry, you need a premium account to get addons.'
addon_have_already = 'Sorry, you already have this addon.'
addon_have_not_items = 'Sorry, you don\'t have these items.'
addon_give = 'Masz i sie ciesz xD'
player_gold = getPlayerItemCount(cid,2148)
player_plat = getPlayerItemCount(cid,2152)*100
player_crys = getPlayerItemCount(cid,2160)*10000
player_money = player_gold + player_plat + player_crys
if msgcontains(msg, 'pomoc') then
selfSay('Zamieniam itemki na nagrody.')
elseif msgcontains(msg, 'blue robe') then
if getPlayerItemCount(cid,2090) >= 1 then
selfSay('Przyniosles mi niebieski klucz?')
talk_state = 1
else
selfSay('Niemasz tego itemka. Przyjdz jak go bedziesz mial.')
talk_state = 0
end
elseif msgcontains(msg, 'tak') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2090) >= 1 then
if doPlayerRemoveItem(cid,2090,1) == 1 then
selfSay(addon_give)
doPlayerAddItem(cid,7428,1)
end
else
selfSay(havent_item)
end
elseif msgcontains(msg, 'nie') and (talk_state >= 1 and talk_state <= 5) then
selfSay('Ok to nara ziom...')
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new()) |
| Seeker - 2008-06-26 03:34:48 |
zajebdobre tylko ma pare bledow a tak to spoko tylko wytlumacz oco chodzi z tymi zadaniami itp. |
| kubakrupa - 2008-06-26 08:40:43 |
Zarombisty NPC..Jak Bede Mogl To Reput4u |
| Żwir - 2008-06-26 09:10:12 |
Ładny skrypt. Lecz wyjaśnij wszystko dla początkujących ; ) |
| Ziele - 2008-06-26 09:27:56 |
Nom dobry npc ale gdzies juz go widzialem..na tym forum..ale nie wiem kto tu dal xD |
| kamildeder - 2008-06-26 22:05:31 |
Jak takie ladne Komentarze dajcie +(plusika) ;) |
| KubixiS - 2008-06-27 08:29:49 |
No własnie bo też niewiem ocb |
| Renion - 2008-07-01 10:52:22 |
Ładny skrypcik, trochę pozmieniałem i działa :p 9/10 |
| slepy - 2011-06-07 11:57:05 |
nie widzicie ze to poprostu spocony cyklop wszedzie jest na necie |