Cycorix Posted August 14, 2021 Share Posted August 14, 2021 (edited) Hiya, have a couple questions about scripting and was really hoping someone could please help me out:I want to create a short Package script (based on SitTarget?) that:1.checks an NPCs location for the nearest furniture (or any usuable object will do) with a particular keyword,2. Uses the result of (1.) as the SitTarget.and if possible, (3. Have all members of a specified Faction follow this Package.). But I will settle for just making a package that sits on the nearest item of furniture! :)Can anyone possibly help with any of these? Thanks!! :smile: I have some scripting experience in other games but am new to Papyrus and CK. Although I have made a lot of progress in the past few days. Edited August 14, 2021 by Cycorix Link to comment Share on other sites More sharing options...
ServantOfSin Posted August 14, 2021 Share Posted August 14, 2021 I'm not sure if there's a better way, but you can add your the furniture objects you want into a formlist and use this function. https://www.creationkit.com/index.php?title=FindClosestReferenceOfAnyTypeInListFromRef_-_Game Link to comment Share on other sites More sharing options...
Cycorix Posted August 14, 2021 Author Share Posted August 14, 2021 (edited) I'm not sure if there's a better way, but you can add your the furniture objects you want into a formlist and use this function. https://www.creationkit.com/index.php?title=FindClosestReferenceOfAnyTypeInListFromRef_-_Game Luckily all the objects I want it to choose are already in a FormList! :smile: I have tried calling this function before but without success. Could you possibly be any more specific as to how to link that function to the SitTarget? (so it picks the closest object to the NPC from that list) Thanks very much for your reply :smile: Edit: so yeah I can get a script to compile with that function in it, it just doesn't seem to do anything (even give a debug note to say that an object has been found). hmmm. Game.FindClosestReferenceOfAnyTypeInListFromRef(zbfListFurnitures, akActor, 500.0) So yeah that function does not return a compiling error (with variables defined), however as said I can neither verify that it does anything, nor relate it to the SitTarget of the actor running the package. Help pleaseee :laugh: EDIT: -On the assumption that there is no way to dynamically assign packages, (even by faction I guess all npcs would have to have the package and just use the faction as a condition to run it?), I realize I probably have to use an alias to assign the package and thus it only saves some, but not huge, amounts of work to do what I want by this route. I've found another way to achieve what I want with Aliases, I may just have to accept that there will be an actor limit to my script (but its relatively easy to replicate, so could be a high limit) Would still be nice to know the answers to any of this though just to expand my scripting knowledge :) thanks again Edited August 15, 2021 by Cycorix Link to comment Share on other sites More sharing options...
ServantOfSin Posted August 16, 2021 Share Posted August 16, 2021 (edited) I need to brush up on my packages, but there should be a way to do it with just packages. You need to assign that function to an ObjectReference. I'm not 100% on this code, but something like this should work. Edit: You can use the find closest reference to assign it to an alias and use a package procedure most likely too. ObjectReference comfyChair comfyChair = Game.FindClosestReferenceOfAnyTypeInListFromRef(zbfListFurnitures, akActor, 500.0) If comfyChair comfyChair.Activate(akActor) Else ;No comfy chair EndIf Edited August 16, 2021 by ServantOfSin Link to comment Share on other sites More sharing options...
Recommended Posts