Santy
Member
- Joined
- Aug 14, 2007
- Messages
- 654
- Reaction score
- 22
Code:
luaSys_config = {
john = {
basic = {
farewell = "Feel free to come back and see me again if you need anything!",
greet = "Hello |PLAYERNAME|! Would you like to know some tips? Just let me know if you need {help}.",
walkAway = "See you later.",
idle = "Hello? Ok... please say {hi} to me again if you need {help}.",
appear = "Oh, hey there! Need any help?",
closeChannel = "Hmph!"
},
keywords = { -- "greet" and "farewell" are reserved
name = "My name is John.",
job = "I rake leaves from the streets at night.",
--[[
quest = {"getStorageReturnMessage", {"cid", 1337, { -- cid, storage, messagesArray
["-1"] = "I don't have any quests to send you on right now, sorry.",
["0"] = "Hey... There has been a flying bananapenis bothering me lately. Niggercocks?"
}}},
]] -- equivalent to below, both are working ways to do it
quest = function (cid)
msg = {
["-1"] = "I don't have any quests to send you on right now, sorry.",
["0"] = "Hey... There has been a flying bananapenis bothering me lately. Niggercocks?"
}
storage = 1337
if(msg[tostring(getPlayerStorageValue(cid, storage))]) then
return selfSay(msg[tostring(getPlayerStorageValue(cid, storage))], cid)
end
return error("Player storage value wasn't in array.")
end,
help = "Fucking go experiment man, ain't nobody going to tell you how to live a life."
},
linkage = {
greet = {"hi", "hello", "greetings"},
farewell = {"bye", "laters", "cya"},
help = {"support", "items plx"}
},
shop = {
message = "Pretty nice, right?",
words = {"wares", "trade"},
endTrade = "It was a pleasure doing business with you.",
onBuy = {
success = "Thanks for the money!",
needMoney = "You don't have enough money to buy that.",
needSpace = "Sorry, but you don't have space to take it.",
needCapacity = "I've sold some for you, but it seems you can't carry more than this. I won't take more money than necessary."
},
onSell = {
success = "Here you are.",
needItem = "No item, no deal."
},
items = {
{id=2160, subType=0, buy=10000, sell=10000, name="Test1"},
{id=2152, subType=0, buy=100, sell=100, name="Test2"},
{id=2148, subType=0, buy=1, sell=1, name="Test3"},
{id=2173, subType=0, buy=10000, sell=5000, name="Test4"}
}
}
}
-- shop = nil
}
That's the structure, you'd just have to add that piece of code to a references file, and make a new xml file for the npc. It's all in lua as you can see. Everything in it is optional, if you want to disregard the shop part, just delete it.
There's a prototypical XML file for all of the new npcs, in which you'd just have to edit the name, outfit, and whatnot. All XML files should refer to the same lua script, which holds the functioning.
I'm thinking about selling this on the Market Place once its done. Any suggestions for the system?
Last edited: