[DiscordArchive] Is ```player:GetQuest():GetName()``` correct, if I want to broadcast the player's current quest?
[DiscordArchive] Is ```player:GetQuest():GetName()``` correct, if I want to broadcast the player's current quest?
Archived author: Foe • Posted: 2023-02-07T20:54:38.935000+00:00
Original source
I'm writing an extension for you
Archived author: Foe • Posted: 2023-02-07T20:54:41.255000+00:00
Original source
gimme a few min
Archived author: adm • Posted: 2023-02-07T20:54:47.932000+00:00
Original source
cheers!
Archived author: Foe • Posted: 2023-02-07T20:56:29.115000+00:00
Original source
```Lua
local questInfo = {}
function questInfo.OnLoad()
questInfo.Cache = {}
local query = WorldDBQuery("SELECT ID, LogTitle, QuestLevel FROM quest_template;");
if(query) then
repeat
questInfo.Cache[query:GetUInt32(0)] = {
title = query:GetString(1),
level = query:GetUInt32(2)
}
until not query:NextRow()
end
end
function Quest:GetInfo()
local title, level = nil, nil
local cache = questInfo.Cache[self:GetId()]
if(cache) then
title = cache.title
level = cache.level
end
return title, level
end
questInfo.OnLoad()```
Archived author: Foe • Posted: 2023-02-07T20:56:49.094000+00:00
Original source
Save that as questInfo.ext
Archived author: Foe • Posted: 2023-02-07T20:57:13.207000+00:00
Original source
then at the top of your script, add ```require("questInfo")```
Archived author: Foe • Posted: 2023-02-07T20:57:43.419000+00:00
Original source
then you can use ```local title, level = quest:GetInfo()```
Archived author: adm • Posted: 2023-02-07T20:59:06.867000+00:00
Original source
Wow, super!
Archived author: adm • Posted: 2023-02-07T20:59:21.759000+00:00
Original source
Thanks a lot! Much appreciated!
Archived author: Foe • Posted: 2023-02-07T21:03:06.006000+00:00
Original source
np