Skip to main content

Quest

Template for server-side quest handlers.

Functions

new

Quest.new(
PlayerPlayer,
ProfileDataModule.Profile
) → ()

Creates a new Quest instance.

Init

Quest:Init() → ()

Called when the quest is initialized. Any setup should be done here.

Errors

TypeDescription
"Attempted to yield inside Start function!"Thrown if the function yields.

CheckProgress

Quest:CheckProgress() → ()

called every .Heartbeat to track quest progress; use self.CurrentGoal to perform logic. Since this is called every frame, anything that yields or is computationally expensive shouldn't be ran. NOTE quests save across sessions, so self.CurrentGoal may not start from the first one.

OnStateUpdate

Quest:OnStateUpdate(
Statestring,
...any
) → ()

Called when the quest's state is updated, such as when a quest is completed or failed. State is the name of the state, and ... is the arguments passed to the state.

End

Quest:End() → ()

Called when a quest ends to remove any data in-memory, despawn NPCs, etc. Internally before this is called, the Quests table in the player's profile will be wiped.

Show raw api
{
    "functions": [
        {
            "name": "Init",
            "desc": "Called when the quest is initialized. Any setup should be done here.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "errors": [
                {
                    "lua_type": "\"Attempted to yield inside Start function!\"",
                    "desc": "Thrown if the function yields."
                }
            ],
            "source": {
                "line": 33,
                "path": "src/ServerStorage/Modules/Quests/QuestHandlers/Server_QuestTemplate.lua"
            }
        },
        {
            "name": "CheckProgress",
            "desc": "called every `.Heartbeat` to track quest progress; use `self.CurrentGoal` to perform logic.\nSince this is called every frame, anything that yields or is computationally expensive shouldn't be ran.\n**NOTE** quests save across sessions, so `self.CurrentGoal` may not start from the first one.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 38,
                "path": "src/ServerStorage/Modules/Quests/QuestHandlers/Server_QuestTemplate.lua"
            }
        },
        {
            "name": "OnStateUpdate",
            "desc": "Called when the quest's state is updated, such as when a quest is completed or failed.\nState is the name of the state, and ... is the arguments passed to the state.",
            "params": [
                {
                    "name": "State",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 42,
                "path": "src/ServerStorage/Modules/Quests/QuestHandlers/Server_QuestTemplate.lua"
            }
        },
        {
            "name": "End",
            "desc": "Called when a quest ends to remove any data in-memory, despawn NPCs, etc.\nInternally before this is called, the Quests table in the player's profile will be wiped.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 46,
                "path": "src/ServerStorage/Modules/Quests/QuestHandlers/Server_QuestTemplate.lua"
            }
        },
        {
            "name": "new",
            "desc": "Creates a new `Quest` instance.",
            "params": [
                {
                    "name": "Player",
                    "desc": "",
                    "lua_type": "Player"
                },
                {
                    "name": "Profile",
                    "desc": "",
                    "lua_type": "DataModule.Profile"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 49,
                "path": "src/ServerStorage/Modules/Quests/QuestHandlers/Server_QuestTemplate.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Quest",
    "desc": "Template for server-side quest handlers.",
    "source": {
        "line": 22,
        "path": "src/ServerStorage/Modules/Quests/QuestHandlers/Server_QuestTemplate.lua"
    }
}