User:Kernelmethod/Sandbox: Difference between revisions
Kernelmethod (talk | contribs) m Fix typo |
Kernelmethod (talk | contribs) Shorten the dynamic tables section a bit, add a reference to the Modding:Encounters and Population page |
||
Line 961: | Line 961: | ||
Caves of Qud primarily uses dynamic tables when it needs to be be able to get one of a particular type of item or creature -- for instance, a random type of [[energy cell]] or a random type of [[goatfolk]]. This is useful, for example, for identifying what creatures are able to own a lair. | Caves of Qud primarily uses dynamic tables when it needs to be be able to get one of a particular type of item or creature -- for instance, a random type of [[energy cell]] or a random type of [[goatfolk]]. This is useful, for example, for identifying what creatures are able to own a lair. | ||
There are several ways to create a dynamic table | There are several ways to create a dynamic table: | ||
< | * Through <code>DynamicObjectsTable</code>, such as the <code>DynamicObjectsTable:Baboons</code> table in the previous example. These tables contain all objects explicitly tagged as belonging to that table. | ||
< | * Through the use of <code>DynamicInheritsTable</code>. These tables include all objects that inherit from another object. This inheritance doesn't need to be direct -- for example, even though {{favilink|shrewd baboon}} doesn't inherit from <code>Creature</code> (it inherits from <code>Baboon</code>), it would still fall under the dynamic inherits table for <code>Creature</code> since <code>Baboon</code> inherits from <code>BaseApe</code>, which in turn inherits from <code>Humanoid</code>, and which finally inherits from <code>Creature</code>. | ||
* Through a <code>DynamicSemanticTable</code>. A dynamic semantic table contains all objects that fall into several intersecting categories, such as "medical" and "furniture". | |||
</ | |||
</ | |||
Finally, it's also possible to exclude an object from a dynamic table by using <code>ExcludeFromDynamicEncounters</code>. Check out the [[Modding:Encounters and Population]] page for more information on how dynamic tables work. | |||
{| style = "margin: 1em;font-family:Source Code Pro;" | {| style = "margin: 1em;font-family:Source Code Pro;" | ||
Line 980: | Line 974: | ||
| style = "border:1px solid #155352;padding:0.5em 1em;" | Because snapjaw mages are descended from the Snapjaw object, which in turn ultimately descends from the Creature object, it turns out that snapjaw mages were already included in some population tables before we started writing <code>PopulationTables.xml</code>! In particular, snapjaw mages could appear in the <code>DynamicInheritsTable:Creatures</code> table, although the probability of them being generated was pretty low. | | style = "border:1px solid #155352;padding:0.5em 1em;" | Because snapjaw mages are descended from the Snapjaw object, which in turn ultimately descends from the Creature object, it turns out that snapjaw mages were already included in some population tables before we started writing <code>PopulationTables.xml</code>! In particular, snapjaw mages could appear in the <code>DynamicInheritsTable:Creatures</code> table, although the probability of them being generated was pretty low. | ||
|} | |} | ||
Returning to our mod: there's a <code>Snapjaws</code> dynamic table that we can add our mages to. Doing so is fairly straightforward: open up <code>Creatures.xml</code> and add the following tag at the end of the definition of <code>Pyovya_SnapjawMage_Fire Mage</code> and <code>Pyovya_SnapjawMage_Ice Mage</code>: | Returning to our mod: there's a <code>Snapjaws</code> dynamic table that we can add our mages to. Doing so is fairly straightforward: open up <code>Creatures.xml</code> and add the following tag at the end of the definition of <code>Pyovya_SnapjawMage_Fire Mage</code> and <code>Pyovya_SnapjawMage_Ice Mage</code>: |