dylbill Posted May 22, 2021 Share Posted May 22, 2021 Add a menu? Do you mean add an item? What specifically are you trying to do? Link to comment Share on other sites More sharing options...
TheWanderer001 Posted May 23, 2021 Author Share Posted May 23, 2021 What I'm thinking is that if they try and sell the item (Bag of Holding) then show a menu to ask if they really want to do that.If they select 'No' then just return it as in your script... but if they select 'yes'... remove the items from the bag, add those to the vendor then return an empty bag.The value of the all items would remain the original estimated value of the bag. Hope that makes sense :D Link to comment Share on other sites More sharing options...
dylbill Posted May 23, 2021 Share Posted May 23, 2021 Ah gotcha, I assume elsewhere you set the bag of holding's value to that of it's contents so selling it is like selling all of its contents? If so you can just do something like this: MiscObject Property Gold001 Auto MiscObject Property BagOfHolding Auto ObjectReference Property BagOfHoldingChest Auto Actor Property PlayerRef Auto Int Property PlayerGold Auto Hidden Bool AddOrRemoveItems Message Property BagOfholdingSellWarning Auto Event OnInit() AddInventoryEventFilter(Gold001) AddInventoryEventFilter(BagOfHolding) RegisterForMenu("BarterMenu") If UI.IsMenuOpen("BarterMenu") GoToState("InBarterMenu") Else GoToState("Waiting") EndIf EndEvent State Waiting Event OnMenuOpen(String menuName) GoToState("InBarterMenu") EndEvent Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) ;do nothing EndEvent Event OnItemRemoved(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) ;do nothing EndEvent EndState State InBarterMenu Event OnBeginState() PlayerGold = PlayerRef.GetItemCount(Gold001) AddOrRemoveItems = False EndEvent Event OnItemRemoved(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) If akDestContainer != None && AddOrRemoveItems == False If akBaseItem == BagOfHolding ;player is trying to sell bag of holding If BagOfholdingSellWarning.Show() == 1 ;the player chose button 1, accept selling the bag contents AddOrRemoveItems = True ;prevent OnItemAdded and OnItemRemoved functions from running BagOfHoldingChest.RemoveAllItems(akDestContainer) ;give all items in the bag of holding chest to the vendor akBaseItem.SetgoldValue(0) ;Set bag of holding value back to 0 akDestContainer.RemoveItem(akBaseItem, aiItemCount, False, PlayerRef) ;give bag of holding back to player Else ;player chose button 0, cancel selling the bag AddOrRemoveItems = True ;prevent OnItemAdded and OnItemRemoved functions from running Int GoldDiff = PlayerRef.GetItemCount(Gold001) - PlayerGold akDestContainer.RemoveItem(akBaseItem, aiItemCount, False, PlayerRef) ;give sold items back to player PlayerRef.RemoveItem(Gold001, GoldDiff, True, akDestContainer) ;give gold gained back to trader Utility.WaitMenuMode(0.01) AddOrRemoveItems = False PlayerGold = PlayerRef.GetItemCount(Gold001) Endif Endif EndIf If akBaseItem == Gold001 && AddOrRemoveItems == False Utility.WaitMenuMode(0.01) PlayerGold = PlayerRef.GetItemCount(Gold001) Endif EndEvent Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) If akBaseItem == Gold001 && AddOrRemoveItems == False Utility.WaitMenuMode(0.01) PlayerGold = PlayerRef.GetItemCount(Gold001) Endif EndEvent Event OnMenuClose(String menuName) GoToState("Waiting") EndEvent Endstate Link to comment Share on other sites More sharing options...
TheWanderer001 Posted May 23, 2021 Author Share Posted May 23, 2021 Woow... That's great... looks like what I'm after... and I think I understand what it's doing as well... bonus :D Will tweak what the yes to sell option does a bit... but I think I can figure that out now you've done all the hard stuff :thumbsup:Just have to get the quest part right ;) will test this out later. Thank you so much for all the help... and yes I do include you IsHara here...don't know what we would all do without all the help you and others give to us lesser mortals. :geek: Link to comment Share on other sites More sharing options...
dylbill Posted May 23, 2021 Share Posted May 23, 2021 No problem :) happy modding! Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 23, 2021 Share Posted May 23, 2021 Side step for a moment...Why do you write it as IsHara when it is Ishara? There is no capital H.IsharaMeradin Link to comment Share on other sites More sharing options...
TheWanderer001 Posted May 23, 2021 Author Share Posted May 23, 2021 Ah... okay sorry... no offence meant :) I will correct myself in future...I think it was just me thinking in programing mode like... IsVar, IsGold , IsFood etc... Link to comment Share on other sites More sharing options...
TheWanderer001 Posted May 24, 2021 Author Share Posted May 24, 2021 Aggg.... AddInventoryEventFilter(GOLD001) is not a function or does not existAny thoughts why? It is set up the same as in your script. I've read what I could find (that's not a lot though) related to the function but that hasn't revealed anything to me :( Link to comment Share on other sites More sharing options...
dylbill Posted May 24, 2021 Share Posted May 24, 2021 Does your script extend ReferenceAlias? That script compiled fine for me. Link to comment Share on other sites More sharing options...
TheWanderer001 Posted May 24, 2021 Author Share Posted May 24, 2021 Ah... that would be it then :D I had it extend the quest... now compiles...A case of a little knowledge being dangerous ;) Thanks for you quick reply :) Link to comment Share on other sites More sharing options...
Recommended Posts