Pierwszy taki Npc na Evo 7.8 siedizalem 4h ale mam okazjie wam go dac xD Morze niejest w najlepszym stanie na koncu muwi dziwne cyfry 700001 i 0 ale to nic niezmienia najwarzniejsze że działa oto post ktury dodajecie w pliku .lua Npc/Scripts/ np.kowal.lua zrobiony na podstawie addonowego npc ^^ Jeśli uda wam sie zrobic lepszego takiego npc dajcie scripta do niego na moim poscie plz...
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler)
local shopModule = ShopModule:new() npcHandler:addModule(shopModule)
-- 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 = 'Here you are.' 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, 'crown armor') then selfSay('I can give you royal steel for crown armor.')
------------------------------------------------ addon ------------------------------------------------ elseif msgcontains(msg, 'royal steel') then if isPremium(cid) then if getPlayerItemCount(cid,2487) >= 1 then selfSay('Did you bring me the crown armor?') talk_state = 4 else selfSay('I need crown armor, to give you royal steel. Come back when you have them.') talk_state = 0 end else selfSay(addon_need_premium) talk_state = 0 end ------------------------------------------------ confirm yes ------------------------------------------------ elseif msgcontains(msg, 'yes') and talk_state == 4 then talk_state = 0 if getPlayerItemCount(cid,2487) >= 1 then addon = getPlayerStorageValue(cid,20001) if addon == -1 then if doPlayerTakeItem(cid,2487,1) == 0 then selfSay(doPlayerTakeItem(cid, 2487, 1)) doPlayerAddItem(cid, 5887, 1) doPlayerAddItem(cid, 5887, 1) setPlayerStorageValue(cid,20001,1) end else selfSay(doPlayerAddItem(cid, 5887,1)) selfSay(doPlayerTakeItem(cid, 2487,1)) end end
------------------------------------------------ confirm no ------------------------------------------------ elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 34) then selfSay('Ok than.') 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())
|