Manual:DIL Manual/quests
Jump to navigation
Jump to search
Contents
quests
Field (extraptr, read-only; units: PC).
pc.quests : extraptr
The player's quest list: a list of extras, like .extra, saved with the player. Each quest is an extra whose first name is the quest string, e.g. "Guard Quest Ongoing" or "Guard Quest Complete", and whose description is the text the quests command shows next to it. Zones also keep other markers here (Midgaard's police academy, for one).
The field itself can't be assigned (vmc says "Illegal lvalue"), but the list it gives can be changed: pass it to addextra() and subextra(), test it with "name" in pc.quests and pick an entry with pc.quests.["name"].
Notes
- Players only. On an NPC, an object, a room or null the field fails.
- Use quests.zon's functions rather than hand-made extras:
qstSetOngoing@questsadds the "<name> Ongoing" entry and shows the "New Quest" banner,qstOngoing@questsandqstComplete@questsgive the entry names, andhasQuest@queststests for one. Then thequestscommand shows every quest the same way. - An
extraptrvariable holding one of its entries becomes null at everywaitorpause; look the entry up again afterwards.
Example
dilbegin integer quest_state(pc : unitptr, qname : string);
external
string qstOngoing@quests(qname : string);
string qstComplete@quests(qname : string);
code
{
if (qstComplete@quests(qname) in pc.quests)
return (2);
if (qstOngoing@quests(qname) in pc.quests)
return (1);
return (0);
}
dilend
Tells whether a player has a quest done (2), under way (1) or not at all (0), using the names from quests.zon.