Modding:Conversations: Difference between revisions

From Caves of Qud Wiki
Jump to navigation Jump to search
(WIP a bit more)
m (edit notice)
Line 1: Line 1:
[[Category:Modding]]
[[Category:Modding]]
(THIS PAGE IS ACTIVELY WORK IN PROGRESS BY GNARF, PLEASE REFRAIN EDITS UNTIL THIS REMOVED <3)


Conversations are loaded as templates from <code>Conversations.xml</code> - The base conversations can not be extended or modified through the XML, however there are events that will allow dynamically editing conversations as they happen.
Conversations are loaded as templates from <code>Conversations.xml</code> - The base conversations can not be extended or modified through the XML, however there are events that will allow dynamically editing conversations as they happen.

Revision as of 23:40, 31 May 2019


(THIS PAGE IS ACTIVELY WORK IN PROGRESS BY GNARF, PLEASE REFRAIN EDITS UNTIL THIS REMOVED <3)

Conversations are loaded as templates from Conversations.xml - The base conversations can not be extended or modified through the XML, however there are events that will allow dynamically editing conversations as they happen.

Conversation Object Parts

In order to be conversable, an object should use the CovnersationScript part and attach a ConversationID which references a conversation template from Conversations.xml.

Snippet of ObjectBlueprints.xml that links Mehmet's Conversation to "JoppaMehmet"

  <object Name="Mehmet" Inherits="NPC">
    <part Name="ConversationScript" ConversationID="JoppaMehmet" />
  </object>

Conversation Classes and XML properties

The xml file for conversation consists of a single <conversations> node with multiple <conversation> nodes underneath. It does not currently support extending the base game dialog via Load="Merge" or the other similar tricks used for many of the XMLs. Creating a Conversation.xml file for your mod would be done when you want to add a new specific conversation / template to be used in the game.

Nodes: <conversation> Deserialized: XRL.World.Conversation

property details Description
ID string / required / "key" The conversation ID used to reference this conversation template via a <part Name="ConversationScript" ConversationID="....">
StartNodes List<ConversationNode> C# only. Represents the children <node ID="Start"> (of which there can be multiple)
NodesByID Dictionary<string, ConversationNode> C# only. Represents the children <node> that are not "Start" - the "Start" node will be added here when conversation begins and it is chosen.

Conversation's have children <node> nodes:

Nodes: <node> - Deserialized: XRL.World.ConversationNode

property details Description
ID string / required / "key" The node ID used in other "GotoID" properties, etc. Can contain multiple "Start" nodes, one of which will be selected given the other boolean filter parameters.
Filter string / deprecated A potentailly unused property, it seems to have no code paths calling it
GiveOneItem string / deprecated A seemingly unused string (on node), no code paths in base CoQ reference it
TakeItem string / deprecated A seemingly unused string (on node), no code paths in base CoQ reference it
ClearOwner string / deprecated A seemingly unused string (on node), no code paths in base CoQ reference it
CompleteQuestStep string A comma separated list of QuestID~StepID that will Complete the given quest step when the node is entered (awarding XP, etc)
GiveItem string A comma separated list of BlueprintID that will give items to the player whenever this node is entered.
           NewConversationNode.IfWearingBlueprint = Reader.GetAttribute("IfWearingBlueprint");
           NewConversationNode.IfHasBlueprint = Reader.GetAttribute("IfHasBlueprint");
           NewConversationNode.IfLevelLessOrEqual = Reader.GetAttribute("IfLevelLessOrEqual");
           NewConversationNode.SpecialRequirement = Reader.GetAttribute("SpecialRequirement");
           NewConversationNode.IfHaveQuest = Reader.GetAttribute("IfHaveQuest");
           NewConversationNode.IfHaveItemWithID = Reader.GetAttribute("IfHaveItemWithID");
           NewConversationNode.IfHaveState = Reader.GetAttribute("IfHaveState");
           NewConversationNode.IfNotHaveState = Reader.GetAttribute("IfNotHaveState");
           NewConversationNode.IfNotHaveQuest = Reader.GetAttribute("IfNotHaveQuest");
           NewConversationNode.IfFinishedQuest = Reader.GetAttribute("IfFinishedQuest");
           NewConversationNode.IfHaveObservation = Reader.GetAttribute("IfHaveObservation");
           NewConversationNode.IfFinishedQuestStep = Reader.GetAttribute("IfFinishedQuestStep");
           NewConversationNode.IfNotFinishedQuest = Reader.GetAttribute("IfNotFinishedQuest");
           NewConversationNode.IfNotFinishedQuestStep = Reader.GetAttribute("IfNotFinishedQuestStep");
           NewConversationNode.StartQuest = Reader.GetAttribute("StartQuest");
           NewConversationNode.RevealMapNoteId = Reader.GetAttribute("RevealMapNoteId");
           NewConversationNode.TradeNote = (Reader.GetAttribute("TradeNote") == "show");
           string sClosable = Reader.GetAttribute("Closable");
           if (sClosable != null && sClosable == "false") NewConversationNode.bCloseable = false;


