Jump to content

FYI: AttachMod function not working as intended


Recommended Posts

While working on my WIP mod Build Your Own Faction, specifically with the robot Mr. Handy, I encountered an issue while trying to manually attach eyes, eye armor, arms, arm armor. Other robots could be built entirely by script with no issues. But for Mr. Handy, I cannot seem to reuse object mods despite using different, valid AttachPoint values.

 

Example:

 

; arm - left
arraylength = BYOFMrHandyArmLeft.length-1
random = Utility.RandomInt(0, arraylength)
robot.AttachMod(BYOFMrHandyArmLeft[random], 1)

 

; arm - middle
arraylength = BYOFMrHandyArmMid.length-1
random = Utility.RandomInt(0, arraylength)
robot.AttachMod(BYOFMrHandyArmMid[random], 0)

 

; arm - right
arraylength = BYOFMrHandyArmRight.length-1
random = Utility.RandomInt(0, arraylength)
robot.AttachMod(BYOFMrHandyArmRight[random], 2)

 

If I only do it once and an attach point value form 0-2 it shows up with no issue at the correct attach point. Calling all 3 causes only 1 arm to show, it does not move slots as expected either.

 

To further test this as an issue with the function itself, I assigned the limbs manually in the creation kit under the Actor's "Object Template". The Mr. Handy displays in the preview with all limbs and does so in the game, at least until the first AttachMod function is called on the arms. Then it unequips all of the current arms.

 

I believe this is caused by the part mentioned in the documentation "Changing an armor item's mods causes it to be silently unequipped and re-equipped." It would seem that the function searches for the mod regardless of AttachPoint and removes all iterations from what the object currently has attached to it.

 

Has anyone else encountered this while trying to reuse mods on weapons/armor/robots? As a workaround... I can try to make new objects. Not sure what else may be needed for these to be treated separately.

 

EDIT: Edited text above for clarity. I also want to point out the absurdity of the documentation since it specifically lists attachpoints for robot arms.

 

Also, link to the function: https://www.creationkit.com/fallout4/index.php?title=AttachMod_-_ObjectReference

Link to comment
Share on other sites

Hey mate, so when you attach an Omod to something ingame it will reload the objects 3D data, it will look like the omods all unequip and then reequip one by one, I can't find a way around this without disabling the object first and then reenabling it after the omods are attached but that doesn't always look right.

 

So I think if I understand the post properly - when you attach an arm mod all other arm mods disappear from the robot and don't reappear? You could try removing the body part id from the Omod object properties tab, that property seems to tell the game to override every other Omod using the same id.

- Another idea could be that maybe the Omod has another attachpoint in its nif, and maybe that Omod is trying to attach to multiple points?

 

Not sure if that helps or not mate, if you can give a few more details about the problem I might be able to help figure it out ^.^

Link to comment
Share on other sites

I'm building robots entirely by script, there are no listings in the Object Template unless I am troubleshooting, so nothing should by overridden. I was able to work around the issue by utilizing other attachpoints, whether vanilla or added in the associated "Limb" mod attach point. This is the same as you suggested. I found out the name of the AttachPoint seems to be arbitrary, as long as the part's mesh was made to be compatible, you use the correct AttachPoint value (0-2 in my case), and the parent limb has the AttachPoint variable you assign to the limb all is good.

What doesn't make sense is this doesnt apply to the armor I am attaching, at least not the arm armor... the eye armor is not applying correctly. Maybe it's something in the mesh I'm not aware of ... but the issue doesn't happen if I manually assign it in the ObjectTemplate, only when done via script. I just managed to get the weapons working since I was apparently using the wrong race. The MrHandy race is good and all, but the mods added by Automatron seem to only work for the newly added mrhandy build-a-bot race.

 

Slowly working my way past the issue. Thought it would be good to share this information for others though, always sucks coming across something like this and not finding anything online.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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