Jump to content

[LE] Script to enable LinkedRef while crafting station is in use?


Recommended Posts

I'm having a hard time wrapping my head around scripting and could really use some help.

I'm trying to customize a forge, and I want a fire to light when the player (or an NPC) is smithing and go out again when they're done.

So basically script-wise, I need an object linked to the crafting station to be enabled while the crafting station is in use, then be disabled again when not in use.

I know how to enable/disable linked references, but I can't figure out how to trigger it. Any assistance would be greatly appreciated!

Link to comment
Share on other sites

You can attach a script to your furniture with the OnActivate event, like so:

 

Scriptname MyFurnitureScript extends ObjectReference 

Event OnActivate(ObjectReference akActionRef) ;trigged when an NPC activates this object 
    Self.GetLinkedRef().Enable()
    Utility.WaitMenuMode(1)
    While Self.IsFurnitureInUse(True) ;this while loop pauses the script until this furniture object is no longer being used.
        Utility.WaitMenuMode(1)
    EndWhile
    
    Self.GetLinkedRef().Disable()
EndEvent

EDIT: Change the scriptname to something more unique

Link to comment
Share on other sites

  • Recently Browsing   0 members

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