esuriddick Posted April 18, 2023 Share Posted April 18, 2023 Hi everyone. I'm trying to update one of my mods (Simple Thrall Management) with a new function to force the summoned or reanimated NPC/creature to hunt for nearby enemies. For that purpose, I created a quest to have an alias with an AI package to force the ordered summon/reanimation to follow its rule and patrol the area. Once the player orders the thrall to "Hunt", the summon/reanimation is assigned to the alias. This has worked perfectly for summons, with them immediately adopting the AI package associated with the quest alias. However, any reanimated NPC or creature simply ignores the AI package from the quest alias. I have identified their AI package (e.g., DefaultMasterPackage) and I have even attempted to add a condition to that AI package to ensure that it stops functioning when the thrall is assigned to the quest alias by checking whether the owner of the AI package has a spell (basically an aura to help the player detect where the summon/reanimation is). I have also tried to raise the quest priority from 100 to 999, but to no avail. I've also tried to identify any quest that could somehow override the AI package from the quest alias, but I was unable to identify one for reanimations. Any suggestion or assistance is welcome, as I believe I have reached a dead end. Thanks. Best regards,esuriddick Link to comment Share on other sites More sharing options...
Sphered Posted April 20, 2023 Share Posted April 20, 2023 Been a while since I had issues with AI conflict, but try making the Quest priority a lower number, like a single digit. If I recall, lower number means higher AI priority. Just a suggestion, to rule out that possibility Link to comment Share on other sites More sharing options...
esuriddick Posted April 22, 2023 Author Share Posted April 22, 2023 I was only now able to test this out. I set it at 0 and the same issue occurred. I have my quest back to priority 100, and I have tried previously to apply a priority of 999, as my research showed that the highest priority, the better to apply AI. If you have any other suggestion, let me know :) Link to comment Share on other sites More sharing options...
Sphered Posted April 22, 2023 Share Posted April 22, 2023 Kind of a troubleshoot situation then. Try just placing one and setting alias to that, without a spell cast involved. See if it obeys AI then. Beyond that I would imagine a condition is in play keeping AI package/s from being followed. Like with a commanded actor, I do not believe they are considered teammate. So if IsTeammate is a condition somewhere the package would fail, for example Link to comment Share on other sites More sharing options...
esuriddick Posted April 22, 2023 Author Share Posted April 22, 2023 I've tried to set up a condition, but the AI package in use by the reanimated creature/NPC changes depending on who or what you are reanimating. Nevertheless, when I set the condition, for instance, to the DefaultMasterPackage, they still ignored the quest alias's AI package. Only the conjured ones happily accept the AI :s Link to comment Share on other sites More sharing options...
maxarturo Posted April 22, 2023 Share Posted April 22, 2023 (edited) There are a plethora of 'hard coded' functions in the game, such as 'soul trapping' which you can't manipulate directly, only through an SKSE plugin, but this requires C++ knowledge. Now, a reanimated npc runs the 'resurrect()' Papyrus command, which in turn runs a hard coded C++ set of lines that makes the npc lose its ability to talk and behave in a specific way, like brainless for example / degradation of its AI. These C++ lines is what govern/control the npc for the time that the magic effect is set to run. This is what you need to overwrite with an SKSE plugin. The best practical solution would be to obtain the dead actor's 'actor base ID' and then replace it. Edited April 22, 2023 by maxarturo Link to comment Share on other sites More sharing options...
esuriddick Posted April 22, 2023 Author Share Posted April 22, 2023 Hi maxarturo.I was afraid that this would be the case. I don't know C++ and I know it is a far too heavy language for me to learn just for this purpose.Could you please provide more details on this practical solution of yours? Link to comment Share on other sites More sharing options...
maxarturo Posted April 25, 2023 Share Posted April 25, 2023 (edited) The idea is simple, but requires scripting, by using: ActorBase Function GetActorBase() ActorBase Function GetLeveledActorBase() native we obtain the base actor, and when the magic effect finishes the reanimating process / when the reanimating animation finishes: - We remove the reanimated npc, the npc is moved to a 'dump cell'. - We place a new of the same kind npc in the exact position and direction / angle of the removed npc, we cover this transition with some visual effects, to hide this blink of the actor when it gets replaced. - The 'replacer' npc runs on a timer that determines when it should die. But. all of this would be a much more easy thing to achieve if we were talking about making this work on "Your Mod", meaning: - With your custom made actors - With your custom made spell - In your custom made cells But, as I suspect you want this to work with the vanilla spell / magic effect in any random cell. Here there are 3 major issues: 1) You will get stuck with the 'Ash Pile' the reanimated npc leaves behind when it dies, because we need to kill the 'reanimated' npc so that the new one takes its place. This is managed by a secondary magic effect on the spell that places the ash pile, so the vanilla spell and ANY other similar spell (custom or not) that uses those magic effect will always leave behind an ash pile. * Moving the npc to 'dump' cell is not an option here, because we are talking about random actors in random cells, and this can cause major issues to the game and/or a mod, if that npc is supposed to run something in that cell. Simple example: The npc carries a journal that starts a quest. 2) How to apply your scripts to the vanilla spell, and how to get rid of the 'blink' vfx without touching the vanilla spell / without making any 'dirty edits'. 3) And the most important of all: How to obtain whether the actor is an LVL actor or not. The default Papyrus language has not such a function. There isn't an "IsLeveled" actor function. SKSE could have, but I don't know. However, this can be achieved, but requires a certain level of knowhow. Edited April 25, 2023 by maxarturo Link to comment Share on other sites More sharing options...
Recommended Posts