Jump to content

Is it possible to conjoin different activators into a single NIF ?


SKKmods

Recommended Posts

I would like to conjoin a Container and a Terminal so they are a single buildable/movable item but they maintain their separate Container and Terminal Activation object attributes.

 

So not just making an SCOL (tired that) but possibly some magic at the NIF level. I suspect that they need to remain separate base Forms and therefore in world ObjectReferences to offer different activation, unless NiNodes (or whatever) can be defined for separate activation ... anyone know ?

 

In the meantime I am building the container with a _co recipe and then scripting in the terminal OnLoad. The UX issue is when the container is moved, the terminal floats in space until "WorkshopObjectMoved" event is received so the terminal can MoveTo() to catch up. Yuck.

 

Link to comment
Share on other sites

In such a case i'm using two seperate NIFs.

The base-NIF (that is the one u later can build) contains the meshes for both objects, but collision is only for the first (base) object.

The second NIF does only contain the collision. This way the second object does not float arround unattached (At least you can't see it).

 

Furthermore you could name the attach point in the base nif "REF_ATTACH_NODE". It seems that the engine will move an attached node (NIF) together with the base-NIF it the attach point has this name. That's the way e.g. MagRackWorkshop.nif works.

Nevertheless i'm always adding a "WorkshopObjectMoved" handler to the object. It seems, that under some conditions the REF_ATTACH_NODE magic does not work, especially for objects that are attached to the ceilling or the wall.

 

Edit, because I'm stupid ;-)

Edited by deadbeeftffn
Link to comment
Share on other sites

A quick fix is to combine the container and terminal into an SCOL and apply that NIF to an activator for the container functions https://i.imgur.com/3oYTIkv.png

 

All I need an invisible NIF with collision to place at the terminal as an activator, but creating such is beyond me and the tools I have right now :sad:

 

Are there any in the base game, or does anyone have something lying around they can share ? Rough size to Furniture\Terminals\TerminalWallEmbedded01On.nif

Link to comment
Share on other sites

Why not strip any BsTriShapes from Furniture\Terminals\TerminalWallEmbedded01On.nif?

 

- open the nif in NifSkope

(TL -> top left panel, BL -> bottom left panel)

 

- TL: select node 0

- BL: insert "13" into "collision object"

- TL: open node 0

- TL: open node 2

- TL: select node 12

- BL: remove the collision object assignment (13)

- TL: remove block/branch 30 (BsTriShape)

- TL: remove block/branch 21 (BsTriShape)

- TL: remove block/branch 2 (NiNode)

- TL: select block 2 (bhkNPCollisionObject)

- BL: change value for "target" from "none" to "0" (zero)

- TL: select node 1 (BSXFlags)

- BL: click an the little flag in the row "integer data"

- pop up window: disable bits 0, 3, 7 and 9 and click "ok"

 

- optional:

- select from the drop down menu "Spells" - Sanitize - reorder blocks

- select from the drop down menu "Spells" - Optimize - remove unused strings

 

- save -> done

 

You can see the collision in CK in the preview window if you hit F4

The position of the collision is at 0, 0, 0. Thus you have to adjust the attach node in your base object, but that shouldn't be too hard :wink:

Link to comment
Share on other sites

Hey that's appreciated !

 

Tried it and got a terminal sat on the floor, with some buggering about:

 

(a) Stripped off the textures and materials, got a pink terminal sat on the floor.

 

(b) Removed all the shaders so the model is grey in Nifskope and invisible in preview and the world, but preview shows F4 collision mesh. Unfortunately even with a quest marker on the object or the screen shaded green I cant find collision that activates :sad:

 

https://imgur.com/Tys3stq

Link to comment
Share on other sites

Question: How do you attach the second NIF to the main NIF? I'm just curious. :cool:

 

For my combined objects i'm using attach nodes and a script to add the addons to the main object.

The main object must have a named NiNode and it should aslo have another NiNode named "REF_ATTACH_NODE"

 

To create a NiNode in NifSkope, right click on the first (top) NiNode and select "Node" -> "Attach Node" from the drop down menu, then select "NiNode" in the next one.

- Create one node and change it's name to "REF_ATTACH_NODE"

- Create a second node and name it "AddonNode_1" (or whatever else, you need the name in the script)

The origin of this second node is the point where your addon will be attached.

 

http://www.the-final-frontier.net/bvmink.png

 

The secondary NIF does not need any changes.

 

I made a frankenstein object out of a bookvending machine and a terminal on the fly.

http://www.the-final-frontier.net/bvm.png

 

If you move the BookVendingMachine, the terminal will be moved sychronously. No floating arround :thumbsup:

 

For the container i created a new container in CK with the modified NIF. The terminal is DN011OverdueBookVendTerminal (10DEE2)

 

Now, here's the somewhat stripped down script:

Scriptname am_AttachmentScript extends ObjectReference

;-- Properties --------------------------------------
Form Property attachForm Auto Const
String Property attachPoint Auto Const

;-- Events ------------------------------------------

Event OnWorkshopObjectDestroyed(ObjectReference akReference)
    ObjectReference attachment = Self.GetLinkedRef()
    if (attachment As Bool)
        attachment.DisableNoWait(false)
        attachment.Delete()
        Self.SetLinkedRef(None)
    EndIf
EndEvent

Event OnInit()
    ObjectReference attachment
    
    if (Self.HasNode(attachPoint))
        attachment = Self.PlaceAtNode(attachPoint, attachForm, 1, TRUE, FALSE, FALSE, TRUE)
        if (attachment As Bool)
            attachment.EnableNoWait(false)
            attachment.SetMotionType(Motion_Keyframed, FALSE)
            Self.SetLinkedRef(attachment)
        Else
            Debug.Trace(Self + " : cannot attach addon")
        EndIf
    Else
        Debug.Trace(Self + " : Node not found: " + attachPoint)
    EndIf
EndEvent


Event OnLoad()
    ObjectReference attachment = Self.GetLinkedRef()
    if (attachment As Bool)
        attachment.MoveToNode(Self As ObjectReference, attachPoint)
        attachment.AttachTo(Self As ObjectReference)
    EndIf
EndEvent

Event OnWorkshopObjectMoved(ObjectReference akReference)
    ObjectReference attachment = Self.GetLinkedRef()
    if (attachment As Bool)
        attachment.MoveToNode(Self As ObjectReference, attachPoint)
        attachment.AttachTo(Self As ObjectReference)
    EndIf
EndEvent

Just in case the game engine "forgets" to move the terminal, there are event handlers for "OnLoad()" and "OnWorkshopObjectMoved()".

 

You can use an invisible terminal, thoug i think it would be much easier to use an already existing terminal (or copy of it). It works fine with my frankenstein machine :smile:

Edited by deadbeeftffn
Link to comment
Share on other sites

Ah, looks like i buggered up the attach node.

 

One question Is AddonNode_1 a child of root (0) NiNode or "REF_ATTACH_NODE" ?

(0) NiNode > (1) "REF_ATTACH_NODE" > (2) AddonNode_1

... or ...

(0) NiNode > (1) "REF_ATTACH_NODE"

(0) NiNode > (2) AddonNode_1

Link to comment
Share on other sites

WORKS PERFECTLY *** THANK YOU SOOOO MUCH *** :thumbsup:

 

No more buggering about with invisible collisions !

 

Question: does the attachment become disconnected OnUnload, or are the OnLoad and ObjectMoved attachments extra defensive quality just in case ?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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