shavkacagarikia Posted June 6, 2017 Share Posted June 6, 2017 (edited) Whats the error? Nevermind I know what's the problem. Try this.(don't have access to CK so there was mistake) Scriptname CaDW_Drop_WW extends ObjectReference Furniture property pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchGround auto const mandatoryMiscObject property pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchInventory auto const mandatory ObjectReference workbenchRef Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) if (!akNewContainer && akOldContainer == game.getPlayer()) ;self.MoveToNearestNavmeshLocation() self.disable() workbenchRef = self.placeAtMe(pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchGround) utility.wait(0.5) self.delete() endifendEvent Event OnExitFurniture(ObjectReference akActionRef) if (akActionRef == game.getPlayer()) utility.wait(1.0) workbenchRef.disable() akActionRef.addItem(pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchInventory) utility.wait(0.2) workbenchRef.delete() endIfEndEvent Edited June 6, 2017 by shavkacagarikia Link to comment Share on other sites More sharing options...
stonefisher Posted June 6, 2017 Author Share Posted June 6, 2017 (edited) . Edited June 6, 2017 by stonefisher Link to comment Share on other sites More sharing options...
stonefisher Posted June 6, 2017 Author Share Posted June 6, 2017 Well, tried again and this time, It drops and i can craft but it dousnt go away or return to me inv. However if i try and access the craft menu again it zooms out to 3rd person then back into 1st person. Link to comment Share on other sites More sharing options...
shavkacagarikia Posted June 6, 2017 Share Posted June 6, 2017 (edited) Ok. It seems I was too tired yesterday and needed some sleep. The OnExitFurniture won't fire because of 1) the script is attached on misc item and you never exit that misc item, you exit furniture. 2) OnExitFurniture event doesn't fire for workbenches. So to make your script work we will need to register for remote event of game.getplayer() actor, which is OnGetUp. It will fire when player exits our workbench. Like this: Scriptname CaDW_Drop_WW extends ObjectReference Furniture property pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchGround auto const ObjectReference workbenchRef Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) if (!akNewContainer && akOldContainer == game.getPlayer()) self.disable() workbenchRef = self.placeAtMe(pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchGround) workbenchRef.MoveToNearestNavmeshLocation() workbenchRef.SetAngle(0.0, 0.0, workbenchRef.getAngleZ()) RegisterForRemoteEvent(game.getplayer(), "OnGetUp") utility.wait(0.5) self.delete() endif endEvent Event Actor.OnGetUp(Actor sender, ObjectReference akFurniture) if (sender == game.getplayer() && akFurniture == workbenchRef) utility.wait(1.0) workbenchRef.disable() game.getplayer().addItem(self) utility.wait(0.2) workbenchRef.delete() UnregisterForRemoteEvent(game.getplayer(), "OnGetUp") endif endEvent But I (as user) prefer player to be able to disable wokbench when he needs that, not when he exits it. If you think same I can suggest you how to add another button next to activation button which will remove worbench. Edited June 6, 2017 by shavkacagarikia Link to comment Share on other sites More sharing options...
stonefisher Posted June 6, 2017 Author Share Posted June 6, 2017 AWESOME, It works. Thank you shavkacgarikia. Link to comment Share on other sites More sharing options...
stonefisher Posted June 6, 2017 Author Share Posted June 6, 2017 An extra button would be great I think shavkacgarikia but there is something else i need the script to do. I just had a brain wave of how it could be used in my mod. Just one more thing for perfection. Is it possible to move items using a form list into a container I can place in qasmoke when the workbench is activated and then when the workbench is deactivated return the contents of the container to the player? I have set up a form list called: CaDW_RPWW_ItemFilterand a container called: CaDW_RPWW_Container Link to comment Share on other sites More sharing options...
shavkacagarikia Posted June 6, 2017 Share Posted June 6, 2017 So you want items to be removed from player when he activates workbench and then return them when he exits it? Can I ask why you wanna do that? Link to comment Share on other sites More sharing options...
stonefisher Posted June 6, 2017 Author Share Posted June 6, 2017 You can use it to limit what you use the workbench for. In my case i can restrict it to only allow mods to be swapped or with my mod Craft and Dismantle Weapons to not allow mod crafting so it can only be used in the feild to salvage weapon mods. Link to comment Share on other sites More sharing options...
shavkacagarikia Posted June 6, 2017 Share Posted June 6, 2017 Then you basically need to remove all junk items from player. Yes it is possible to remove needed components using formlist with RemoveItem and passing formlist there. Scriptname CaDW_Drop_WW extends ObjectReference Furniture property pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchGround auto const ObjectReference workbenchRef Container MyContainer FormList MyFormList Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) if (!akNewContainer && akOldContainer == game.getPlayer()) self.disable() workbenchRef = self.placeAtMe(pCaDW_FO4_co_Tool_PortableWeaponsWorkbenchGround) workbenchRef.MoveToNearestNavmeshLocation() workbenchRef.SetAngle(0.0, 0.0, workbenchRef.getAngleZ()) RegisterForRemoteEvent(game.getplayer(), "OnGetUp") RegisterForRemoteEvent(workbenchRef, "OnActivate") utility.wait(0.5) self.delete() endif endEvent Event ObjectReference.OnActivate(ObjectReference akSender, ObjectReference akActionRef) if (akSender == workbenchRef && akActionRef == game.getplayer()) Game.GetPlayer().RemoveItem(MyFormlist, -1, true, MyContainer) UnregisterForRemoteEvent(workbenchRef, "OnActivate") endif EndEvent Event Actor.OnGetUp(Actor sender, ObjectReference akFurniture) if (sender == game.getplayer() && akFurniture == workbenchRef) utility.wait(1.0) workbenchRef.disable() game.getplayer().addItem(self) MyContainer.RemoveItem(MyFormlist, -1, true, game.getplayer()) utility.wait(0.2) workbenchRef.delete() UnregisterForRemoteEvent(game.getplayer(), "OnGetUp") endif endEvent You will need to fill Formlist and Container properties with the needed ones. Link to comment Share on other sites More sharing options...
stonefisher Posted June 6, 2017 Author Share Posted June 6, 2017 Hiya, got a compile error: Compiling "CaDW_Drop_WW.psc"...H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CaDW_Drop_WW.psc(24,54): type mismatch on parameter 4 - cannot pass a container to a objectreferenceH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CaDW_Drop_WW.psc(35,14): RemoveItem is not a function or does not existNo output generated for CaDW_Drop_WW.psc, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on CaDW_Drop_WW.psc Was I meant to paste something into the script or just select the container and list when i add a script to an object in CK? Link to comment Share on other sites More sharing options...
Recommended Posts