Jump to content

Photo

Workshop Item - Activator & Terminal

help workshop activator terminal

  • Please log in to reply
3 replies to this topic

#1
Plarux

Plarux

    Enthusiast

  • Members
  • PipPip
  • 167 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



#2
niston

niston

    The Ring Trick

  • Premium Member
  • 2,152 posts

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.



#3
SKK50

SKK50

    Institutum delenda est

  • Premium Member
  • 5,782 posts

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.



#4
SKK50

SKK50

    Institutum delenda est

  • Premium Member
  • 5,782 posts

duplicate







Also tagged with one or more of these keywords: help, workshop, activator, terminal

IPB skins by Skinbox
Page loaded in: 1.196 seconds