Modding:Conversations: Difference between revisions

m
category and words
(Add event table)
m (category and words)
Line 145: Line 145:
{{Betamoddingcontent}}
{{Betamoddingcontent}}
It's possible to add your own delegates for you to use in XML by adding a <code>[ConversationDelegate]</code> attribute to a static method in C#.<br/>
It's possible to add your own delegates for you to use in XML by adding a <code>[ConversationDelegate]</code> attribute to a static method in C#.<br/>
Depending on the return type it will either be registered as a predicate or action, and variants of the delegate will automatically be created.
Depending on the return type it will either be registered as a predicate (bool) or action (void), and variants of the delegate will automatically be created.


For example the below delegate will automatically create the inversion <code>IfNotHaveItem</code>, and because we set the <code>Speaker</code> attribute parameter, another two (<code>IfSpeakerHaveItem</code>, <code>IfSpeakerNotHaveItem</code>) where <code>Context.Target</code> holds the Speaker instead of the Player.
For example the below delegate will automatically create the inversion <code>IfNotHaveItem</code>, and because we set the <code>Speaker</code> attribute parameter, another two (<code>IfSpeakerHaveItem</code>, <code>IfSpeakerNotHaveItem</code>) where <code>Context.Target</code> holds the Speaker instead of the Player.
Line 211: Line 211:
Unlike min events which cascade down, conversation events will propagate up the element tree from where it was fired (See [https://en.wikipedia.org/wiki/Event_bubbling event bubbling]). This means an event fired on a choice will first be handled by parts on the choice itself, then its parent node, last the node's conversation.
Unlike min events which cascade down, conversation events will propagate up the element tree from where it was fired (See [https://en.wikipedia.org/wiki/Event_bubbling event bubbling]). This means an event fired on a choice will first be handled by parts on the choice itself, then its parent node, last the node's conversation.


Finally the propagation is separated by perspective, Speaker and Listener (the listener being you, the player). In most cases when you attach a part that modifiers the text of a node, you do not want to also modify the text of its underlying choices since those are spoken by a different entity. By default parts will register for the perspective they are placed in, but can be overriden with the <code>Register</code> attribute.
Finally the propagation is separated by perspective, Speaker and Listener (the listener being you, the player). In most cases when you attach a part that modifies the text of a node, you do not want to also modify the text of its underlying choices since those are spoken by a different entity. By default parts will register for the perspective they are placed in, but can be overriden with the <code>Register</code> attribute.
<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
<conversation ID="EventfulSnapjaw">
<conversation ID="EventfulSnapjaw">
Line 400: Line 400:
| IfIn100
| IfIn100
| Predicate
| Predicate
| Continues if the randomly rolled value is below or equal to the specified value.
| Continue if the randomly rolled value is below or equal to the specified value.
| No
| No
| No
| No
Line 406: Line 406:
| IfGenotype
| IfGenotype
| Predicate
| Predicate
| Continues if the target is of the specified genotype.
| Continue if the target is of the specified genotype.
| Yes
| Yes
| Yes
| Yes
Line 412: Line 412:
| IfSubtype
| IfSubtype
| Predicate
| Predicate
| Continues if the target is of the specified subtype.
| Continue if the target is of the specified subtype.
| Yes
| Yes
| Yes
| Yes
Line 418: Line 418:
| IfTrueKin
| IfTrueKin
| Predicate
| Predicate
| Continues if the target counts as a true kin and can implant cybernetics.
| Continue if the target counts as a true kin and can implant cybernetics.
| Yes
| Yes
| Yes
| Yes
Line 424: Line 424:
| IfMutant
| IfMutant
| Predicate
| Predicate
| Continues if the target counts as a mutant and can gain mutations.
| Continue if the target counts as a mutant and can gain mutations.
| Yes
| Yes
| Yes
| Yes
Line 430: Line 430:
| IfHaveItem
| IfHaveItem
| Predicate
| Predicate
| Continues if the target has an item of the specified blueprint in their inventory or equipped on their body.
| Continue if the target has an item of the specified blueprint in their inventory or equipped on their body.
| Yes
| Yes
| Yes
| Yes
Line 436: Line 436:
| IfWearingBlueprint
| IfWearingBlueprint
| Predicate
| Predicate
| Continues if the target has an item of the specified blueprint equipped on their body.
| Continue if the target has an item of the specified blueprint equipped on their body.
| Yes
| Yes
| Yes
| Yes
Line 442: Line 442:
| IfHaveBlueprint
| IfHaveBlueprint
| Predicate
| Predicate
| Continues if the target has an item of the specified blueprint in their inventory.
| Continue if the target has an item of the specified blueprint in their inventory.
| Yes
| Yes
| Yes
| Yes
Line 448: Line 448:
| IfHavePart
| IfHavePart
| Predicate
| Predicate
| Continues if the target has a part by the specified class name. Mutations are a variant of a part that this is applicable to.
| Continue if the target has a part by the specified class name. Mutations are a variant of a part that this is applicable to.
| Yes
| Yes
| Yes
| Yes
Line 454: Line 454:
| IfHaveTag
| IfHaveTag
| Predicate
| Predicate
| Continues if the target's blueprint has the specified tag.
| Continue if the target's blueprint has the specified tag.
| Yes
| Yes
| Yes
| Yes
Line 460: Line 460:
| IfHaveProperty
| IfHaveProperty
| Predicate
| Predicate
| Continues if the target game object has the specified property.
| Continue if the target game object has the specified property.
| Yes
| Yes
| Yes
| Yes
Line 466: Line 466:
| IfHaveTagOrProperty
| IfHaveTagOrProperty
| Predicate
| Predicate
| Continues if the target has the specified tag or property.
| Continue if the target has the specified tag or property.
| Yes
| Yes
| Yes
| Yes
Line 472: Line 472:
| IfLevelLessOrEqual
| IfLevelLessOrEqual
| Predicate
| Predicate
| Continues if the target is at or below the specified value.
| Continue if the target is at or below the specified value.
| Yes
| Yes
| Yes
| Yes
Line 569: Line 569:


{{Modding Navbox}}
{{Modding Navbox}}
[[Category:Modding]]