Nostradamus
Member
- Joined
- Jun 2, 2007
- Messages
- 219
- Reaction score
- 6
Hello, i am Nostradamus, a not-so-old official OpenTibia developer and i am back into this project. As my first service after my leave, i am doing a NPC system to Avesta. But, i will need some help for something like suggestions and etc. Since i don't have much time to dedicate in OpenTibia currently, i will be accept code improvements or maybe functions already done.
Roadmap
Modules
Ignore the returns types, after i hope all will understand why
Since this script uses object orientation with a default class, there isn't reasons to make conditions considering if there is or not a value, since it will always be called when executing this script. The array "NPC" is a global array that will handle with all NPC scripts and with all the functions of that class.
Strucuture
NPC Example
Who wants to help, i will be giving some access to my SVN server to commit changes.
SVN Link
svn://darghos.com/svn_root/data/branches/revnpcsys/
User: revnpcsys
Pass: 123
P.S: I hope that here there isn't a funny boy to suck the script.
P.S 2: Please put your nickname in the commit to me see who is the contribuitor
Roadmap
- Debugger Strackback (configurable tables and advanced error reporting)
- onTalk event with dynamic uses of talkstates and so on (sub-talkstates will be sub-arrays of the main talkstate refered to it, messages will be handled into arrays with the input and output of the NPC (message and answer subarrays)
- Function to list buying/selling items, teleport places and spells with filders (type of the item -> new element in array (optional): type)
- Easy module integration
- Improve Buy/Sell functions to accept containers with items
- End the usage using a garbage collector
- Messages with delay if the lenght is too big
- Separates modules and handler to waste less memory
- ratePrice should be later a global const for anything who uses money transaction
- Possibility to use XML file or Lua Extras
- OnAccept and OnDecline events
- Long messages splited into short messages with talk delay
Modules
- Promote
- Premium
- Blessing
- Addon
- Quest
- Bank
Ignore the returns types, after i hope all will understand why
Since this script uses object orientation with a default class, there isn't reasons to make conditions considering if there is or not a value, since it will always be called when executing this script. The array "NPC" is a global array that will handle with all NPC scripts and with all the functions of that class.
Strucuture
- Modules (travel, shop, spell, ...)
- Auxiliar functions (functions used by all the script)
- Core (handler of all the system, it will call all the modules, functions, consts)
- Config (a file to configure some uses, later, it will have some options as extras for Forgotten and the usage of LuaSQL)
NPC Example
Code:
-- Start NPC!
NPC = NPC:new()
function onCreatureAppear(cid)
-- soon
end
function onThink()
-- soon
end
function onCreatureDisappear(cid)
-- soon
end
function onCreatureSay(cid, type, msg)
-- soon
end
-- Shop example
John = Shop:new(
BUY_LIST =
{
["item_name"] = {id = , price = , count = }
}
)
-- Dialog example
Dialog = Say:new(
[1] = {{"hi", "hello"}, "hello, my friend"},
[2] = {"use function", useFunction()},
[3] = {"msg with delay", {"msg1", "msg2", "msg3"}, delay = 2000},
)
-- Travel example
Midas = Travel:new(
TRAVEL_LIST =
{
["Thais"] = {price = 100, pos = {x = 100, y = 200, z = 7}, premium = true}
["Edron"] = {price = 150, pos = {x = 200, y = 100, z = 7}, premium = false}
}
-- Quest example
Terry = Quest:new(
["Warlock quest"] = {recipe = {{1234, 1}, {2312, 1}}, award = {{1254, 1}, {1256, 1}}}
)
Who wants to help, i will be giving some access to my SVN server to commit changes.
SVN Link
svn://darghos.com/svn_root/data/branches/revnpcsys/
User: revnpcsys
Pass: 123
P.S: I hope that here there isn't a funny boy to suck the script.
P.S 2: Please put your nickname in the commit to me see who is the contribuitor
Last edited: