Jump to content

Workshop Item - Activator & Terminal


Plarux

Recommended Posts

Hello everyone,

 

I'd like to find out how to make a workshop item that when created, places down an activator and terminal together.

If you can help or share a few mods for example that would be appreciated!

 

Plarux

Link to comment
Share on other sites

You can spawn objects on other objects with PlaceAtNode().

 

For example, if your activator is a the milk vending machine and you want to put a terminal onto that, you'd create a customized copy of the milk machine NIF, where you add a NiNode with a specific name and place it where you want the terminal to appear.

 

You can then use PlaceAtNode() to spawn in the terminal at the position of your node. You can also specify the refattach parameter, so that the terminal will be attached to the milk machine and thus move with it, when the machine is being moved around in workshop mode.

 

And on workshop destruction of the Milk Machine, you'll have to Delete() the terminal. But don't ever use Delete() on stuff that uses power. If your terminal requires power, use Disable() instead to get rid of it.

Link to comment
Share on other sites

Checkout Ammo-O-Matic which from a workshop co recipe presents a Container with a Terminal attached.

 

Actually the co recipe just places an activator/container which has a script attached that does the magic to attach a terminal;

Event OnLoad()

Debug.Trace("SKK_AOMVendingMachineScript.OnLoad " + Self)

ObjectReference MyTerminal = Self.GetLinkedRef(pSKK_AOMTerminalLink)

If (MyTerminal == None)
	MyTerminal = Self.PlaceAtNode("SKK_AOMATTACHNODE", pSKK_AOMTerminal, aiCount = 1, abForcePersist = false, abInitiallyDisabled = true, abDeleteWhenAble = false)
	MyTerminal.AttachTo(Self As ObjectReference)
	Self.SetLinkedRef(MyTerminal, pSKK_AOMTerminalLink)
	MyTerminal.SetLinkedRef(Self, pSKK_AOMActivatorLink)
	MyTerminal.Enable()
	MyTerminal.SetMotionType(Motion_Keyframed, FALSE)
Else ; failsafe incase of separation
	MyTerminal.MoveToNode(Self As ObjectReference, "SKK_AOMATTACHNODE")
	MyTerminal.AttachTo(Self As ObjectReference)
	MyTerminal.SetMotionType(Motion_Keyframed, FALSE)
EndIf	

EndEvent

Needed an attach node SKK_AOMATTACHNODE added to the activator NIF read this how to

 

The two attached objects happily move together OnWorkshopObjectMoved but you need to handle the cleanup for LinkedRef terminal disable and delete when the principle receives event OnWorkshopObjectDestroyed.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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