-
Posts
12 -
Joined
-
Last visited
Nexus Mods Profile
About blackbirdwanderer

Profile Fields
-
Country
Canada
blackbirdwanderer's Achievements
Rookie (2/14)
0
Reputation
-
Help with equip-best-armor script
blackbirdwanderer replied to blackbirdwanderer's topic in Skyrim's Skyrim LE
That's great! I had left this solution posted in hopes it would help someone else not have to reinvent fire. :happy: -
Quick Questions, Quick Answers
blackbirdwanderer replied to Mattiewagg's topic in Skyrim's Skyrim LE
Let me make sure I understand what you are wanting to accomplish. Dialog script fragments A, B & C Each one needs to call a common function that is to be located on a separate script so that it does not need to be replicated on each dialog fragment. Correct? Not quite, no. I'm actually already doing that. I've made extensive use of multiple library scripts I set up for things that are referred to by more than a single site. Multiple because apparently there is an overall character limit, at least through the CK's editor. What I was really trying to accomplish was reducing my overall number of tiny scripts littering the folder (178 at last count) since there are lots of redundancies. Many of them, particularly in dialogue driven menu selections, are simple one liners that call a function from within the library script. If I want that functionality in multiple topics though, such as picking from amongst up to 5 followers (by name), then that's five scripts multiplied by the number of places it occurs. In one place there's a selection from up to 5 followers and 5 captives present (10 dialogue boxes and associated scripts) and the overall dialogue topic is already pretty huge so I'm not going to link it to another one that's equally huge (it nearly breaks the CK if I do). If there was a way to make the add button attach an existing script that would actually execute, I could point to a common fragment .pex file for a lot of these (i.e. It does attach it; it does not, apparently, give you an executable script.) Thanks for the reply though; much appreciated. I'll just continue to pepper out scripts. BTW - I effectively do this with pretty much every script by cut/paste the code into the script fragment via the CK editor/compiler. The only thing I use the fragment editor windows for is to "anchor" the script with a comment like you described. As long as there's something in one of those windows, it doesn't try to overwrite my script with what it thinks is there in those. (But I've been bit a couple of times. :pinch:) -
Quick Questions, Quick Answers
blackbirdwanderer replied to Mattiewagg's topic in Skyrim's Skyrim LE
For @IsharaMeradin, You answered someone else's question here that piqued my interest. I've been attaching scripts to dialogue 'til the cows come home, but I'm starting to consolidate and streamline the scripts in a rather extensive mod. What I'm trying to figure out is if I can point to a common script from a dialogue box. i.e., Not as a fragment. I've done it with other objects where multiples of the same Form type all point to a single script, but dialogue boxes seem to be their own unique kind of animal and only seem to want to execute their own generated scripts. I rename them once they do, but I do pretty much what you describe when it comes to creating the script. The thing that leaves me wondering is the purpose of the "Add" button on the dialogue box editor. It will attach an "outside" script, but in my experiments that script never seems to execute like the self-generated ones. Is there a way to pull this off? If not, isn't the "Add" button sort of pointless? -
Help with equip-best-armor script
blackbirdwanderer replied to blackbirdwanderer's topic in Skyrim's Skyrim LE
Just thought you'd like to know I reinvented the way I was approaching the problem and broke the armor search and equip AI package into two separate packages. The first package is actually one that does nothing but calls the second successively like a subroutine to search for just one item, then decided when to stop calling it when enough of those items are gathered. I ended up thinking of this as a workaround & better way to repeatedly search for things since the AI won't end when so many of whatever are found. What I accidentally discovered was that the system processor loading is handled MUCH more efficiently this way, and the system is not already trying to determine a path to the next objective in the middle of trying to implement the equip-best-armors behavior. I think that battle for CPU resources was what was causing me problems and erratic behavior before, and caused me to have to lengthen the Utility.Wait() pauses. Now, though, believe it or not, this works perfectly even with these tiny 0.05 sec pauses, at least on my medium-capable machine. I tried it without the pauses, and the equip-best didn't work correctly, so apparently any pause is enough to help it along to completion. And it minimized the naked-flash between armors quite a lot. This is the super simple "On End" section of the AI package that I'm calling like a subroutine, and it self-terminates at the end before returning to the parent AI package. (The required SetPlayerTeammate() to make the equip-best behavior work was called earlier by the "parent" AI package.) The key isn't the code, but where it's placed to ensure no equipping happening at the same time as searching/pathing since it doesn't call until the Acquire [item] part of this AI package has completed for exactly one item. Hopefully my description makes sense to someone besides me. -
Help with equip-best-armor script
blackbirdwanderer replied to blackbirdwanderer's topic in Skyrim's Skyrim LE
I haven't tried that, but I'll keep it in mind. I had been given some advice from Migel (the Bathing Beauties Luxury Suite modder) that said, "If you make an NPC naked, and then have it wear something like a ring and take the ring back off again, it will automatically put on the best stuff in its inventory. The game doesn't want your character to stay naked. It tries to dress them." I later discovered (from you!) that this only works if the NPC is a teammate. Now I'm curious how it triggers without the UnequipAll call and/or with a call to EvaluatePackage. Right now, though, I'm chasing my tail with a related part of the mod involving the Acquire package template. I used it to build both the SearchForWeapon and SearchForArmor packages for my mod. What has never seemed to work, however, is that they don't seem to auto-complete (ever) and trigger the OnChange section of the script. If you set the Acquire in SearchForArmor for 4, my NPCs dutifully go out and find 4 pieces of armor . . . and then stand there infinitely. I've built in a couple of workarounds that terminate the package another way, but it still feels like I'm missing something or not understanding how the thing is designed to work. I sort of assumed when acquire >= 1 it wouldn't OnEnd until it had all four, but some debug.notifications are telling me it hits OnEnd after each item. That's fine . . . but it still doesn't ever auto-complete. Any thoughts? [Edit] I just checked in the Procedure Tree for the Acquire behavior, and "Success Completes Package" is indeed checked, so I continue to wonder why it doesn't. -
Help with equip-best-armor script
blackbirdwanderer replied to blackbirdwanderer's topic in Skyrim's Skyrim LE
That's good info on the armor prioritization; thanks. I knew it wasn't as straightforward as just value, but I've not seen anything beyond anecdotal info about the armor skills. I was just trying to convey the general behavior. I had already done what you suggest (I think) in that the junk ring is a unique item that appears nowhere else in the game, though not actually tagged as unique. It only exists for a fraction of a second when any NPC is called to force equip by a script. I was trying to minimize the pauses around the equipitem call since the NPC flashes naked for that time, and two 0.5 sec waits gives a very noticeable interruption. So, entirely for immersion, especially since each NPC I've got doing this searches for one weapon and then for 4 armor/clothing pieces. As they collect each one, the force equip is called so that's a lot of disappeared clothing. The first and last waits (full 1.0 sec) are mostly to make sure there's not another process competing, as well as fine tuning the NPC behavior appearances. i.e., It keeps them from changing clothes "on the run" quite so much. -
Help with equip-best-armor script
blackbirdwanderer replied to blackbirdwanderer's topic in Skyrim's Skyrim LE
[solved] The main question here was a script to have an NPC equip their best equipment. The algorithm for this behavior is built into the game and seems to prioritize item value over effectiveness, so an expensive robe may be preferentially equipped over something with a better armor bonus. Also note that the command akActor.SetPlayerTeammate() is set here and left on at the end of the function. The NPC will not follow the PC, but will mimic weapon equipping and (in theory) sneaking behavior as described in the earlier post. As soon as the teammate behavior is turned off, the NPC will revert to their default outfit on the next cell load unless altered by a call to akActor.SetOutfit(). Thanks to everyone for the help (on this thread and others). I've got it working pretty well in my mod now. I've got NPCs who will go autonomously loot equipment and bodies out to a defined radius and equip the best they find, so if anyone else is trying to do something like this, here's how to make it work: Function Fragment_0(Actor akActor) akActor.SetPlayerTeammate() ; Sets teammate behavior Utility.Wait(1.0) ; pause akActor.Unequipall() ; Unequip everything from the NPC Utility.Wait(0.2) ; pause akActor.EquipItem(SilverRing,1) ; Equip a single ring worth 1 Septim Utility.Wait(0.4) ; pause akActor.Removeitem(SilverRing,1) ; Remove ring & triggers game to equip NPC with best inventory items. Utility.Wait(1.0) ; pause EndFunction Armor Property SilverRing auto ; Defines "trigger" ring used for convenience and unobtrusiveness. I made a junk silver ring with value 1 to equip/unequip to force this behavior and minimize the visual effect of the switch, plus giving the game a very small low load item to render. I added the Utility.Wait() pauses because I noticed erratic behavior. i.e., It didn't always work, and it works nearly 100% with the little pauses. Probably depends on your machine setup (I have 16GB RAM / 2GB VRAM in a laptop) and I expect a higher capability machine may not need them at all. -
The original question that started this thread is a great example of those questions we've all seen. The "this may be a dumb question, but . . ." but as we can see, if you've wondered it, someone else probably has too and putting the question out there often helps others. Team win. :happy: The other side of the coin is that when someone posts a question, be as helpful as you can! We've all benefited from others' feedback so pay it forward. There are some amazing examples on this site of very skilled and experienced people who really go out of their way to assist modders who are learning, and I applaud them!
- 18 replies
-
- creation kit
- mod
- (and 6 more)
-
Help with equip-best-armor script
blackbirdwanderer replied to blackbirdwanderer's topic in Skyrim's Skyrim LE
Great tip! Thank you so much, this works perfectly now, at least in a limited sense. The limitation being when the teammate status is removed, the NPC reverts back to their CK defined default outfit on the next cell re-load. The CK tutorial pages say the following about teammates:NPC will sneak if the player sneaks, stop sneaking if the player stops sneaking. NPC will draw a weapon if the player draws a weapon. NPC will equip their best armor (instead of wearing their default Outfit) Crimes committed by the NPC are considered crimes the player has committed.I'm exploiting the heck out of #3. #1 and #2 don't seem to matter much since just making an NPC a teammate doesn't otherwise invoke a PlayerFollow type AI and this behavior appears to be overridden by any other AI Package active. Difficult to test #4. So is there a down-side to just leaving the freed captive NPC as a teammate? -
It depends on what you changed. I was specifically talking about changes within a script. Once you compile/save a script, yes, it's there to be called upon even if you left the game paused as long as the mod was calling the script anyway. Scripts files live as files outside of the .esp/.esm for the mod you're working on and just get called on by the mod. You would need to reload for any changes to the mod structure within the CK (like dialogue or whatever); in some cases I've made large changes that required unchecking the mod, loading the game without it, then checking it back in again. Did this answer your question?
- 18 replies
-
- creation kit
- mod
- (and 6 more)
-
After spending a lot of time researching and not finding an answer, I'm going to punt and ask for help. Basically, I'm writing a mod where I've got a released/rescued captive NPC in rags who searches the area looking for armor pieces and I've got an AI package that does this quite successfully. What I'm stuck on is evaluating and equipping the best of the collected armors. The BBLS mod had that option I always loved to "Wear your best armor." I was hoping to be able to trigger something like that at the end of the search. Migel (BBLS author) helped a bit, but it's been several years since he wrote it and he's now attacking the problem a different way. He suggested, and I tried, using the game's code to force equip the best items in the NPCs inventory after an UnequipAll script call, by equipping and then removing a disposable ring. This did force an equip behavior, unfortunately it forced back to the default outfit, even if it had been removed. akSpeaker.Unequipall() akSpeaker.EquipItem(SilverRing,1) akSpeaker.Removeitem(SilverRing,1) What ends up happening is the NPC equips whatever remaining items are left from their default outfit as built in the CK. If there are none, then it respawns and equips the entire default outfit. In both cases, it completely ignores all other armors in the NPC's inventory which are of a higher value. Any ideas on how to approach the problem would be appreciated. I did find a thread (https://forums.nexusmods.com/index.php?/topic/2680964-more-ck-scripting-fun-placing-outfit-items-in-inventory/?hl=%2Bequip+%2Bbest+%2Barmor&do=findComment&comment=23525594) with some related ideas about sending items to a remote chest and then pulling them back for a swimming pool undress / dress cycle. I'm not sure if I could adapt something like that for this use.
-
I do it all the time. As long as your machine can handle the load, there has never appeared to be any problem for me and I've been doing it for months. It's actually really useful when testing scripts since they are called dynamically in the game; i.e., you don't have to save the CK mod, just compile the script then go back to the windowed game. I picked that tip up from someone a couple of months ago and it's saved me tons of time.
- 18 replies
-
- creation kit
- mod
- (and 6 more)