Modding:Conversations: Difference between revisions

→‎XRL.UI.ConversationUI.HaveConversation(): add some extra headings to the beginning
No edit summary
(→‎XRL.UI.ConversationUI.HaveConversation(): add some extra headings to the beginning)
Line 19: Line 19:
== XRL.UI.ConversationUI.HaveConversation() ==
== XRL.UI.ConversationUI.HaveConversation() ==
This is the main loop that handles the conversation start / end and setup.
This is the main loop that handles the conversation start / end and setup.
First, it deep copies the Conversation object as an original template, allowing mods and parts responding to the following events to mutate the nodes as much as they want.
First, it deep copies the Conversation object as an original template, allowing mods and parts responding to the following events to mutate the nodes as much as they want.


=== Staring Conversation: Pick Start Node ===
Then, it checks in order <code>Conversation.StartNodes</code> looking for the first node which passes the <code>ConversationNode.Test()</code> and sets it as <code>Conversation.NodesByID["Start"]</code>
Then, it checks in order <code>Conversation.StartNodes</code> looking for the first node which passes the <code>ConversationNode.Test()</code> and sets it as <code>Conversation.NodesByID["Start"]</code>




=== Modding and Event Hooks ===
Then 3 events will fire in a row - all 3 will cancel the conversation if "false" is returned.
Then 3 events will fire in a row - all 3 will cancel the conversation if "false" is returned.


=== Event: <code>BeginConversation</code> ===
==== Event: <code>BeginConversation</code> ====
Fired on: "Speaker" (not the player)
Fired on: "Speaker" (not the player)
Parameters: <Conversation>"Conversation" and <GameObject>"With" pointing to the player.
Parameters: <Conversation>"Conversation" and <GameObject>"With" pointing to the player.


=== Event: <code>PlayerBeginConversation</code> ===
==== Event: <code>PlayerBeginConversation</code> ====
Fired on: "Player"
Fired on: "Player"
Parameters: <Conversation>"Conversation" and <GameObject>"Speaker" pointing to the person to be talked to.
Parameters: <Conversation>"Conversation" and <GameObject>"Speaker" pointing to the person to be talked to.


=== Event: <code>ObjectTalking</code> ===
==== Event: <code>ObjectTalking</code> ====
Is fired on the speaker when asked to check object talking in the HaveConversation() parameters.  This event would normally be checked before getting this far if you enter via ConversationScript, so before these other events, but can sometimes be fired after.
Is fired on the speaker when asked to check object talking in the HaveConversation() parameters.  This event would normally be checked before getting this far if you enter via ConversationScript, so before these other events, but can sometimes be fired after.