TheGreyNecromancer Posted January 18, 2021 Share Posted January 18, 2021 So, I'm currently working on a script that modifies nearby dead actors' combat style values like the offensive multiplier, actor values and some things if necessary in order to hopefully fix a problem I sometimes i have with reanimated minions that just run away from combat.(Sometimes i'm pretty sure it's due to their actor values but other times i got people like draugr running away for no reason) I want to just make reanimated minions just much more aggressive in general atm. Couldn't find a mod that would fix something like this so i was like hey i'll try making one myself. So i did some dig around the CK website and found the Dynamically Attaching scripts tutorial found here:> https://www.creationkit.com/index.php?title=Dynamically_Attaching_Scripts I've got up to the applying effects script and have tried to think of a way to make the function FindRandomActorFromRef function work but i feel like it's the most suboptimal way of doing grabbing an actor due to it's randomness and doing some while loop stuff with an array and the works(The idea of how i go about doing something like this is still pretty foggy in my head). And so I was wondering, is doing something like the FindRandomActorFromRef function route the most efficient way to grab an actor or could i get away with doing something like making a perk? Probably do something along the lines of attaching a script to it and said perk is distributed on start up to all npcs. The perk's script would basically do the following: >if the player who has the cloak comes into range of X and X(the npc that holds the perk) is dead and has the perk, add the spell(the monitor ability in the dynamic Attaching scripts tutorial which is an ability spell that applies the script that does the actor value and Combat style modifications) to said corpse, changing their actor values and Combat styles to whatever Is something like this reasonable possible? I feel like this would be the perfect way of going about what i want to do but i've read some where(Can't remember where exactly) that perk scripts only work on the player or something. Anyways, thanks for taking the time to read this. Link to comment Share on other sites More sharing options...
Evangela Posted January 18, 2021 Share Posted January 18, 2021 (edited) Outside of SKSE, the FindRandomActorxx functions is the only other way to pick up actors through script and actually do something with them. The other Findxx functions are broken in that they will return arCenter if it's the same type as the thing being searched for, because..the closest thing to arCenter is arCenter :ermm: . Indeed you can run a loop using that function and continually exclude actors that were found, which are already in the array, but it might or might not take a while if the actor comes up say, 20 times, but then you could probably give a wider search radius(note: 4096 is the size of an exterior cell and the radius is 2048). Edited January 18, 2021 by Rasikko Link to comment Share on other sites More sharing options...
dylbill Posted January 18, 2021 Share Posted January 18, 2021 I think using a cloak for this would be best. Cloaks are tricky, look at how a vanilla cloak is set up. The reason they run away has to do with their actor values Aggression and Confidence. I think you can do this without using a script at all. You can have 2 magic effects on the cloak. one of the effect's assoc item 1 spell should be a value modifier that increases aggression, the other confidence. For aggression you want a value of 1 and confidence a value of 4. So, put the condition on the spell GetDead == 1 and GetActorValue aggression < 1. For the confidence spell put < 4. Have the magnitude of the spell be 1. Make sure the Recover box is not checked in the magic effect. The magnitude on the cloak spell is how big the radius is, so I would make it pretty high. Like 500 or so. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 18, 2021 Share Posted January 18, 2021 I think using a cloak for this would be best. Cloaks are tricky, look at how a vanilla cloak is set up. The reason they run away has to do with their actor values Aggression and Confidence. I think you can do this without using a script at all. You can have 2 magic effects on the cloak. one of the effect's assoc item 1 spell should be a value modifier that increases aggression, the other confidence. For aggression you want a value of 1 and confidence a value of 4. So, put the condition on the spell GetDead == 1 and GetActorValue aggression < 1. For the confidence spell put < 4. Have the magnitude of the spell be 1. Make sure the Recover box is not checked in the magic effect. The magnitude on the cloak spell is how big the radius is, so I would make it pretty high. Like 500 or so. Isn't the OP already using a 'cloak' by doing the "dynamically attaching scripts" thing? At least that is how the linked walkthrough on the wiki describes it. Link to comment Share on other sites More sharing options...
TheGreyNecromancer Posted January 19, 2021 Author Share Posted January 19, 2021 (edited) i screwed up quoting and somehow made another post by accident mb lol Edited January 19, 2021 by Nullwastaken Link to comment Share on other sites More sharing options...
TheGreyNecromancer Posted January 19, 2021 Author Share Posted January 19, 2021 (edited) I think using a cloak for this would be best. Cloaks are tricky, look at how a vanilla cloak is set up. The reason they run away has to do with their actor values Aggression and Confidence. I think you can do this without using a script at all. You can have 2 magic effects on the cloak. one of the effect's assoc item 1 spell should be a value modifier that increases aggression, the other confidence. For aggression you want a value of 1 and confidence a value of 4. So, put the condition on the spell GetDead == 1 and GetActorValue aggression < 1. For the confidence spell put < 4. Have the magnitude of the spell be 1. Make sure the Recover box is not checked in the magic effect. The magnitude on the cloak spell is how big the radius is, so I would make it pretty high. Like 500 or so. I see, I'll definitely give this a shot within the next few days when i got the time. Thanks a bunch for your input Outside of SKSE, the FindRandomActorxx functions is the only other way to pick up actors through script and actually do something with them. The other Findxx functions are broken in that they will return arCenter if it's the same type as the thing being searched for, because..the closest thing to arCenter is arCenter :ermm: . Indeed you can run a loop using that function and continually exclude actors that were found, which are already in the array, but it might or might not take a while if the actor comes up say, 20 times, but then you could probably give a wider search radius(note: 4096 is the size of an exterior cell and the radius is 2048). Yea, the other Findxx functions are for sure a no go, at least for this mod. Glad to know that my idea was of looping and excluding actors was reasonable. Might have plans for using it in the future for sure. Thanks for the help @ishara I'll probably remove them if need be and other things, just used the dynamic script tutorial as a sort of foundation to go off of. Appreciate the concern Edited January 19, 2021 by Nullwastaken Link to comment Share on other sites More sharing options...
dylbill Posted January 19, 2021 Share Posted January 19, 2021 No problem, good luck :) Link to comment Share on other sites More sharing options...
Recommended Posts