quests/README

46 lines
2.0 KiB
Plaintext

quests is a simple quest framework for minetest that lets you define your own quests and handels the representation.
You can see a full list of your active quests with the chatcommand /quests
API:
quests.register_quest(playername, questname, description, max, autoaccept, callback)
-- registers a quest for the specified player
--
-- playername is the name of the player, who gets the quest
-- questname is the name of the quest to identify it later
-- it should follow the naming conventions: "modname:questname"
-- description is shown to the player and should contain usefull information about the quest.
-- max is the desired maximum
-- autoaccept is true or false, wether the result of the quest should be dealt
-- by this mode or the registering mod
-- when autoaccept is true, at the end of the quest, it gets removed and
-- callback is called
--
-- returns true, when the quest was successfully registered
-- returns falls, when there was already such a quest
quests.update_quest(playername, questname, value)
-- when something happens that has effect on a quest, a mod should call this method
-- playername is the name of the player
-- questname is the quest which gets updated
-- the quest gets updated by value
-- this method calls a previously specified callback if autoaccept is true
-- returns true if the quest is finished
-- returns false if there is no such quest or the quest continues
quests.accept_quest(playername, questname)
-- When the mod handels the end of quests himself, e.g. you have to talk to somebody to finish the quest,
-- you have to call this method to end a quest
-- returns true, when the quest is completed
-- returns false, when the quest is still ongoing
quests.abort_quest(playername, questname)
-- call this method, when you want to end a quest even when it was not finished
-- example: the player failed
quests.show_hud(playername)
-- shows the hud to player playername
quests.hide_hud(playername)
-- hides the hud for player playername