Deleted56253002User Posted May 11, 2021 Share Posted May 11, 2021 (edited) So I created a mod which adds over 1,000-2,000 civil war soldiers to Skyrim. I'd like for them to disappear/be disabled once the war is over, but is there a better way than to manually add each individual soldier as a property and disabling them? Are scripts even required? I heard that Immersive Patrols doesn't use scripts and is able to remove their civil war patrols once the war is over. Edited May 11, 2021 by Guest Link to comment Share on other sites More sharing options...
AnishaDawn Posted May 11, 2021 Share Posted May 11, 2021 (edited) If you add a bunch of NPCs to a property, there's a fast way to do that. Create a formlist and just drag the actors to that formlist's window and then add the Formlist as a property in the script. Problem: Formlists are slow, so 2,000 NPCs might take several seconds to iterate through and this doesn't include the use of MoveTo, which would undoubtedly add to the process time. Another way to go about it is with arrays. They are faster than formlists but there's no drag and drop shortcut - you'd have to add each NPC individually in the CK, and then there's the silly 128 element array limit. Finally - I don't know how Immersive Patrols add their NPCs, but if I were to avoid the methods I mentioned above, I'd use an enable parent and hand place all the NPCs. Obviously this will take FOREVER, but after that's done, Enable Parent will enable a whole bunch of NPCs in one go and you could have control over when you want the enabling to happen and so forth. Edited May 11, 2021 by AnishaDawn Link to comment Share on other sites More sharing options...
ANaj Posted May 11, 2021 Share Posted May 11, 2021 (edited) you can set an enable parent like it is done in the player houses, when you buy furniture.- create a marker- in cell view window mark all the objects you want to disable / enable (on your case the NPCs)- right click and set enable parent to the marker you created- in your code write something like if war marker.Enable() marker.EnableLinkChain() else marker.Disable() marker.DisableLinkChain() endif to enable / disable alle the objects linked by this marker don't know if there is a limit to this. because i didn't used it for more than 100 Objects, but it is easy to change within CK.It doesn't need be an marker, you could set a general as enable parent, too. where you link all the soldiers to him. So if the general comes he brings all the soldiers with him :) Edited May 11, 2021 by ANaj Link to comment Share on other sites More sharing options...
maxarturo Posted May 11, 2021 Share Posted May 11, 2021 (edited) Assigning an 'Enable Parent' to a reference has some issues, for example: - The object that has as 'Enable Parent' another reference, their enable/disable state can not be manipulated by any other . - Another example is that the function "SetCriticalStage()" will not fire. The way that i would do it is as follow. Way A: 1) Create a "Holding Cell" which will have all npcs. 2) Create 2 packages for all npcs to leave and return to the cell. Way B: 1) Create groups of npcs 2) Create a unique 'KeyWord', or you can use an existing one. 2) Link Ref each npc to the next one with a keyword to create a "Chain". 3) Then use the functions: ObjectReference Function GetLinkedRef(Keyword apKeyword = None) native Function EnableLinkChain(Keyword apKeyword = None) Function DisableLinkChain(Keyword apKeyword = None, bool abFadeOut = false) Your script should look something like this: ObjectReference NpcLink = GetLinkedRef(MyNPC01KeyWord) ; We first need to obtain and stored the Link Ref Chain NpcLink.EnableLinkChain(MyNPC01KeyWord) ; Now we can enable the Link Chain Note: when this functions are used on actors the first reference in the chain must be another object, like an xMarker, because the first actor in the chain never gets enabled, it's a game engine/papyrus issue. * I use this functions a lot to enable/disable large numbers of npcs with One Single Line. Have a happy modding. Edited May 11, 2021 by maxarturo Link to comment Share on other sites More sharing options...
Recommended Posts