Modding:Lua/Hooks/Quest
Hooks
These quest hooks are stubs for global functions that object scripts can define, which will be called by the C++ engine. No documentation for them is available, but they're mentionned (april 2017) in /assets/quests/scripts/generated/common.lua
init()
Called when the quest is loaded
uninit()
Called when the quest is unloaded
update(dt)
Called each scriptDelta ticks
questOffer()
Called when the quest is offered
questDecline()
Called when the player declines the quest
questStart()
Called when the player accepts the quest
questComplete()
Called when the player completes the quest
questFail()
Called when the player fails the quest
questInteract(entityId)
Called when the player interacts with something?
conditionsMet()
Called when the player meets the requirements to return the quest?
Messages
Alternatively, the C++ engine sends messages to quest scripts which can be handled by message.setHandler()
.
objectScanned
Seems to be sent whenever the player scans an object. Parameters:
objectName
interestingObjects
Seems to be sent whenever the player scans an "interesting" object, in the context of scan-type quests.