SoulMasterFinnigan Posted February 15, 2023 Share Posted February 15, 2023 I want to remove an Item from Inventory and add it to containerThe Item removes but doesn't go into the selected container ? Link to comment Share on other sites More sharing options...
Fantafaust Posted February 15, 2023 Share Posted February 15, 2023 Post your code? Link to comment Share on other sites More sharing options...
SoulMasterFinnigan Posted February 16, 2023 Author Share Posted February 16, 2023 This Is What I have put Scriptname __0SMF_ColdFridge3 extends ObjectReference Const Int Property Insert Auto Const FormList Property WarmDrinks Auto Const FormList Property ColdDrinks Auto Const Message Property FridgeMessage Auto Const Container Property PristineFridge Auto Const Event OnActivate(ObjectReference akActionRef)int selectedOption = FridgeMessage.Show()If (selectedOption == 1) ; CancelreturnEndIfIf (Game.GetPlayer().GetItemCount(WarmDrinks) < Insert) ;Debug.Notification("You need a Warm Drink")returnEndIfGame.GetPlayer().RemoveItem(WarmDrinks, Insert) If (selectedOption == 0) ; Game.GetPlayer().AddItem(ColdDrinks)Debug.Notification("Have A cold One")EndIfEndEventThe Game.GetPlayer()AddItem is the one that needs to go in a container Link to comment Share on other sites More sharing options...
Fantafaust Posted February 16, 2023 Share Posted February 16, 2023 You want the warm drink(player has it first) to go in a container, or you want the cold drink(doesn't exist until player gives warm drink) to go in the container? In any case your code is nested improperly and will always remove a warm drink from the player no matter what option they pick.According to what you said you want the cold drink to go in the container, but you still used Game.GetPlayer() ?You should be using PristineFridge.AddItem(ColdDrinks) if that's the right container Link to comment Share on other sites More sharing options...
RaidersClamoring Posted February 16, 2023 Share Posted February 16, 2023 You need to specify the receiving container as the last parameter in RemoveItem or the stuff will either fall to the ground or simply disappear. Function RemoveItem(Form akItemToRemove, int aiCount = 1, bool abSilent = false, ObjectReference akOtherContainer = None) Link to comment Share on other sites More sharing options...
RaidersClamoring Posted February 16, 2023 Share Posted February 16, 2023 Also as a matter of script performance and general resource management it's better to use some alternative to Game.GetPlayer such as creating and using a PlayerRef property or as a shortcut Game.GetForm(0x14). Link to comment Share on other sites More sharing options...
SKKmods Posted February 16, 2023 Share Posted February 16, 2023 Whilst game.getplayer call is expensive, in a holotape/message menu which suspends realtime world execution its not a major problem. If avoiding more properties on nasty script fragments, the best practice is to call the function ONCE per function by assigning it: Actor PlayerREF = Game.GetPlayer() ...PlayerREF.RemoveItem(WarmDrinkBaseForm, int aiCount = 1, bool abSilent = false, akOtherContainer = Fridge)...Fridge.RemoveItem(ColdDrinkBaseForm, int aiCount = 1, bool abSilent = false, akOtherContainer = PlayerREF) Link to comment Share on other sites More sharing options...
Fantafaust Posted February 16, 2023 Share Posted February 16, 2023 I thought the purpose of this was to take a warm drink from the player and turn it into a cold one? Link to comment Share on other sites More sharing options...
SoulMasterFinnigan Posted February 16, 2023 Author Share Posted February 16, 2023 How would I write that without getting things likeFridge is not a function etcor cannot pass container to an objectreference etc Link to comment Share on other sites More sharing options...
SoulMasterFinnigan Posted February 16, 2023 Author Share Posted February 16, 2023 It is , the warm drinks are being removed but cold drinks are going nowhere I have tried it as a function but get error expectin EndEventPristineFridge.AddItem is get PristineFridge is not a functiondamn warm and cold drinks having 39 items , I would have done it the long way if I could fit them all on 1 message lol Link to comment Share on other sites More sharing options...
Recommended Posts