Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - D&D 5th Edition SRD (http://forums.wolflair.com/forumdisplay.php?f=89)
-   -   Automatically Excluding Beasts from the Ranger Companion List (http://forums.wolflair.com/showthread.php?t=66704)

Fenris447 January 22nd, 2022 03:57 PM

Automatically Excluding Beasts from the Ranger Companion List
 
I've been working on updating SRD monsters in the Community Pack, and in doing so realized that our implementation of the Beast Master's Animal Companion is flawed.

It properly excludes all Large+ creatures, all non-beasts, and all swarms of beasts using a tag expression:

Code:

      searchexpr = "((hasbootstrap:tpBeast) & (RaceSize.Tiny12 | RaceSize.Small11 | RaceSize.Medium0) & !SwarmSize.?)"  & excrace
This is great. But there's another requirement: the beast must not be more than CR 1/4. Because we can't test for fields (rCR is the field for CR) in tag expressions, we had to manually exclude any CR 1/2+ beasts that otherwise fit the requirements:

Code:

      excrace = "& !thingid.rApe & !thingid.rBlackBear & !thingid.rGiantGoat & !thingid.rGiantSea & !thingid.GiantWasp & !thingid.rReefShar & !thingid.rWarhorse & !thingid.r5CJaculi & !thingid.r5CALGtHGo & !thingid.r5CSumBst & !thingid.r5CBstLnd & !thingid.r5CBstSea & !thingid.r5CBstSky"
I realized this list hasn't been updated for stuff like VGM, which had the Deinonychus that needed to be added. But since there's a high likelihood that new beasts will need to be added to the list, I thought we could do better. So I set up a foreach that will look through all beasts that otherwise fit the description, check their CR, and add them to an exclusion tag expression if they should be kept out:

Code:

foreach thing in BaseRace where "((hasbootstrap:tpBeast) & (RaceSize.Tiny12 | RaceSize.Small11 | RaceSize.Medium0) & !SwarmSize.?)"
      if (eachthing.field[rCR].value > 0.25) then
          excrace &= " & !" & eachthing.tagids[thingid.?,""]
          endif
          nexteach

So from now on, we won't need to manually update the list. It'll just pull stuff in automatically and exclude them from selection.

Incoming New Adjustment!

On top of that, I noticed that there have been multiple forum posts asking how to add a creature that otherwise doesn't meet these requirements (like a dragon wyrmling or a displacer beast) as the companion. I'm going to try and design an adjustment that will let you pick any creature and add it to the list as an option. Wish me luck!

jbearwillis January 22nd, 2022 04:06 PM

Nice work....


All times are GMT -8. The time now is 12:27 AM.

Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.