Grummulthrus Posted March 12, 2021 Share Posted March 12, 2021 What steps must be taken in the Creation Kit to make an NPC cast a self-buff as part of its routine combat actions? This is what I've tried. What am I doing wrong? ================================================================================= Attempt 1: Magic Effect "AI Score" Steps1. click Magic/Magic Effect, click custom effect.2. click Script Effect Data, click AI Score, change value.3. (optional, I think, for discussion purposes) click Delay Time, change value, click OK, save. Tests AI Score values from 1.0 to 100000.0 in powers of 10. Secondary dummy Magic Effect (e.g. a heal for 1 hp) added to the buff spell, with a huge AI Score (e.g. 100000.0). Results No change in NPC behavior at any AI Score. NPC still won't cast the spell, even at low health. (Is AI Score even used in the game? I can find only four effects with non-null AI Score values. I've never seen an NPC use an ability with one.) ================================================================================= Attempt 2: Combat Override Package Steps1. click Character/Package, right click New.2. set these:Package Type -> PackageInterrupt Override -> CombatUnder Public Package Data, I change these:Spell -> custom spellTarget -> selfCastTimeMin -> 0.5CastTimeMax -> 1.03. click tab Flags, I check Ignore Combat.4. click OK.5. click Miscellaneous/Form List. right click New. assign a name in field ID.6. click Character/Package. drag package name into list.7. click Actor. click the NPC. click tab AI Packages. assign my new form list to dropdown box Combat Override Package List. click OK and save. Tests Assign to custom NPC in Combat Override Package List Assign to existing NPC in Combat Override Package List Create duplicate NPC with different AI package and custom AI in Combat Override Package List Create duplicate NPC, assign only my package in the AI Package list, leave the Combat Override Package List blank Results (All four tests have an identical result) Completely breaks NPC combat AI. NPC casts spell once and only once. NPC does nothing else, not even recasting the same spell, until it exits combat. I assume that there's some kind of AI behavior inheritance, which combat override packages break, but I can find no documentation on what that is or how or where to integrate it with custom packages. ================================================================================= Attempt 3: Papyrus Script Steps 1. Add code like the sample below to a custom NPC script, with appropriate variables initialized in Properties. Scriptname NPC_script extends Actor Spell Property MySpell Auto Event OnCombatStateChanged(Actor akTarget, int CombatState) if (CombatState == 1) MySpell.cast(self, self) endif EndEventTests Attach script to custom NPC Results Spell "casts", sure, but a Papyrus cast has no animations, uses no Magicka, and doesn't care if the NPC doesn't know the spell. Also, and obviously, that buff is never going to be recast, because the script only does it once. ================================================================================= These are, AFAIK, the exact and only procedures suggested in forum posts (here and elsewhere) to force NPCS to custom spell cast. Surely there's a way to make this happen. Link to comment Share on other sites More sharing options...
thumbincubation Posted March 12, 2021 Share Posted March 12, 2021 1st, I have zero scripting knowledge. Take this with a grain of salt. That being said, there is definitely a way to make this happen, as AFT has a tweak spell feature which allows you to both assign spells and assign when they're cast (ie: at combat start, at half health, at 3/4 health, etc.) If I recall correctly the original author's permissions were pretty open, as far as being able to use portions of code in your own mods. You might download the original from the "oldrim" nexus, then give that feature a look and see how it was done. I used it frequently, over several long game on both "oldrim" and Special Edition, to make NPCs cast atronachs at combat start and healing spells at half health, and it never failed me. I didn't notice it early on, because I had never messed with the bashed patch tweaks before, but once I started experimenting with multiple summons, I began to notice they would cast again and again, as needed, so I think that might fit your bill. Hope it helps. Link to comment Share on other sites More sharing options...
Grummulthrus Posted March 13, 2021 Author Share Posted March 13, 2021 AFT here means "Amazing Immersive Follower Tweaks", I take it? Link to comment Share on other sites More sharing options...
thumbincubation Posted March 13, 2021 Share Posted March 13, 2021 (edited) Amazing Follower Tweaks. I believe there is also an immersive version, but I have never used it, so I don't know what functionality it kept. Edited March 13, 2021 by thumbincubation Link to comment Share on other sites More sharing options...
Recommended Posts