Missions are defined in data/json/npcs/missiondef.json and data/json/npcs/npcs.json.
Thereās a bunch of hard-coded parsing behind the scenes, but Iām pretty sure you can add a new quests without adding new code.
Each type of NPC in npcs.json can have a āmission_offeredā string, like
"mission_offered" : "MISSION_OLD_GUARD_REP_1"
Each mission is defined in missiondef.json, like so:
{
"id": "MISSION_OLD_GUARD_REP_1",
"type": "mission_definition",
"name": "Kill Bandits",
"goal": "MGOAL_ASSASSINATE",
"dialogue": {
"describe": "We need help...",
"offer": "I don't like sending untested men into the field but if you have stayed alive so far you might have some skills. There are at least a pair of bandits squatting in a local cabin, anyone who preys upon civilians meets a quick end... execute both of them for their crimes. Complete this and the Old Guard will consider you an asset in the region.",
"accepted": "Contractor, I welcome you aboard.",
"rejected": "The States will remain a wasteland unless good men choose to save it.",
"advice": "They might suspect you are coming, keep an eye out for traps.",
"inquire": "Have you completed your mission?",
"success": "The Old Guard thanks you for eliminating the criminals. You won't be forgotten.",
"success_lie": "What good does this do us?",
"failure": "It was a lost cause anyways..."
}
}
The important bits here are the ānameā, which is what is displayed in your Missions list, the dialogue, which I think is more or less self-explanatory, and the goal. Goals are semi-harded from this list:
MGOAL_FIND_ANY_ITEM, MGOAL_FIND_ITEM - find some item or items
MGOAL_GO_TO_TYPE - move to a specific type of location
MGOAL_KILL_MONSTER - kill a specific monster
MGOAL_ASSASSINATE - kill a specific NPC
MGOAL_KILL_MONSTER_SPEC - kill a bunch of monsters
I donāt think you can currently implement anything but MGOAL_GO_TO_TYPE or MGOAL_FIND_ITEM without some C++ support for the āstartā function. Iām working to fix that, but stuff takes time.
However, you can implement fetch quests! This is the scavenger quest from the Tacoma Commune:
{
"id": "MISSION_RANCH_SCAVENGER_4",
"type": "mission_definition",
"name": "Make 12 Molotov Cocktails",
"goal": "MGOAL_FIND_ITEM",
"difficulty": 5,
"value": 50000,
"item": "molotov",
"count": 12,
"dialogue": { blah blah blah }
}
thereās technically a start function, but all it does it build up the Tacoma Commune - itās not strictly relevant to the quest.
I think you can also implement MGOAL_GO_TO_TYPE but youād have to experiment.
Iām pretty sure the dialogue bits are just standard dynamic lines for npcs, which are heavily documented in doc/NPCs.md.
Iāll try to add a āhow to contributeā doc/thread, though itād would mostly be pointers to other, existing documentation.