pxd730615 Posted September 17 Share Posted September 17 (edited) I am working on an outfit mod, and when NPC is a follower and switching cells, the clothing will change. I tried using Event On CellDetach(), but it didn't work. I want to ask what event or other methods can be called before switching cells. or how to disable follower auto equiped? I found follower auto equiped before call event oncelledtach. thank . Event OnCellDetach() if iactor.IsPlayerTeammate() IsFollower = true iactor.SetPlayerTeammate(false) else IsFollower = false endif EndEvent Event OnLoad() if iactor.IsPlayerTeammate() Debug.Notification("...is PlayerTeammate") else Debug.Notification("...not PlayerTeammate") endif OutfitManageNative.SetHairColor(iactor, haircolor) EndEvent Edited September 17 by pxd730615 Link to comment Share on other sites More sharing options...
xkkmEl Posted September 17 Share Posted September 17 You may want to try this method: https://ck.uesp.net/wiki/Detect_Player_Cell_Change_(Without_Polling) Link to comment Share on other sites More sharing options...
pxd730615 Posted September 17 Author Share Posted September 17 thank, I try to find a way to call a event , before follower auto equiped, not after. your method use OnCellDetach() is after. Link to comment Share on other sites More sharing options...
pxd730615 Posted September 17 Author Share Posted September 17 My English is very poor, maybe I haven't understood your method yet. I'll try again. Thank you very much. Link to comment Share on other sites More sharing options...
xkkmEl Posted September 17 Share Posted September 17 The method uses a marker to note where the player was, and a magic effect with a condition (getInSameCell) to detect when the player has moved to another cell. The OnCellDetach event only works as a failsafe in case the condition on the magic effect fails to trigger. There are circumstances where the marker will detach before the magic effect sees it, and the getInSameCell condition is not reliable when that happens. Let me know privately if french or spanish would make it easier. Link to comment Share on other sites More sharing options...
xkkmEl Posted September 17 Share Posted September 17 OnCellDetach does not fire when you walk from cell to cell. It does fire when you fast travel (there's a subtle technical detail I'm leaving out). GetInSameCell does detect cell changes when you walk from cell to cell. It does not always detect when you fast travel. The method I pointed to combines them to make a reliable solution, and silently takes care of the technical detail. Link to comment Share on other sites More sharing options...
PeterMartyr Posted September 17 Share Posted September 17 I have never done this concerning outfits and NPC, but back in 2012 I did use a Mod that had this functionally, example Follower on entering a city remove armor and wear clothing.. also upon entering an citadel they would wear more fancy upper class clothing, they also include their source code and have this attrition rule.. IF their Code is 80% of your Mod, you must give credit. If you just use a small portion, no attrition is required. Yes it also has on exiting a city put on your armor.. https://www.nexusmods.com/skyrim/mods/15524? BTW I got no idea if the source code included (packed in a bsa) it was many many many years ago, I just recall it was, you may need to unpack and decompile it.. take a look at how they did it, you can copied them or at the very least work out the correct events and use your own code. Link to comment Share on other sites More sharing options...
pxd730615 Posted September 18 Author Share Posted September 18 6 hours ago, PeterMartyr said: t had this f 8 hours ago, xkkmEl said: OnCellDetach does not fire when you walk from cell to cell. It does fire when you fast travel (there's a subtle technical detail I'm leaving out). GetInSameCell does detect cell changes when you walk from cell to cell. It does not always detect when you fast travel. The method I pointed to combines them to make a reliable solution, and silently takes care of the technical detail. Thank you, I have tried this method. In fact, before the magic is activated, the followers have already been automatically equipped (following the player to another cell). Link to comment Share on other sites More sharing options...
pxd730615 Posted September 18 Author Share Posted September 18 (edited) 13 minutes ago, pxd730615 said: Thank you, I have tried this method. In fact, before the magic is activated, the followers have already been automatically equipped (following the player to another cell). Thank you for your reply. I already know the method you mentioned, which is to equip armor (set non replaceable). The problem I want to solve here: if the follower is naked and there is a armor in the bag. When switching cells, followers will automatically equip this armor. I am looking for a way to stay naked without equip armor. that is, find a way to SetPlayerTeammate(false) before switching cells. this is what i looking for. Edited September 18 by pxd730615 Link to comment Share on other sites More sharing options...
pxd730615 Posted September 18 Author Share Posted September 18 (edited) 11 hours ago, xkkmEl said: OnCellDetach does not fire when you walk from cell to cell. It does fire when you fast travel (there's a subtle technical detail I'm leaving out). GetInSameCell does detect cell changes when you walk from cell to cell. It does not always detect when you fast travel. The method I pointed to combines them to make a reliable solution, and silently takes care of the technical detail. Based on your suggestion, finally found a solution. 1. Modify PlayerFollowerPackage and add condition : GetInSameCell = 1 2. Add a teleport Package for follower, condition : GetInSameCell = 0, and add script: Scriptname PlayerFollowerTeleport Extends Package Hidden Actor property PlayerRef Auto Function Fragment_0(Actor akActor) if akActor.IsPlayerTeammate() akActor.SetPlayerTeammate(false) Utility.Wait(0.1) akActor.moveto(PlayerRef) akActor.SetPlayerTeammate(true) endif EndFunction 3. tests are perfect. Edited September 18 by pxd730615 Link to comment Share on other sites More sharing options...
Recommended Posts