Snippet of Conversation.xml with Mehmet's script

<?xml version="1.0" encoding="utf-8"?>
<conversations>
  <conversation ID="JoppaMehmet">
    <node ID="Start" IfNotHaveQuest="What's Eating the Watervine?">
      <text>
Live and drink, =player.formalAddressTerm=. May you find shade in Joppa.</text>
      <choice GotoID="AboutJoppa1">What can you tell me about Joppa?</choice>
      <choice GotoID="LookingForWork1">I am in search of work.</choice>
      <choice GotoID="End">Live and drink.</choice>
    </node>
    <node ID="Start" IfHaveQuest="What's Eating the Watervine?" IfNotFinishedQuest="What's Eating the Watervine?">
      <text>
Live and drink, =player.formalAddressTerm=. Have you tidings from Red Rock?
      </text>
      <choice GotoID="FinishExploringRedrock1" IfHasBlueprint="Girshling Corpse">Yes. I found bits of gnawed watervine and slew a white spiderling. I carry its corpse with me.</choice>
      <choice GotoID="End">I'm working on it, =pronouns.personTerm=! Live and drink.</choice>
    </node>
    <node ID="Start" IfHaveQuest="What's Eating the Watervine?" IfFinishedQuest="What's Eating the Watervine?">
      <text>
Live and drink, =player.formalAddressTerm=. May you find shade in Joppa.</text>
      <choice GotoID="AboutJoppa2">What can you tell me about Joppa?</choice>
      <choice GotoID="End">Live and drink.</choice>
    </node>
    <node ID="FinishExploringRedrock1">
      <text>
What a hideous thing! I dread the horrors its presence portends. Bring the
corpse to Elder Irudad's hut for the Elder to examine.
      </text>
      <choice GotoID="End">As you say.</choice>
    </node>
    <node ID="LookingForWork1">
      <text>
Some critters are eating our watervine. Faarooq claims he saw one slinking around a vine patch. Ugly little thing, he says; pale white, eight legs, an ear-splitting whine.

I noticed a bit of red dirt in the watervine pool, the same we find in the soil at a nearby &amp;Ycave to the north&amp;y we call &amp;rRed Rock.&amp;y

Travel to &amp;rRed Rock&amp;y and kill as many of these critters as you can. Bring back the corpse of one, too. &amp;GElder Irudad&amp;y will reward your efforts.
</text>
      <choice GotoID="End" StartQuest="What's Eating the Watervine?">I will do as you ask.</choice>
      <choice GotoID="Start">I will perform no such peasant's task.</choice>
    </node>
    <node ID="AboutJoppa1">
      <text>
You would be wise to speak with &amp;GElder Irudad.&amp;y Look for his hut to the north.
    </text>
      <choice GotoID="LookingForWork1" IfNotFinishedQuest="What's Eating the Watervine?">I am in search of work.</choice>
      <choice GotoID="End">Live and drink.</choice>
    </node>
    <node ID="AboutJoppa2">
      <text>
You would be wise to speak with &amp;GElder Irudad.&amp;y Look for his hut to the north.
</text>
      <choice GotoID="End">Live and drink.</choice>
    </node>
  </conversation>
</conversations>