mimaef Posted February 21, 2017 Share Posted February 21, 2017 So, I've been trying to add keywords to holotapes via scripts so they could be displayed, but to no avail (I'm not a scripter by any means). So I decided to just make my own custom container. I'm fine with it just being a static mesh, but I'd really like it to change from empty to full depending on if there is an item inside or not. I don't need it to display the specific holotape, but just change from one nif to another (empty to full). Is this feasible with a workshop item or is that only viable with a completely static container placed in a cell? Link to comment Share on other sites More sharing options...
shavkacagarikia Posted February 21, 2017 Share Posted February 21, 2017 (edited) I don't think it's possible to dynamically change .nif paths for static mesh. (In skyrim ther was a SKSE function for it, but F4SE isn't capable of doing such things for now). BUT you can still achieve what you want. You will have to create two containers for empty and non-empty conditions. Then place both in world at same place, disable non-empty one and with OnItemAdded detect whenever an item is added to empty container, when that happens disable this container, move everything to non-empty container and enable it. For non-empty container you should use OnItemRemoved and with getitemcount function you will know when items become zero, then you will disable this one and enable empty container. Actually my words may be confusing, I can explain you in more detail after I get to my PC and do some testing myself (If you want to do that in a way I suggested). Edited February 21, 2017 by shavkacagarikia Link to comment Share on other sites More sharing options...
mimaef Posted February 21, 2017 Author Share Posted February 21, 2017 I don't think it's possible to dynamically change .nif paths for static mesh. (In skyrim ther was a SKSE function for it, but F4SE isn't capable of doing such things for now). BUT you can still achieve what you want. You will have to create two containers for empty and non-empty conditions. Then place both in world at same place, disable non-empty one and with OnItemAdded detect whenever an item is added to empty container, when that happens disable this container, move everything to non-empty container and enable it. For non-empty container you should use OnItemRemoved and with getitemcount function you will know when items become zero, then you will disable this one and enable empty container. Actually my words may be confusing, I can explain you in more detail after I get to my PC and do some testing myself (If you want to do that in a way I suggested). I gotcha! I appreciate the help. I'd definitely also appreciate a little more detail whenever you have time. Maybe when F4SE is a little more advanced I can make the full mod I had in mind. Link to comment Share on other sites More sharing options...
shavkacagarikia Posted February 21, 2017 Share Posted February 21, 2017 (edited) First of all I must say that maybe there is a better way to do this but still here it is... 1) Make two containers, one for Empty condition and other for non empty with corresponding paths to nifs. 2) Place them wherever you want (at same place) and make sure that non-empty container is Initially Disabled. 3) Then open Empty Container base object and add following script to it ObjectReference Property EmptyCont Auto Const ObjectReference Property NonEmptyCont Auto Const ;fill these two properties with corresponding container references Event OnLoad() AddInventoryEventFilter(None) GoToState("StartState") endevent State StartState Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) if akSourceContainer == Game.GetPlayer() RegisterForMenuOpenCloseEvent("ContainerMenu") if (EmptyCont.getitemcount() > 0) GotoState("MenuClosing") endif endIf endEvent Endstate state MenuClosing Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening) if (asMenuName== "ContainerMenu") if (!abOpening) EmptyCont.RemoveAllItems(NonEmptyCont,true) EmptyCont.disableNoWait() NonEmptyCont.enableNoWait() endif UnregisterFunc() GoToState("StartState") endif endEvent endstate function UnregisterFunc() UnRegisterForMenuOpenCloseEvent("ContainerMenu") endfunction 4) Now open Non empty one and add following script on it: ObjectReference Property EmptyCont Auto Const ObjectReference Property NonEmptyCont Auto Const ;fill these two properties with corresponding container references Event OnLoad() AddInventoryEventFilter(None) GotoState("StartState") endevent State StartState Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) if akDestContainer == Game.GetPlayer() RegisterForMenuOpenCloseEvent("ContainerMenu") if (NonEmptyCont.getitemcount() == 0) if (Utility.isinmenumode()) GotoState("MenuClosing") else NonEmptyCont.disableNoWait() EmptyCont.enableNoWait() endif endif endIf endEvent endstate state MenuClosing Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening) if (asMenuName== "ContainerMenu") if (!abOpening) NonEmptyCont.disableNoWait() EmptyCont.enableNoWait() endif UnregisterFunc() GoToState("StartState") endif endEvent endstate function UnregisterFunc() UnRegisterForMenuOpenCloseEvent("ContainerMenu") endfunction 5) Thats all, contact me if something goes wrong PS: I had to make script bit more complicated because if you enable object while you are in container menu it stays invisible until you exit it. (That looked really bad as while you were storing stuff in container it was invisible) Edited February 21, 2017 by shavkacagarikia Link to comment Share on other sites More sharing options...
mimaef Posted February 22, 2017 Author Share Posted February 22, 2017 Aah thank you so much! I wasn't expecting that much help, haha. It'll really help with learning the syntax better looking at that too. I'll let you know if anything goes wonky. Link to comment Share on other sites More sharing options...
Recommended Posts