Jump to content

Settler auto equip mod


BrendonLeCount

Recommended Posts

well it's working fine so far.

I need to level up to build the console to manage all settlements, but it works great just using the cabinet.

 

If you've made it to the institute, grab a synth relay grenade and you'll be able to craft the console with Level 1 Science rather than Level 3.

 

 

Good God,man! You're on a modding spree! First the Jetpack Overhaul,and now this! And those are just the ones I know of. You work quick,Imp.

I've been away from modding and Fallout 4 for kind of a while. I just came back and there's tons to do. I also released Telestorage and Craftable Provisioner Tracker, and have Powered Power Armor and an update to More Complex Wasteland in the works. For the most part these mods have been relatively quick and easy to produce (the big time consumer now is patches for Jetpack Overhaul).

Edited by Imp of the Perverse
Link to comment
Share on other sites

Hey Imp, nice work with the mod. I noticed you're having problems to add support for armors. I investigated a bit and couldn't find any efficient way to get the biped slot of an item. However, there may be some workarounds. One option would be to use keywords to identify slots, but I noticed the vainilla items are a bit inconsistent on what keywords they have associated. AWKCR seems to have better ones. That would allow you to organize any armor piece compatible with AWKCR, including all vainilla armors.

 

Another option is to use this F4SE function:
https://www.creationkit.com/fallout4/index.php?title=GetWornItem_-_Actor

You could create a dummy actor somewhere, equip it with an item, and then iterate over all biped slots until you find the equiped armor. That will tell you what biped slot it's using, so you can place it in a formlist or something. This would take quite some time, so it should only be done when the player decides (add a menu option like "Analyze armor items" or something like that).

Link to comment
Share on other sites

Hey Imp, nice work with the mod. I noticed you're having problems to add support for armors. I investigated a bit and couldn't find any efficient way to get the biped slot of an item. However, there may be some workarounds. One option would be to use keywords to identify slots, but I noticed the vainilla items are a bit inconsistent on what keywords they have associated. AWKCR seems to have better ones. That would allow you to organize any armor piece compatible with AWKCR, including all vainilla armors.

 

Another option is to use this F4SE function:

https://www.creationkit.com/fallout4/index.php?title=GetWornItem_-_Actor

You could create a dummy actor somewhere, equip it with an item, and then iterate over all biped slots until you find the equiped armor. That will tell you what biped slot it's using, so you can place it in a formlist or something. This would take quite some time, so it should only be done when the player decides (add a menu option like "Analyze armor items" or something like that).

 

Thanks, I literally just came across GetWornItem on the Creation Kit Wiki and was about to test it out. What I was trying to do up until then was outfit an NPC with a dummy armor item in each slot, then check to see if it was still equipped after equipping the piece of armor to be sorted. No luck.

 

No luck with GetWornItem either now though. Here's my code if you want to take a look:

int Function GetType(Armor kArmor)
	; equip the piece
	DYSSortingNPCREF.AddItem(kArmor, 1)
	DYSSortingNPCREF.EquipItem(kArmor, true)

	; check for slot replacement
	bool bArmLeft = DYSSortingNPCREF.GetWornItem(42).Model == kArmor
	bool bArmRight = DYSSortingNPCREF.GetWornItem(43).Model == kArmor
	bool bChest = DYSSortingNPCREF.GetWornItem(41).Model == kArmor
	bool bHelmet = DYSSortingNPCREF.GetWornItem(30).Model == kArmor || \
					DYSSortingNPCREF.GetWornItem(31).Model == kArmor || \
					DYSSortingNPCREF.GetWornItem(46).Model == kArmor || \
					DYSSortingNPCREF.GetWornItem(47).Model == kArmor || \
					DYSSortingNPCREF.GetWornItem(48).Model == kArmor || \
					DYSSortingNPCREF.GetWornItem(49).Model == kArmor
	bool bLegLeft = DYSSortingNPCREF.GetWornItem(44).Model == kArmor
	bool bLegRight = DYSSortingNPCREF.GetWornItem(45).Model == kArmor
	bool bBody = DYSSortingNPCREF.GetWornItem(33).Model == kArmor

	; determine type from slot(s)
	int iType = -1
	If bHelmet
		iType = 0										; helmet
	ElseIf bBody && (bArmLeft || bArmRight || bChest || bLegLeft || bLegRight)
		iType = 1										; one piece
	ElseIf bBody
		iType = 2										; underarmor
	ElseIf bChest
		iType = 3										; chest
	ElseIf bArmLeft
		iType = 4										; left arm
	ElseIf bArmRight
		iType = 5										; right arm
	ElseIf bLegLeft
		iType = 6										; left leg
	ElseIf bLegRight
		iType = 7										; right leg
	EndIf
	
	; get rid of the armor piece
	DYSSortingNPCREF.UnequipItem(kArmor)
	DYSSortingNPCREF.RemoveItem(kArmor, 1)
	
	return iType
EndFunction

I've tried using both .Item and .Model, comparing them to None and to kArmor, and just comparing the WornItem return value to None (it always returns a WornItem object). Ug.

Link to comment
Share on other sites

That's weird. Both ".item" and ".model" should return a Form. Have you tried casting kArmor to Form? It shouldn't have any effect tho. Maybe if you invert the comparison? Check if the equipped item in each slot is NOT the dummy item? I would add a few debug lines to see what the functions are returning. Alternatively, you could do something like the example in the wiki. Iterate over all the slots from 0 to 43 until the comparison returns true. That index is the biped slot. It may be a bit more resource expensive tho.

If those functions don't work, maybe you should go with AWKCR keywords, it has one for every slot. At least you can use the vainilla weapons and some modded weapons. Those item's that can't be recognized could be moved to another container for the player to retrieve.

Edited by MaxShadow09
Link to comment
Share on other sites

I can't get Debug.Trace to work so I can't really check what's being returned by GetWornItem directly, but one problem was that I was using the actual biped slot rather than the slot index (subtract 30 from the biped slot to get the slot index). Even after fixing that though I'm still getting the wrong behavior - it ignores slots other than body and head (I tried both the and [A] slots). What I'll probably do is just start requiring AWKCR and sort via keyword. That should be faster anyway, and I need it to fix an issue with rechambered weapons not getting the right ammo.

Link to comment
Share on other sites

Debug.Trace doesn't work? It should write someting in the papyrus logs, if you have them enabled. Have you tried with ".GetFormID" (returns in decimal, not hex) or ".GetName" (F4SE)? You could try Debug.Notification instead, but I don't know if you can display variables there.

Edited by MaxShadow09
Link to comment
Share on other sites

I guess with GetFormID I could use message boxes and pass the ID as an argument, but yeah, I've enabled debug logs and trace in the .ini and my trace calls don't show up in the log. I tried the various message box debug functions too and they're not working either.

Link to comment
Share on other sites

  • 4 years later...

Old forum I was looking for the mannequin mod that does this, before I just make a mannequin place all objects in it I want, then type duplicateallitems (NPC Ref ID) while pressing the mannequin in the console then I walk to the NPC and ask to trade and it is wearing everything the mannequin had on. Though someone made a mod using a mannequin to auto quip all settlers.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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