Modding Tutorials/Rituals
This is a basic overview of how Rituals work and is still in progress
Rituals start with a RitualPatternDef
which have a ritualBehavior
that links to a RitualBehaviorDef
. RitualBehaviorDef
has stages that rituals go through. Each stage has a defaultDuty
with the ability to designate a duty for each role.
RitualPatternDef
s have a ritualOutcomeEffect
which controls what the different possible outcome levels are and how the different participants and roles affect the score. If you're just using XML, it doesn't directly specify the reward of the outcome, just how the quality is determined. For that, most rituals should allow players to choose their own rewards. The rewards a player can choose from are defined with RitualAttachableOutcomeEffectDef
s. For examples of RitualAttachableOutcomeEffectDef
s, take a look into the file at Data/Ideology/Defs/PreceptDefs/Ritual_AttachableOutcomes_Special.xml
. Here's an example from that file:
<RitualAttachableOutcomeEffectDef>
<defName>GauranlenTreePod</defName>
<workerClass>RitualAttachableOutcomeEffectWorker_GauranlenPosSprout</workerClass>
<label>gauranlen pod sprout</label>
<effectDesc>a Gauranlen pod will sprout at a random location on the map, if it can.</effectDesc>
<letterInfoText>A Gauranlen pod sprouted nearby.</letterInfoText>
<requiredMemeAny>
<li>TreeConnection</li>
<li>NaturePrimacy</li>
</requiredMemeAny>
</RitualAttachableOutcomeEffectDef>
The workerClass
of the attachable outcome is what actually applies the reward to a ritual, based on the quality as defined by the RitualOutcomeEffectDef
. If you want to have completely new rewards you'll need C#, likewise if you want to have completely new behaviors during the rituals. But if you're just interested in defining a ritual and not the outcome, and you don't want completely custom behavior, then you should be able to do it in XML
For reference, the built-in attachable outcomes are:
Royalty:
RitualAttachableOutcomeEffectWorker_PsyfocusRecharge
Ideology:
RitualAttachableOutcomeEffectWorker_FarmAnimalsWanderIn
RitualAttachableOutcomeEffectWorker_GauranlenPosSprout
RitualAttachableOutcomeEffectWorker_InsectJellyTunnels
RitualAttachableOutcomeEffectWorker_NearbyFactionGoodwill
RitualAttachableOutcomeEffectWorker_RandomRecruit
RitualAttachableOutcomeEffectWorker_DiscoverAncientComplex