icecreamassassin Posted May 27, 2014 Author Share Posted May 27, 2014 I am placing this on an existing quest of mine which handles most of the functions of the mod, maybe this has to be on a clean quest? I'll post the actual script code when I'm able (rendering NavMesh ATM) XD Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 27, 2014 Share Posted May 27, 2014 Was looking at my own other script calls for functions and properties and none of them went down to an alias, it was always the alias calling something from a quest script, a quest script calling from another quest script, a quest script calling individual objects. So I flipped the process. I hope it works cause it is my last straw... ;************************************************************************** ;on your container alias ScriptName SomeName Extends ReferenceAlias SomeOtherName Property MainQuestScript Auto {point this to the quest where the script SomeOtherName is assigned} Event OnActivate(ObjectReference akActionRef) ;opened the container to add stuff so ensure that the bool is false first MainQuestScript.SetBoolValue(false) EndEvent Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) ;an item is added to the container MainQuestScript.SetBoolValue(true) EndEvent ;************************************************************************** ;this is your quest script ScriptName SomeOtherName Extends Quest Bool Doable Event OnInit() RegisterForMenu("ContainerMenu") EndEvent Event OnMenuClose(String MenuName) If MenuName == "ContainerMenu" && Doable == true ;a container menu was closed and the target container had something added so logically this closed menu belongs to the target container Doable = false ;do the display enable/disable stuff EndIf EndEvent Function SetBoolValue(Bool Value) Doable = Value EndFunction Link to comment Share on other sites More sharing options...
icecreamassassin Posted May 29, 2014 Author Share Posted May 29, 2014 I'm a little unclear where the object handling comes in here, there appears to be no function for actually checking the lists, am I just blind about where it should be stuck ? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 29, 2014 Share Posted May 29, 2014 (edited) At the line that says;do the display enable/disable stuff Add whatever you need to make your displays show up. It is at that point that the container that will hold the items the player puts in has had something added and has been closed. Of course any property entries will be outside of the event, but the work process goes right there. EDIT:Perhaps this will demonstrate what I mean. ;************************************************************************** ;on your container alias ScriptName SomeName Extends ReferenceAlias SomeOtherName Property MainQuestScript Auto {point this to the quest where the script SomeOtherName is assigned} Event OnActivate(ObjectReference akActionRef) ;opened the container to add stuff so ensure that the bool is false first MainQuestScript.SetBoolValue(false) EndEvent Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) ;an item is added to the container MainQuestScript.SetBoolValue(true) EndEvent ;************************************************************************** ;this is your quest script ScriptName SomeOtherName Extends Quest Bool Doable FormList Property DisplayActivators Auto FormList Property DisplayItems Auto ObjectReference Property HoldingContainer Auto Event OnInit() RegisterForMenu("ContainerMenu") EndEvent Event OnMenuClose(String MenuName) If MenuName == "ContainerMenu" && Doable == true ;a container menu was closed and the target container had something added so logically this closed menu belongs to the target container Doable = false ;do the display enable/disable stuff Int DASize = DisplayActivators.GetSize() Int index = 0 While index < DASize If HoldingContainer.GetItemCount(DisplayItems.GetAt(index)) > 0 (DisplayActivators.GetAt(index) as ObjectReference).Enable() Else (DisplayActivators.GetAt(index) as ObjectReference).Disable() EndIf index += 1 EndWhile EndIf EndEvent Function SetBoolValue(Bool Value) Doable = Value EndFunction Edited May 29, 2014 by IsharaMeradin Link to comment Share on other sites More sharing options...
icecreamassassin Posted May 29, 2014 Author Share Posted May 29, 2014 Yeah I figured that's what you meant right after I posted, lol, thanks for clarifying Link to comment Share on other sites More sharing options...
icecreamassassin Posted May 31, 2014 Author Share Posted May 31, 2014 okie dokie. so I have gotten it put in, properties defined and it all compiles fine, but it doesn't seem to function. Maybe I'm applying it wrong. Here is the exact script I have: This is inside the quest script of my main handler script Bool Doable FormList Property DisplayActivators Auto FormList Property DisplayItems Auto ObjectReference Property HoldingContainer Auto Event OnInit() RegisterForMenu("ContainerMenu") EndEvent Event OnMenuClose(String MenuName) If MenuName == "ContainerMenu" && Doable == true ;a container menu was closed and the target container had something added so logically this closed menu belongs to the target container Doable = false ;do the display enable/disable stuff Int DASize = DisplayActivators.GetSize() Int index = 0 While index < DASize If HoldingContainer.GetItemCount(DisplayItems.GetAt(index)) > 0 (DisplayActivators.GetAt(index) as ObjectReference).Enable() Else (DisplayActivators.GetAt(index) as ObjectReference).Disable() EndIf index += 1 EndWhile EndIf EndEvent Function SetBoolValue(Bool Value) Doable = Value EndFunction this is the code I have on the chest itself Scriptname DBM_DisplaySortScript extends ReferenceAlias QF_DBM_MuseumQuest_0500FB32 Property MainQuestScript Auto {point this to the quest where the script SomeOtherName is assigned} Event OnActivate(ObjectReference akActionRef) ;opened the container to add stuff so ensure that the bool is false first MainQuestScript.SetBoolValue(false) EndEvent Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) ;an item is added to the container MainQuestScript.SetBoolValue(true) EndEvent any insight is appreciated, if there isn't an obvious solution, I'll probably just go back to my original which requires and extra open and close to trigger it all. Thanks a bunch Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 31, 2014 Share Posted May 31, 2014 Scriptname DBM_DisplaySortScript extends ReferenceAlias You have that on the chest itself or on an alias of the chest? If it is the chest, then it needs to extend ObjectReference. Check your papyrus log and see if you find an error like this in regards to the script Unable to bind script <script name> to <Form ID> because their base types do not match The quest script, is it one of those auto build ones made up of the various stages and such? If so, don't use it. Use a new script that you create yourself. You can have multiple scripts on an object. Failing all that, you can also use a GlobalVariable instead of having the scripts communicate directly with each other. ********************************************* The chest script ********************************************* Scriptname DBM_DisplaySortScript extends ObjectReference GlobalVariable Property DBM_ItemsReady Auto Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) ;an item is added to the container DBM_ItemsReady.SetValueInt(1) EndEvent ********************************************* The quest script ********************************************* FormList Property DisplayActivators Auto FormList Property DisplayItems Auto ObjectReference Property HoldingContainer Auto GlobalVariable Property DBM_ItemsReady Auto Event OnInit() RegisterForMenu("ContainerMenu") EndEvent Event OnMenuClose(String MenuName) If MenuName == "ContainerMenu" && DBM_ItemsReady.GetValueInt() == 1 DBM_ItemsReady.SetValueInt(0) ;reset ;a container menu was closed and the target container had something added so logically this closed menu belongs to the target container ;do the display enable/disable stuff Int DASize = DisplayActivators.GetSize() Int index = 0 While index < DASize If HoldingContainer.GetItemCount(DisplayItems.GetAt(index)) > 0 (DisplayActivators.GetAt(index) as ObjectReference).Enable() Else (DisplayActivators.GetAt(index) as ObjectReference).Disable() EndIf index += 1 EndWhile EndIf EndEvent As you can see, there are multiple ways to skin a cat. It is just a matter of finding which way works best for you. PS. Don't tell my daughter I said that. It is bad enough that I have a stuffed Alf in the house... quite stuffed since some of the cats have disappeared :P (they're outdoor cats, ran off or something... who knows) Link to comment Share on other sites More sharing options...
icecreamassassin Posted June 3, 2014 Author Share Posted June 3, 2014 LOL, that's hysterical ... thanks for this, I'll give it a shot, and yeah I had the chest script as a reference extension script. I'll check it out and try it again :) Link to comment Share on other sites More sharing options...
Recommended Posts