Hello, i've designed a new class for NPC-Tell Histories functions. It's very easy to use and i want to know if you consider it useful or not. I want to know if there is something that must be added, suggestions, etc.
The class works like this
Other features:
The class is added to the npc-system.
The class works like this
Lua:
elseif msg:lower() == "mission" then
local messages =
{
"This is the time of the year where demons try hardest to break through to our world. I try my best to keep them away by spiritually empowering those magical fire basins here in the Temple of Light. ...",
"However, I cannot be everywhere at the same time, and there are ten spots all over Tibia where the layer between our world and the hellish world is especially thin. ...",
"You need to travel to these places within a day after I gave you a magical torch. I summoned a lightbearer's basin there, similar to those here in the temple. ...",
"You have to use the torch on a basin to power its light. Then it will have regain enough energy to burn brightly for another two hours. ...",
"If you look at a basin, you can see how much energy there is still left. As long as all fire basins are burning, no creatures will be able to enter Tibia. ...",
"However, when only one fire basin turns dark and disappears, powerful demons will be unleashed onto this world. ...",
"You have to keep the fire burning for five days, and on the last day the demons will be so weakened that you can dispose of them easily when they come. ...",
"I can give you only one torch which lasts for a day and will then disappear. Also, you can only use your torch ONCE on each basin. ...",
"Thus you need to work together with your fellow Tibians, so that someone can always keep the fire basins burning, on each of the five days. ...",
"I can either give you the torch now - but remember it will only last for a day - or hold onto it for you until your time to be a lightbearer has come. Do you want that torch right now?",
}
local delay = DelayMessages:new(messages, npcHandler)
delay:setDelay(1000)
delay:onStartDelay(function(cid) return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Delay started.") end) --optional
delay:onFinishDelay(function(cid) return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Delay finished.") end)--optional
delay:onMessage(function(cid, message) return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You received a new message from the npc.") end) --optional
delay:start(cid)
--also you can use[[
delay:stop()
]]
Other features:
- If you say nother thing to the npc while it's talking, it won't answer (This requires a 5 lines edit in npchandler.lua)
- If you say 'bye' or disappear while npc is talking, delay-messages will be stopped.
The class is added to the npc-system.