Hi, I need the npc Stan, that sells costume bags like, If you use the bag you will transform In to a creature, maybe like a Demon, or something please reply Thanks! rep and I need the script for the bag and the xml for the bag Thanks
<npc name="Stan" script="Stan.lua">
<look type="12" head="94" body="15" legs="81" feet="0"/>
</npc>
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
local t = {}
local voices = {'Your soul will be mine!', 'I SMELL FEEEEAR!', 'MUHAHAHAHAHA!'}
local jokes = {
[-1] = {"Where does a blackbird go for a drink? You know that, huh? No? ...", "To a crow bar!! Muahahahaha! Another one?"},
[1] = {"Why do hens lay eggs? You know that, huh? No? ...", "If they dropped them, they'd break. Muahahahaha! Sooooo funny! Another one?"},
[2] = {"Two peaky vampires walking through the streets, almost starving. Then a third one shows up, his whole face blurred with blood. The two ask: 'Where did you get the blood from?' ...", "The bloody one replies, 'Do you see that wall over there?'. The two vampires say: 'Yes' and the bloody one: 'Well, I didn't!' Muahahahaha!!! Another one?"},
[3] = {"Two guys are out hunting deer. The first guy says: 'Did you see that?','No' the second guy replies. 'Well, a bald eagle just flew overhead!', the first guy says. ...", "A couple of minutes later, the first guy says: 'Did you see that?'. 'See what?' the second guy asks. 'Are you blind? There was a big, black bear walking on that hill, over there.' ...", "A few minutes later the first guy says, 'Did you see that?'. By now, the second guy is getting angry, so he says: 'Yes, I did!'. And the first guy says: 'Then why did you step in it?'. Muahahahaha!! Another one?"},
[4] = "In the Green Claw Swamp a dwarf was found, tied up with chains, gagged and with a heavy rock wrapped on his chest. The guard finding him says, 'Damn dwarfs, they always steal more than they can carry!' Muahahahaha!"
}
local function think(cid)
local r = math.random(300)
if voices[r] then
doCreatureSay(getNpcCid(), voices[r], TALKTYPE_YELL)
end
return true
end
local q = ShopModule:new()
npcHandler:addModule(q)
q:addBuyableItem({'bag'}, 7737, 500, 1, 'bag')
q:addBuyableItem({'bag'}, 7739, 1500, 1, 'bag')
q:addBuyableItem({'bag'}, 7738, 1000, 1, 'bag')
q:addBuyableItem({'party hat'}, 6578, 800, 1, 'party hat')
q:addBuyableItem({'party trumpet'}, 6572, 80, 1, 'party trumpet')
local function say(cid, type, msg)
local n
if not npcHandler:isFocused(cid) then
if msgcontains(msg, 'hello') or msgcontains(msg, 'hi') then
npcHandler:say("YOU DARE TALKING TO ME, MORTAL?!! ... Relax, it's just a {costume}. Welcome to Stan's!", cid)
npcHandler:addFocus(cid)
else
return
end
elseif msgcontains(msg, "joke") then
local s = getCreatureStorage(cid, 123) < 5
npcHandler:say(s and "I only know five jokes but they are hilarious! Do you want to hear one?" or "Sorry, I don't know any more jokes.", cid)
n = s and 2
elseif t[cid] == 2 and msgcontains(msg, "yes") then
local s = getCreatureStorage(cid, 123)
npcHandler:say(jokes[s], cid)
doCreatureSetStorage(cid, 123, math.max(1, s + 1))
n = s < 4 and 2
elseif t[cid] == 1 and msgcontains(msg, "uncommon") then
npcHandler:say({"It's getting warmer! In this category you will get one of five costumes in good quality and therefore for 1000 Gold! ...", "You will be amazed of these costumes, I promise! Just ask me for a {trade}."}, cid)
elseif t[cid] == 1 and msgcontains(msg, "common") then
npcHandler:say({"This is the cheapest. For 500 gold you get one of five common costumes. Spectacular, but if you know the 'creature illusion' spell, you may be disappointed. ...", "But if you and your friends want to dress up as an orc horde for example, it will be the perfect deal for you! Just ask me for a {trade}."}, cid)
elseif t[cid] == 1 and msgcontains(msg, "deluxe") then
npcHandler:say({"I knew you are a deluxe guy! Your friends will be astonished about your costume! You will get one of five costumes of the finest quality you will ever face in your life!! ...", "I ruin myself but I will give it to you for only 1500 Gold! Just ask me for a {trade}."}, cid)
elseif msgcontains(msg, "bye") then
npcHandler:say('Cheerio!', cid)
npcHandler:releaseFocus(cid)
elseif msgcontains(msg, "costume") then
npcHandler:say({"Making these costumes is not as easy as it seems. Have you ever asked yourself how an adult human fits into a dwarf costume? Well, you won't learn it from me! ...", "Otherwise everyone opens up a costume shop ruining my life AGAIN! Anyway I can offer you costumes in three categories: 'common', 'uncommon' or 'deluxe'. Which category are you interested in?"}, cid)
n = 1
elseif msgcontains(msg, "name") then
npcHandler:say("Stanley Montgomery Edward Wilson Jaydon Alverton at your service! Just say Stan!", cid)
elseif msgcontains(msg, "job") then
npcHandler:say("I own this shop of magical, wonderful, unsavoury, frightening and cuuuuute costumes! My name is Stan and I'm at your service!", cid)
elseif msgcontains(msg, "offer") then
npcHandler:say({"You can buy party hats and party trumpets from me. In addition I can offer you costumes in the very best quality you can get! If you know someone selling better costumes than me, tell me his name and I go and kill that guy! Hahahaha, just kidding! ...", "Now serious, I can offer you costumes in three categories: 'common', 'uncommon' or 'deluxe'. Which category are you interested in?"}, cid)
n = 1
elseif msgcontains(msg, "party") then
npcHandler:say("Hurray!", cid)
doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
doSendMagicEffect(getNpcPos(), CONST_ME_GIFT_WRAPS)
end
t[cid] = n
return true
end
npcHandler:setMessage(MESSAGE_SENDTRADE, 'Have fun with your carnival stuff and recommend me to your friends!')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Cheerio!')
npcHandler:setCallback(CALLBACK_ONTHINK, think)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, say)
local t = {
[7737] = {7, 96, 214, 70, 23},
[7738] = {47, 237, 78, 257, 99},
[7739] = {220, 35, 244, 55, 87}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
doRemoveItem(item.uid)
local k = t[item.itemid]
doSetCreatureOutfit(cid, { lookType=k[math.random(#k)] }, 5000)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
return true
end
Thanks, just a newb question where should I paste the third one, actions? and could you post what I should write in the actions.xml code or where It now should be Thanks!
local t = {
[7737] = {7, 96, 214, 70, 23},
[7738] = {47, 237, 78, 257, 99},
[7739] = {220, 35, 244, 55, 87}
nopI'm no scripter but
looking at this part
Code:local t = { [7737] = {7, 96, 214, 70, 23}, [7738] = {47, 237, 78, 257, 99}, [7739] = {220, 35, 244, 55, 87}
I have no clue if you forgot a , after the last } XD
No, because it's only 1 message. anyway these jokes and stuff won't work with the normal npc system.shouldn't the 4th joke of Cykotitan's script have a "{"?
. . . . . .. . . . . . . . . . . ,.-‘”. . . . . . . . . .``~.,ohh.. Is the actions.xml Inside the action folder no shit sherlock... I was wondering where to paste the "script" I said actions.xml just as an example...
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
local t = {}
local voices = {'Your soul will be mine!', 'I SMELL FEEEEAR!', 'MUHAHAHAHAHA!'}
local jokes = {
[-1] = "Where does a blackbird go for a drink? You know that, huh? No? ..., To a crow bar!! Muahahahaha! Another one?",
[1] = "Why do hens lay eggs? You know that, huh? No? ...,If they dropped them, they'd break. Muahahahaha! Sooooo funny! Another one?",
[2] = "Two peaky vampires walking through the streets, almost starving. Then a third one shows up, his whole face blurred with blood. The two ask: Where did you get the blood from? ..., The bloody one replies, Do you see that wall over there?. The two vampires say: Yes and the bloody one: Well, I didnt! Muahahahaha!!! Another one?",
[3] = "Two guys are out hunting deer. The first guy says: Did you see that?,No the second guy replies. Well, a bald eagle just flew overhead!, the first guy says. ..., A couple of minutes later, the first guy says: Did you see that?. See what? the second guy asks. Are you blind? There was a big, black bear walking on that hill, over there. ..., A few minutes later the first guy says, Did you see that?. By now, the second guy is getting angry, so he says Yes, I did!. And the first guy says Then why did you step in it?. Muahahahaha!! Another one?",
[4] = "In the Green Claw Swamp a dwarf was found, tied up with chains, gagged and with a heavy rock wrapped on his chest. The guard finding him says, Damn dwarfs, they always steal more than they can carry! Muahahahaha!"
}
local function think(cid)
local r = math.random(300)
if voices[r] then
doCreatureSay(getNpcCid(), voices[r], TALKTYPE_YELL)
end
return true
end
local q = ShopModule:new()
npcHandler:addModule(q)
q:addBuyableItem({'bag'}, 7737, 500, 0, 'bag')
q:addBuyableItem({'bag'}, 7739, 1500, 0, 'bag')
q:addBuyableItem({'bag'}, 7738, 1000, 0, 'bag')
q:addBuyableItem({'party hat'}, 6578, 800, 0, 'party hat')
q:addBuyableItem({'party trumpet'}, 6572, 80, 0, 'party trumpet')
local function say(cid, type, msg)
local n
if not npcHandler:isFocused(cid) then
if msgcontains(msg, 'hello') or msgcontains(msg, 'hi') then
selfSay("YOU DARE TALKING TO ME, MORTAL?!! ... Relax, it's just a {costume}. Welcome to Stan's!", cid)
npcHandler:addFocus(cid)
else
return
end
elseif msgcontains(msg, "joke") then
local s = getCreatureStorage(cid, 123) < 5
selfSay(s and "I only know five jokes but they are hilarious! Do you want to hear one?" or "Sorry, I don't know any more jokes.", cid)
n = s and 2
elseif t[cid] == 2 and msgcontains(msg, "yes") then
local s = getCreatureStorage(cid, 123)
selfSay(jokes[s], cid)
doCreatureSetStorage(cid, 123, math.max(1, s + 1))
n = s < 4 and 2
elseif t[cid] == 1 and msgcontains(msg, "uncommon") then
selfSay("It's getting warmer! In this category you will get one of five costumes in good quality and therefore for 1000 Gold! ..., You will be amazed of these costumes, I promise! Just ask me for a {trade}.", cid)
elseif t[cid] == 1 and msgcontains(msg, "common") then
selfSay("This is the cheapest. For 500 gold you get one of five common costumes. Spectacular, but if you know the 'creature illusion' spell, you may be disappointed. ...,But if you and your friends want to dress up as an orc horde for example, it will be the perfect deal for you! Just ask me for a {trade}.", cid)
elseif t[cid] == 1 and msgcontains(msg, "deluxe") then
selfSay("I knew you are a deluxe guy! Your friends will be astonished about your costume! You will get one of five costumes of the finest quality you will ever face in your life!! ...,I ruin myself but I will give it to you for only 1500 Gold! Just ask me for a {trade}.", cid)
elseif msgcontains(msg, "bye") then
selfSay('Cheerio!', cid)
npcHandler:releaseFocus(cid)
elseif msgcontains(msg, "costume") then
selfSay("Making these costumes is not as easy as it seems. Have you ever asked yourself how an adult human fits into a dwarf costume? Well, you won't learn it from me! ..., Otherwise everyone opens up a costume shop ruining my life AGAIN! Anyway I can offer you costumes in three categories: 'common', 'uncommon' or 'deluxe'. Which category are you interested in?", cid)
n = 1
elseif msgcontains(msg, "name") then
selfSay("Stanley Montgomery Edward Wilson Jaydon Alverton at your service! Just say Stan!", cid)
elseif msgcontains(msg, "job") then
selfSay("I own this shop of magical, wonderful, unsavoury, frightening and cuuuuute costumes! My name is Stan and I'm at your service!", cid)
elseif msgcontains(msg, "offer") then
selfSay("You can buy party hats and party trumpets from me. In addition I can offer you costumes in the very best quality you can get! If you know someone selling better costumes than me, tell me his name and I go and kill that guy! Hahahaha, just kidding! ..., Now serious, I can offer you costumes in three categories: 'common', 'uncommon' or 'deluxe'. Which category are you interested in?", cid)
n = 1
elseif msgcontains(msg, "party") then
selfSay("Hurray!", cid)
doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
doSendMagicEffect(getNpcPos(), CONST_ME_GIFT_WRAPS)
end
t[cid] = n
return true
end
npcHandler:setMessage(MESSAGE_SENDTRADE, 'Have fun with your carnival stuff and recommend me to your friends!')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Cheerio!')
npcHandler:setCallback(CALLBACK_ONTHINK, think)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, say)
q:addBuyableItem({'bag'}, 7737, 500, 0, 'bag')
q:addBuyableItem({'bag'}, 7739, 1500, 0, 'bag')
q:addBuyableItem({'bag'}, 7738, 1000, 0, 'bag')
q:addBuyableItem({'party hat'}, 6578, 800, 0, 'party hat')
q:addBuyableItem({'party trumpet'}, 6572, 80, 0, 'party trumpet'
bump Thanks! but the bag should be able to hold for like 5 hoursmine hold for like 5 seconds XD Is It possible to change?
local t = {
[7737] = {7, 96, 214, 70, 23},
[7738] = {47, 237, 78, 257, 99},
[7739] = {220, 35, 244, 55, 87}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
doRemoveItem(item.uid)
local k = t[item.itemid]
doSetCreatureOutfit(cid, { lookType=k[math.random(#k)] }, 18000000)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
return true
end
messages will be too long (over 255?) so they won't be sentSome noobs modifications for who uses latests revisions, with no talkdaly in convesation ;//, but is all working, jokes and etc.
use functions from thunderion's npc lib or search for doNPCTalkALotHey, how can i do this delay system work with the latest's revision os tfs 0.4 ?
was testing & forgot to change
messages will be too long (over 255?) so they won't be sent
use functions from thunderion's npc lib or search for doNPCTalkALot