Jump to content

Consolidated Crafting Table


Kraeten

Recommended Posts

Starting to get back into modding for the first time in a few years, and I'm trying to get this damn script to work. Well. The first part of it anyway. I'm trying to create an activator that opens a menu which allows the player to execute the crafting event of his/her choosing (Smithing, Enchanting, Tempering etc). Essentially, a consolidated crafting table. I was hoping someone could help me understand where I'm failing to make this script compile. Thank you very much for your time and consideration for any who try to help.

 

Script Example 1 (DarkFox127's work)

 

https://ibb.co/b7pK8Ny

 

Script Example 2 (What I'm trying to insert into his)

 

https://ibb.co/ZG8zDqT

 

My broken attempt at merging the two

 

ScriptName AAAConsolidatedCraftingTestScript Activator extends ObjectReference
{This is a test script.}

Message Property AAAConsolidatedCraftingMenu Auto

Event OnActivate (ObjectReference akActionRef)
Menu()
EndEvent

Function Menu(int aiButton = 0)
aiButton = AAAConsolidatedCraftingMenu.show()
If aiButton== 0

ElseIf aiButton == 1
ObjectReference Property Smelter Auto
Smelter.Activate(Gane.GetPlayer())
EndEvent

Edited by Kraeten
Link to comment
Share on other sites

If this is a copy paste of your code, it fails because you have Gane.GetPlayer() instead of Game.GetPlayer(). It also fails because you cannot declare a property inside an event or function. In other words, the line ObjectReference Property Smelter Auto is in the wrong place. It should be outside of the event where the message property is located.

 

If you still get a compiler error after correcting those, post the new code and the compiler error both in their own code boxes (do not use the line numbering option as it shades the lines and makes every other line impossible to read).

Link to comment
Share on other sites

:facepalm: DUUUUMB mistake on the first part. Tried moving some stuff around, and renamed my menu message. Still failing to compile. Here's how things look. Every time I put EndEvent it complains so I switched that only to get a new error. But here are the new errors. Thank you so much for taking the time to respond. I'm a complete stranger to Papyrus.

 

ScriptName AAAAConsolidatedCraftingTestScript Activator extends ObjectReference
{This is a test script.}

Message Property AAConsolidatedStationWMenuMessage Auto
ObjectReference Property Smelter Auto

Event OnActivate (ObjectReference akActionRef)
Menu()
EndEvent

Function Menu(int aiButton = 0)
aiButton = AAConsolidatedStationWMenuMessage.show()
If aiButton== 0

ElseIf aiButton == 1
Smelter.Activate(Game.GetPlayer())
EndIf

 

Error Message

Starting 1 compile threads for 1 files...
Compiling "AAAAConsolidatedCraftingStationWMenu"...
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\AAAAConsolidatedCraftingStationWMenu.psc(1,56): required (...)+ loop did not match anything at input 'extends'
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\AAAAConsolidatedCraftingStationWMenu.psc(1,0): Unknown user flag Activator
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\AAAAConsolidatedCraftingStationWMenu.psc(0,-1): mismatched input '<EOF>' expecting ENDFUNCTION
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\AAAAConsolidatedCraftingStationWMenu.psc(0,0): filename does not match script name: aaaaconsolidatedcraftingtestscript
No output generated for AAAAConsolidatedCraftingStationWMenu, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on AAAAConsolidatedCraftingStationWMenu

Link to comment
Share on other sites

You have the word Activator in the scriptname line. Did not see that the first time around. The compiler error even points this out. Get rid of it, it does not belong there.

You are missing the EndFunction statement that is required to tell papyrus when the function code is finished.

 

See the following for those corrections:

 

 

ScriptName AAAAConsolidatedCraftingTestScript extends ObjectReference
{This is a test script.}
 
Message Property AAConsolidatedStationWMenuMessage Auto
ObjectReference Property Smelter Auto
 
Event OnActivate (ObjectReference akActionRef)
    Menu()
EndEvent
 
Function Menu(int aiButton = 0)
  aiButton =  AAConsolidatedStationWMenuMessage.show()
  If aiButton == 0
  ElseIf aiButton == 1
    Smelter.Activate(Game.GetPlayer())
  EndIf
EndFunction

Link to comment
Share on other sites

It compiled! Thank you so much! Now I just have to puzzle over why the Smelting menu isn't automatically opening as it should. Gonna have to do some tinkering.

 

Edit: Works perfectly with an activator, but not with furniture. I guess that makes sense but I wonder how I can tweak that to work. :huh:

Edited by Kraeten
Link to comment
Share on other sites

Do you have your smelter reference in an unattached interior cell?

Are you testing on a new game?

 

Also wonder if the message box menu might be getting in the way as well. See if disabling player controls, activating and then re-enabling player controls does the trick.

 

Something like:

 

Game.DisablePlayerControls(False, False, False, False, False, True) ; Exit menu
Utility.Wait(0.01)
Smelter.Activate(Game.GetPlayer())
Utility.Wait(0.01)
Game.EnablePlayerControls(False, False, False, False, False, True) ; Reenable menu
Link to comment
Share on other sites

I do have it in a separate cell. Maybe it's the animation itself that's scrambling the script process. I was hoping to use a leantable furniture marker in conjunction with the script, but it's a small disappointment considering it works perfectly with an an activator instead. Thank you so much for your help!

Link to comment
Share on other sites

Oh I see. You were wanting to use one piece of furniture to activate the smelter which is also a piece of furniture. That won't work. I thought you were saying that you could get an activator to work remotely but couldn't get the smelter furniture to work.

 

What you can do is copy the smelter furniture record and replace the smelter mesh with the leantable furniture marker mesh. Then place that where you want it to be used in the game world. No remote activation needed.

Link to comment
Share on other sites

The end product I was hoping to achieve would have had the player lean over the table, same as when he/she might use an enchanting furniture marker but instead of the enchanting display the player gets to choose any crafting they desire. It would all be menu driven, with the player remaining in the leaning over the table position as he/she goes from smithing to alchemy or whatever they desire. Basically an all-in-one crafting furniture marker.

 

The script you generously fixed does have all the menu functionality I desire, only the furniture marker breaks it since any time a option is chosen it snaps the player out of the leantable furniture marker & menu. Ultimately the animation I hoped to pair the script with is more of a luxury/presentation thing than anything that really matters. The script paired with an activator marker works flawlessly, so I'll just make a new activator using a custom table model I'm working on. You helped me get the most important part right, so again thank you so much for your help! You're amazing! :dance:

Edited by Kraeten
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...