YellowJacketXV Posted February 19, 2018 Share Posted February 19, 2018 So I have never been a coder,I just wanted to make a supplementary add-on for the Campfire mod that allows someone to deploy a small-tier smelting craft station, an anvil, activate a whetstone to temper weapons (in-inventory item), and activate an armorer hammer (in-inventory) to open an armor tempering menu. I am having no luck. What I lack in coding I make-up for in mesh and texture work. I was able to quickly whip-up meshes for a smelting pot and what-not but I've tried everything to no avail on the script side. I was going to simply reverse-engineer what I was doing wrong by browsing other mods but there's some sort of script-protection when I open up a .bsa in Creation Kit that prevents me from filling the mental gaps I'm having. I was trying to make a method where you drop the misc item into the real world then sneak while activating it. To start this, I tried just a super-simple message script as a sort of check-mark for me to get to an actual Disable() and PlaceAtMe() sort of thing. ScriptName abSmeltingPotScript extends ObjectReference ObjectReference Property abSmeltingPot Auto Event OnActivation(ObjectReference akActionRef) Actor PlayerRef == Game.GetPlayer() if PlayerRef.IsSneaking() ;While Sneaking Disable() Debug.MessageBox("It Worked!") endif EndEvent It compiles.But doesn't work? I have no idea why not. Is it because the base is a misc/clutter item rather than an activator?I tried to also create an activator but there are no physics to the item.I hope I don't sound -that- new. Link to comment Share on other sites More sharing options...
JonathanOstrus Posted February 19, 2018 Share Posted February 19, 2018 The misc object should still get an OnActivate event when you pick it up and trigger. The only thing I can think of is if you didn't properly attach the script to the item in CK or if you're not sneaking when you tried to activate it. You can verify the script by placing the item then open console and click it to get the ref id. Then type "SV". You should see it state something about your script abSmeltingPotScript. If there's no physics on your item that could be an issue with it being a misc as well. You won't be able to actually target it properly to pick it up and activate it. If you want to post the nif I can pop collision on it real quick for you. Link to comment Share on other sites More sharing options...
YellowJacketXV Posted February 19, 2018 Author Share Posted February 19, 2018 The misc object should still get an OnActivate event when you pick it up and trigger. The only thing I can think of is if you didn't properly attach the script to the item in CK or if you're not sneaking when you tried to activate it. You can verify the script by placing the item then open console and click it to get the ref id. Then type "SV". You should see it state something about your script abSmeltingPotScript. If there's no physics on your item that could be an issue with it being a misc as well. You won't be able to actually target it properly to pick it up and activate it. If you want to post the nif I can pop collision on it real quick for you.Isn't this where i attach scripts?All the tutorials are like 3~4 years old at best. I can't upload .nif files directly due to permission issues so here's a google drive link.https://drive.google.com/file/d/16cqbWezQzteo2NWlcuyW9lb66eR-zdk9/view?usp=sharing Link to comment Share on other sites More sharing options...
YellowJacketXV Posted February 19, 2018 Author Share Posted February 19, 2018 On a side note I actually managed to somehow get my whetstone to work. Link to comment Share on other sites More sharing options...
JonathanOstrus Posted February 19, 2018 Share Posted February 19, 2018 Glad to hear you got it working. Link to comment Share on other sites More sharing options...
YellowJacketXV Posted February 20, 2018 Author Share Posted February 20, 2018 (edited) I've got -a- script working but I still have more. Using a sort of 'access from inventory' sort of crafting i was able to get the Whetstone and Armorer's hammer working easily. I still can't seem to get the "spawn a workstation from Inventory" thing right. I was also able to pretty much complete an old mod I was working on when I first started. A scribe mod that allows players to craft every scroll in the vanilla game (and buffs them) wherever they might be. I basically fixed this because I saw that properties in the script menu/window were an actual thing. However, I can't seem to get placeAtMe() to work. The goal now is to just get the item (once used in inventory) to spawn the station then disable itself (would need to be 'packed up' later). ScriptName abSmeltingPotScript extends ObjectReference ObjectReference Property abSmeltingPotMisc Auto Form abSmeltingPot Event OnEquipped(Actor akActor) Game.getPlayer().placeAtMe(abSmeltingPot, 1) endEvent Am I trying through routes that are just too simple it can't work? Also which script function forces someone out of a menu? My "inventory-activated" crafting items don't open the crafting menu til the main menu is closed.*EDIT*Nevermind on that last part, looks like i used the wrong version of "disablePlayerControls()/enablePlayerControls()" for exiting players from menu. Edited February 20, 2018 by YellowJacketXV Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 20, 2018 Share Posted February 20, 2018 In the snippet within your last post, PlaceAtMe isn't working because you are trying to use a Form variable that has no data assigned to it. You're going to want to use a property for the workstation that you are wanting to place in front of the player. Since you cannot use Form with a property you'll need to use the actual object type for the base object. Most workstations are furniture objects a handful are activator objects. Another possibility (and it may help on clean up after use) would be to pre-place workstations in a new unattached interior cell. You can reference those as ObjectReference properties and use MoveTo to move them to the player. And when done, you can move them back to their editor location with MoveToMyEditorLocation. Link to comment Share on other sites More sharing options...
YellowJacketXV Posted February 20, 2018 Author Share Posted February 20, 2018 In the snippet within your last post, PlaceAtMe isn't working because you are trying to use a Form variable that has no data assigned to it. You're going to want to use a property for the workstation that you are wanting to place in front of the player. Since you cannot use Form with a property you'll need to use the actual object type for the base object. Most workstations are furniture objects a handful are activator objects. Another possibility (and it may help on clean up after use) would be to pre-place workstations in a new unattached interior cell. You can reference those as ObjectReference properties and use MoveTo to move them to the player. And when done, you can move them back to their editor location with MoveToMyEditorLocation.MoveTo does sound a lot more useful in this case.But which is better? Dropping an item from inventory? I was able to make it so a misc item is exchanged with an activator once dropped into real world but it has no Havok physics so I'm not sure how to fix that. Also for those that mind,https://www.nexusmods.com/skyrim/mods/89717/Is the fruits of the previous breakthrough with activating a "workstation" through inventory. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 20, 2018 Share Posted February 20, 2018 If it were me, I wouldn't even worry about dropping an item or moving the workstation to the player. After all, all that matters to me is having access to the menu so that the crafting can be done. I would pre-place workstations in a new interior cell and when I interact with the inventory item by 'equipping' via favorites menu or SKSE key bind just remotely activate the workstation. When the workstation is not in the same cell, there is no moving to the workstation to play the animation yet the menu (the important part) opens up. Example of this can be found in "Mining for Mages" and again in my "Mining for Mages Redux" mod. But of the two, spawning a workstation or moving a workstation... I'd go with moving a workstation. With spawning you run the risk of the items not getting deleted even if they do get disabled, over time the save file can begin to bloat as it stores unneeded objects that are not deleting properly for whatever reason. Link to comment Share on other sites More sharing options...
YellowJacketXV Posted February 20, 2018 Author Share Posted February 20, 2018 When I utilize moveTo() commands I am capable of moving an activator but not a furniture? As in, In my isolated cell, I have the mesh I would want placed within. I have updated reference to that new cell and that new mesh but it won't budge. I've even gone to the same cell just to double check and it won't budge. Is there something wrong with my syntax? I have the right cell and object centered in the properties but no luck. I can successfully drag around an activator like a dog on a leash using this. ScriptName abSmeltingPotScript extends ObjectReference ObjectReference Property abSmeltingPot Auto Event OnEquipped(Actor akActor) Actor PlayerRef = Game.getPlayer() Game.disablePlayerControls() Utility.wait(0.1) abSmeltingPot.moveTo(PlayerRef) Game.enablePlayerControls() endEvent Link to comment Share on other sites More sharing options...
Recommended Posts