Leubast Posted January 26, 2015 Share Posted January 26, 2015 Could anyone help me? I'm trying to make a mod that adds an item and when dropped from your inventory it becomes a static object (specifically, a type of crafting table, but can be taken anywhere). Then crouch and using it will pick it back up. Link to comment Share on other sites More sharing options...
Tamira Posted January 26, 2015 Share Posted January 26, 2015 Isn't this mod doing what you are looking for?http://www.nexusmods.com/skyrim/mods/45831/? Link to comment Share on other sites More sharing options...
Leubast Posted January 26, 2015 Author Share Posted January 26, 2015 Actually I'm going to add a new crafting table, with a new crafting menu for specific items, so I need to know how it's done. Link to comment Share on other sites More sharing options...
cdcooley Posted January 26, 2015 Share Posted January 26, 2015 You need two items, one misc item for the inventory and one furniture (not static if it's a crafting table) item. Each object needs a script. The misc item that will be in inventory needs an OnContainerChanged() event which will place the furniture version of the crafting table in front of the player and delete itself when it moves from the player's inventory and into the world (destination is None). The furniture item will need a script that allows you to pick it back up, which actually means adding a new version of the misc item to the player's inventory and deleting itself. The traditional methods both use OnActivate(). One gives a menu with the choice to use or take. The other checks to see if the player is sneaking to make the decision about which action to take. Personally I prefer a slightly more complicated script where a normal activate is use and the drag operation is take. Link to comment Share on other sites More sharing options...
Leubast Posted January 27, 2015 Author Share Posted January 27, 2015 Ok, I'm trying to make a script on the crafting furniture that makes it, once grabbed (hold E), adds the misc item to the players inventory, disables itself and deletes itself (to remove it from the world). Scriptname _CShack_CWorkbenchStatic extends ObjectReference Event OnGrab () Game.GetPlayer().additem(Carpenter's Workbench, 1) Disable() Delete() EndEvent I'm very new to scripting and I tried as best as I could. Could anyone give me some scripting pointers? Link to comment Share on other sites More sharing options...
cdcooley Posted January 27, 2015 Share Posted January 27, 2015 That's close, but "Carpenter's Workbench" looks like the name of your misc item. You need its formID which you'll have to assign into a property in the CK. So that would be something like: ScriptName _CShack_CWorkbenchStatic extends ObjectReference Event OnGrab() Game.GetPlayer().AddItem(CShack_CWorkbenchMisc, 1) Disable() Delete() EndEvent ObjectReference Property CShack_CWorkbenchMisc Auto Then the code on the misc. item would be something like: ScriptName _CShack_CWorkbenchMisc extends ObjectReference Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) if !akNewContainer ; being dropped into the world ObjectReference workbench = PlaceAtMe(CShack_CWorkbenchStatic, 1, false, true) Actor PlayerRef = Game.GetPlayer() float angle = PlayerRef.GetAngleZ() workbench.MoveTo(PlayerRef, Math.Sin(angle) * 150, Math.Cos(angle) * 150, 0, false) workbench.SetAngle(0.0, 0.0, angle + 180) workbench.Enable() Disable() Delete() endif EndEvent ObjectReference Property CShack_CWorkbenchStatic Auto The 150 numbers control how far in front of the player the item appears and you may or may not need to adjust the 180 that sets the angle since different pieces of furniture are set up differently (some need 90, some -90, some 0). Link to comment Share on other sites More sharing options...
Leubast Posted January 28, 2015 Author Share Posted January 28, 2015 Well, I seem to just be dropping a Havok-less misc item that looks like the workbench. Link to comment Share on other sites More sharing options...
cdcooley Posted January 29, 2015 Share Posted January 29, 2015 Sometimes the script on the misc. item doesn't trigger until you drop it, pick it up, and drop it again. It's a game quirk. Link to comment Share on other sites More sharing options...
Recommended Posts