Witam!
Udost?pniam wam m?j skrypt na FULL RL CITIZEN ADDON pod tibie 8.6 sprawdzony na silniku trunk r3884 jedynie musicie zmieni? wygl?d NPC a oto i on :
data/npc/Hanna.xml
data/npc/scripts/citizen1.lua
data/npc/Lubo.xml
data/npc/scripts/citizen.lua
Udost?pniam wam m?j skrypt na FULL RL CITIZEN ADDON pod tibie 8.6 sprawdzony na silniku trunk r3884 jedynie musicie zmieni? wygl?d NPC a oto i on :
data/npc/Hanna.xml
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Hanna" script="data/npc/scripts/citizen1.lua" walkinterval="5000" floorchange="0">
<health now="100" max="100"/>
<look type="128" head="38" body="39" legs="96" feet="118" addons="3"/>
<parameters>
<parameter key="message_greet" value="Oh, please come in, |PLAYERNAME|. What do you need? Have a look at my wonderful offers in gems and jewellery."/>
<parameter key="message_farewell" value="Good bye."/>
<parameter key="module_keywords" value="1" />
</parameters>
</npc>
data/npc/scripts/citizen1.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 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, 'hat') then
if getPlayerStorageValue(cid, 83663) <= 0 then
selfSay('Pretty, isn\'t it? My friend Amber taught me how to make it, but I could help you with one if you like. What do you say?', cid)
talkState[talkUser] = 1
end
elseif getPlayerStorageValue(cid, 83663) <= 0 and talkState[talkUser] == 1 and msgcontains(msg, 'yes') then
selfSay('Okay, here we go, listen closely! I need a few things... a basic hat of course, maybe a legion helmet would do. Then about 100 chicken feathers... and 50 honeycombs as glue. That\'s it, come back to me once you gathered it!', cid)
setPlayerStorageValue(cid, 83663, 1)
end
if msgcontains(msg, 'hat') then
if getPlayerStorageValue(cid, 83665) <= 0 then
if getPlayerStorageValue(cid, 83663) == 1 then
selfSay('Oh, you\'re back already? Did you bring a legion helmet, 100 chicken feathers and 50 honeycombs?', cid)
talkState[talkUser] = 2
end
else
selfSay('You have already taken your hat.', cid)
end
elseif getPlayerStorageValue(cid, 83663) == 1 and talkState[talkUser] == 2 and msgcontains(msg, 'yes') then
if getPlayerStorageValue(cid, 83665) <= 0 then
if getPlayerItemCount(cid, 5890) >= 100 and getPlayerItemCount(cid, 5902) >= 50 and getPlayerItemCount(cid, 2480) >= 1 then
if getPlayerSex(cid) == 0 then
doPlayerRemoveItem(cid, 5890, 100)
doPlayerRemoveItem(cid, 5902, 50)
doPlayerRemoveItem(cid, 2480, 1)
doPlayerAddOutfit(cid, 136, 2)
setPlayerStorageValue(cid, 83665, 1)
selfSay('Your hat is finished. Here you go, I hope you like it.', cid)
else
doPlayerRemoveItem(cid, 5890, 100)
doPlayerRemoveItem(cid, 5902, 50)
doPlayerRemoveItem(cid, 2480, 1)
doPlayerAddOutfit(cid, 128, 2)
setPlayerStorageValue(cid, 83665, 1)
selfSay('Your hat is finished. Here you go, I hope you like it.', cid)
end
else
selfSay('You dont have item', cid)
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
data/npc/Lubo.xml
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Lubo" script="data/npc/scripts/citizen.lua" walkinterval="5000" floorchange="0">
<health now="100" max="100"/>
<look type="128" head="38" body="39" legs="96" feet="118" addons="3"/>
<parameters>
<parameter key="message_greet" value="Welcome to my adventurer shop, |PLAYERNAME|! What do you need?"/>
<parameter key="message_farewell" value="Good bye."/>
<parameter key="module_keywords" value="1" />
</parameters>
</npc>
data/npc/scripts/citizen.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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local time = 2
if msgcontains(msg, 'addon') then
if getPlayerStorageValue(cid, 83653) <= 0 then
selfSay('Sorry, the backpack I wear is not for sale. It is handmade from rare {minotaur leather}.', cid)
talkState[talkUser] = 1
end
elseif getPlayerStorageValue(cid, 83653) <= 0 and talkState[talkUser] == 1 and msgcontains(msg, 'minotaur leather') 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?', cid)
talkState[talkUser] = 2
elseif getPlayerStorageValue(cid, 83653) <= 0 and talkState[talkUser] == 2 and msgcontains(msg, 'yes') 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!', cid)
setPlayerStorageValue(cid, 83653, 1)
end
if msgcontains(msg, 'addon') then
if getPlayerStorageValue(cid, 83653) == 1 then
selfSay('Ah, right, almost forgot about the backpack! Have you brought me 100 pieces of minotaur leather as requested?', cid)
talkState[talkUser] = 3
end
elseif getPlayerStorageValue(cid, 83653) == 1 and talkState[talkUser] == 3 and msgcontains(msg, 'yes') then
if doPlayerRemoveItem(cid, 5878, 100) then
setPlayerStorageValue(cid, 83653, 2)
setPlayerStorageValue(cid, 83654, os.time()+time*60*60)
selfSay('Great! Alright, I need a while to finish this backpack for you. Come ask me later, okay?', cid)
else
selfSay('You dont have item.', cid)
end
end
if msgcontains(msg, 'addon') then
if getPlayerStorageValue(cid, 83655) <= 0 then
if getPlayerStorageValue(cid, 83653) == 2 then
if getPlayerStorageValue(cid, 83654) - os.time() <= 0 then
if getPlayerSex(cid) == 0 then
doPlayerAddOutfit(cid, 136, 1)
setPlayerStorageValue(cid, 83655, 1)
selfSay('Just in time! Your backpack is finished. Here you go, I hope you like it.', cid)
else
doPlayerAddOutfit(cid, 128, 1)
setPlayerStorageValue(cid, 83655, 1)
selfSay('Just in time! Your backpack is finished. Here you go, I hope you like it.', cid)
end
else
selfSay('This job requires patient and hability. Wait a little time.', cid)
end
end
else
selfSay('You have already taken your backpack.', cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())