public static void setComplete(Thing q) { if (!q.getFlag("IsActive")) { throw new Error("Trying to complete a non-active quest"); } q.set("IsComplete", 1); q.set("IsActive", 0); if (q.handles("OnQuestComplete")) { Event e = new Event("QuestComplete"); e.set("Quest", q); q.handle(e); } Thing parent = q.getThing("Parent"); if (parent != null) { Event e = new Event("SubQuestComplete"); e.set("Quest", q); q.handle(e); } }