Jump to content

How to use PlaceAtNode() with custom node?


Recommended Posts

Im trying to attach a grenade to a parent attach point on an outfit if the player has grenades equipped but i cant get PlaceAtNode to work, i wonder if it even works with attach points at all or if the node being reffered to is something else entirely...

 

What i have so far...

(My outfit has "G1" as a parrent attach point in the nif)

Form Property FragGrenade Auto


Event OnEquipped(Actor akActor)
	If akActor == Game.GetPlayer()
	    If akActor.GetEquippedItemType(2) == 10
		   objectreference grenade1 = akActor.placeatnode("g1", FragGrenade)
			Debug.notification("FragGrenade attached to G1")
	    EndIf
        EndIf
Endevent

But nothing happens in game apart from getting the debug notification.

im pretty sure im not referencing the outfit that has the attach point at all here, so that could be a problem...

 

And im pretty sure that node names are defined in a BodyPartData object somewhere in CK...

So does that mean i have to make a new BodyPartData object for my outfit and define the custom node there?

and if so, how do i point my script to that node on that outfit rather than the default human skeleton nodes?

 

((i could attach grenades as ObjectMods, but i would rather not have the player's 3d reload everytime a grenade is equipped, and i would also rather everything were setup more dynamically so that the script will work with any grenade, (eg: the script will grab the base object of whatever grenade is equipped and attach a ref of it to the outfit)))

Link to comment
Share on other sites

(Another quick post) Using attachrefâing in any way, youâre going to run into a distance bug at some point.

As in; you attach something to the player/npc via attachto/attachref/etc, the player/npc gets 3 cells away from the original cell the object was loaded in, the attached object ( grenade, in your case) returns to its original location at time-of-being-attached and unloads (because that location is out of ugridstoload or whatevâs).

 

If you figure out how to fix that...thereâs a few people who would like to have a word with you. ;)

Link to comment
Share on other sites

Using AttachT, and a new ArtObject for to house an a nif of the grenade (that has the AttachT info, then a spell/ench/perk on the player conditioned to some how pull which grenade is equipped and then pull the corresponding grenadeâs AO (that you created), via an effect/vfx might be an alternative that doesnât need any reloading of 3d.
Link to comment
Share on other sites

If you figure out how to fix that...thereâs a few people who would like to have a word with you. :wink:

 

I am unpicking a similar issue right now, clunky working models are:

 

Attach an OnUnload() script to the object that using an isequppied variable disables itself, moves to player, attaches and enables. Sweet.

 

Or

 

When equipped, register for distance greater than 128 units player to object OnDistanceGreaterThan event disables itself, moves to player, attaches and enables. Yuck overhead.

Link to comment
Share on other sites

Blahblahdeeblahblah, that's very interesting info, I didn't know the thing to be attached would unload itself after a certain distance...

That's good to know though so I can plan for that hurdle too ^.^

 

Ah, so the "nodes" are specifically bones then, not connect points or other random bsnode - good to know! I'll throw some bones into the outfits skeleton and see what happens :)

 

Ah SKK50 - great ideas! I think that will solve the unloading issue, I bet the reloading script could be tied to events like opening the pipboy to so we can attach the grenades again while they're hidden behind the pipboy menu :)

 

I have never messed with LODs in fallout - is the distance that the attached object will unload after tied to an LOD limit? Could it be given LOD data somehow?

 

Thanks guys! This has really helped!

Link to comment
Share on other sites

LOD fade and 3d load/unload may not be the same things.


My actor observations are that 3d will always report unloaded over the uGridsToLoad radius (default 10,240 units), except for specials like vertibids.


An unanimated actor representation, those slide/hover translations, is provided out to ( uGrid Game Unit Radius * ( fLODFadeOutMultActors / 10 ) ) so 15350 game units. I have validated this out to 25 uGrids (51,200 units).

Link to comment
Share on other sites

So how do you specifically use Placeatnode?

 

I have...

 

ObjectReference Grenade1 = akActor.PlaceAtNode("G1", FragGrenade)

 

So, "ObjectReference Grenade1" is giving the name "Grenade1" to whatever the object reference is in the script?

Should I use "Getbaseobject" first to get the reference, or is the reference already the equipped item?

-Or is the "ObjectReference Grenade1" supposed to reference the outfit? Or is it supposed to be a reference of the grenade to place itself?

 

Then "= akActor.Placeatnode("G1", FragGrenade)" so this says to place the "FragGrenade property" at the "G1" node on akActor?

 

I still can't get it to work, there are now bones (ninodes) in the nif for the PlaceAtNode function to use, but no grenade shows up in game, maybe I have to enable the object first? Or start initially enabled? I'm not sure -

In the mean time I'm going to try experimenting with, PlaceAtMe, MoveTo, and attachTo, but I would rather do it with Placeatnode for simplicity.

 

Man, so many questions, a big thank-you to anyone brave enough to throw down some info here.

 

 

-EDIT-

SKK50, ah I've just seen your other reply ^.^ ah man, it looks like the only option then is to have the script manually reattach the grenades every time they unload... This hopefully won't look too awful, especially if it doesn't reload the entire player 3d like ObjectMods do.

Would it be worth updating the script for every 1 or 2 grids loaded instead of waiting for the unload? I'm not sure if that would just build up too much script spam..

Edited by SandMouseAnarchy
Link to comment
Share on other sites

Can look up Shcarcarst, thereâs an example of it in there.
(Think of the Cart as your grenade, and think of the invisible actor itâs attachtoâd as the player)

As far as I remember when I tried to move it back to the player when it unloaded, there would always be an offset (which, again, as far as I could tell is a bug that goes back to Skyrim) when the âgrenadeâ was pulled back to the actor. The alternative was to splinetranslate, but that required it have 3d loaded, *iirc*.

BIG 'if I recall correctly' attached to this whole thing, itâs been a few months since we tried any of this (about the time we released Shcarcarst and Cancerous1 released Wasteland Wagons, Which both use a version of AttachTo).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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