
Nie tylko o Tibii i OTS...
Soldier of the North
Znowu Witam Teraz (nie pisz dzi¶, ponieważ dałem wam już dzi¶ 2 skrypty xD) dam wam NPC który "wyrabia" first citizen addon oraz second citizen addon
Ok, zaczynamy:
Robimy plik .xml w data/npc o nazwie Lubo. Piszemy w nim ten oto kod:
Spoiler:
<?xml version="1.0"?>
<npc name="Lubo" script="data/npc/scripts/citizen 1.lua" access="3" lookdir="2">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="139" head="132" body="79" legs="97" feet="132"/>
</npc>
Teraz w data/npc/scripts robimy plik .lua o nazwie lubo. Piszemy w nim ten kod:
Spoiler:
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
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
keywordHandler:addKeyword({'offers'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu vendo Torch (3gp), Fishing Rod (175gp), Worms (1gp), Rope (60gp), Backpack (25gp), Apple (3gp), Crowbar (260gp).'})
function creatureSayCallback(cid, type, msg)
part = getPlayerStorageValue(cid, 7510)
part1 = getPlayerStorageValue(cid, 7511)
sex = getPlayerSex(cid)
pos = getPlayerPosition(cid)
if msgcontains(msg, 'addon') and npcHandler.focus == cid then
if isPremium(cid) then
if part1 == 1 then
if sex == 1 then
selfSay('Just in time! Your backpack is finished. Here you go, I hope you like it.')
doPlayerAddAddon(cid,128,1)
doSendMagicEffect(pos, 12)
else
selfSay('Just in time! Your backpack is finished. Here you go, I hope you like it.')
doPlayerAddAddon(cid,136,1)
doSendMagicEffect(pos, 12)
end
else
selfSay('Sorry, the backpack I wear is not for sale. It\'s handmade from rare minotaur leather.')
end
else
selfSay('Sorry, you need a premium account to make this addon')
end
talk_state = 0
elseif msgcontains(msg, 'minotaur leather') and npcHandler.focus == cid then
selfSay('Well, if you really like this backpack, I could make one for you, but minotaur leather is hard to come by these days. Are you willing to put some work into this?')
talk_state = 1
elseif msgcontains(msg, 'yes') and talk_state == 1 and npcHandler.focus == cid then
if part == -1 or part == 0 then
selfSay('Alright then, if you bring me 100 pieces of fine minotaur leather I will see what I can do for you. You probably have to kill really many minotaurs though... so good luck!')
setPlayerStorageValue(cid, 7510, 1)
else
selfSay('Sorry, you already talk about this.')
end
talk_state = 0
elseif msgcontains(msg, 'bp') and npcHandler.focus == cid then
if part == 1 then
selfSay('Ah, right, almost forgot about the backpack! Have you brought me 100 pieces of minotaur leather as requested?')
else
selfSay('Sorry, you needs to speak with me about addon.')
end
talk_state = 2
elseif msgcontains(msg, 'yes') and talk_state == 2 and npcHandler.focus == cid then
if getPlayerItemCount(cid,5878) >= 100 and part1 == -1 or part1 == 0 then
if doPlayerTakeItem(cid,5878,100) then
selfSay('Great! Alright, I need a while to finish this backpack for you. Come ask me later, okay?')
setPlayerStorageValue(cid, 7511, 1)
end
else
selfSay('Sorry, you do not have this item or already gave this item.')
end
talk_state = 0
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay('Ok.')
talk_state = 0
end
return 1
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Skrypt nie jest mój. Je¶li mogę, to chciałbym liczyć na reputki

Offline
Soldier of the North
Od¶wierzam.

Offline

Prawie każdy ots ma all w 1npc
Fajny by był taki że addony w 100% jak na rl bo nie ma takiego
Offline