JohN100x1 / IsekaiMod

An unbalanced gameplay mod for Pathfinder: Wrath of the Righteous
MIT License
19 stars 10 forks source link

Support for some other spell/content mods #72

Closed Mythalar closed 1 year ago

Mythalar commented 1 year ago

Hey,

In the middle of an archetypical Angel/God Emperor run and having a blast so thanks ^^

As you already did for some content mods, could you add support for Tome of the Firebird and Character options Plus and even Mythic Arcanist (This one is cool with greater magic missiles!) mods which added and still add) quite some useful spells and feats?

Spells support being the main point actually, even if its still possible to add them with Toybox.

Thanks again )

JohN100x1 commented 1 year ago

This is something I can look into. If it's just spells then all that needs to be done is to add their blueprint guid to the isekai protagonist spell list.

Mythalar commented 1 year ago

Nice! Some modded spells are already included, I thought there was some way to hook new spells without adding each one individually but I can be wrong.. (perhaps Truinto succeeded when he allowed to choose all of them in some new Traits)

kjk001 commented 1 year ago

If it is just spells then the "build spellbook by merging the existent spellbooks" option already planned for 4.0 will do what you want @Mythalar , as long as the spell is added to the spellbook of at least one major canon baseclass and this mod is loaded after it.

I will download the Mythic Arcanist, check its internal id and then add that to our info.json for mods to load before us if they are present list for the next release.

Mythalar commented 1 year ago

Well all those spells are added to wizard/cleric/druid spell lists so I guess that will work!

Side question : is there not a way to load Isekai last? Is there any other mod that would not work if not loaded after Isekai ? (Since I guess this mod is the one that hooks on others the most(

kjk001 commented 1 year ago

Well, first of all not all content of a mod is loaded at the same time, a mod can define multiple load steps and assign Priorities to them and then each step is loaded separatly depending on its priority, which allows creating custom content for other mods to hook into while also running patches that definitly have to be applied and should never be overruled by the other mod later.

There are three factors that define when something is loaded, the first is the load priority of the step, ideally all new blueprints of a mod (or at least all that could be used as a hook for another mod to use them and have no outside prerequisites at least) should be defined in a step that has the priority 800 or "Priority.First" as Harmony also names it as a shortcut. Then Patch Operations that operate on these Blueprints should be loaded with lower Priority Values, the short cut list naming them in reverse order:

    {
        public const int Last = 0;

        public const int VeryLow = 100;

        public const int Low = 200;

        public const int LowerThanNormal = 300;

        public const int Normal = 400;

        public const int HigherThanNormal = 500;

        public const int High = 600;

        public const int VeryHigh = 700;

        public const int First = 800;
    }

Where the Priority Last should be reserved for compatibility Patches. For example for things like our spellbook merge or the bugfix on the recursive self inclusion of the deity list in itself that some mod I have caused.

Sadly a lot of mods even do things like defining new blueprints in this last step and then even in steps that are no longer the blueprintscache but startgameloader or similiar things that if at the same priority are loaded slightly later(or are at least in my experience with trying to get a hook into the expanded elements and why it kept failing), whic is the second criteria determining order.

The third factor is then the info.json, this contains a List called LoadAfter that informs the mod that if certain mods are present then they should be considered to always have higher priority if the first two factors are equal.

The priority of our final compatibility patch is as low as I could make it and I have added every major mod that I am aware of to the LoadAfter list of the Isekai Mod and since this is a json it is easy enough to add your own value if you have a mod not listed yet. If you do find such a mod please let me know so I can add it as well.

The new blueprints are as far as possible all declared with priority first. There are a small amount of them like the Dread Knight Legacy that get declared later because they have outside dependencies.

To summarize: There is no definite way to guarantee the mod always goes last, but we can guarantee that it always goes last for all actions of a certain priority step for all known mods unless they declare that they should go after us because they directly have us in their loadafter list. Mods that have us as a dependency should do so and as a result should be fine as long as they do not try to touch the Dread Knight Legacy. If someone does want to build an expansion mod that works by modifying that then I would have to figure out a way to take its definition apart so I can offer a shell they can work on at an earlier step because its current definition already happens about half a dozen steps after I am really comfortable defining a blueprint so I would not encourage anyone to try to define a step with an even lower priority.

kjk001 commented 1 year ago

Also please note this entire load order thing only works for harmony patched mods, there are some weirdos out there that actually produce mods that do not fall into this category and might screw your game load order up even on a good day.

Mythalar commented 1 year ago

That was quite a complete answer!

Thanks for the info