Jump to content

Is there a way to control what armor variation gets equipped?


Recommended Posts

I am trying to copy the worn items of one actor and equip them on another so that they look exactly the same.

 

The problem I am having is that many armors have variations that seem to randomize automatically.

 

Is there a way to override that randomization and control which variations appear when the item is equipped?

 

Here is the function I am using currently:

Function copyClothes(Actor a, Actor b)
int i = clothes_scan_startslot
While i < (clothes_scan_endslot + 1)
Form clothesItem = a.GetWornItem(i).Item
b.EquipItem(clothesItem, false, true)
i = i + 1
EndWhile
EndFunction
Link to comment
Share on other sites

If your "variation" means "heavy/medium/light", it may be ObjectMod.

In that case, GetWornItemMods will help.

 

Not tested but code will be like this:

Function copyClothes(Actor a, Actor b)
  int i = clothes_scan_startslot
  While i < (clothes_scan_endslot + 1)
    Form clothesItem = a.GetWornItem(i).Item
    b.RemoveItem(clothesItem, -1, true, container_tmp)
    b.addItem(clothesItem)
    ObjectMod[] mods = a.GetWornItemMods(i)
    int j = 0
    While j < mods.length
      b.AttachModToInventoryItem(clothesItem, mods[j])
      j = j + 1
    EndWhile
    b.EquipItem(clothesItem, false, true)
    container_tmp.RemoveItem(clothesItem, -1, true, b)
    i = i + 1
  EndWhile
EndFunction

Link to comment
Share on other sites

 

If your "variation" means "heavy/medium/light", it may be ObjectMod.

In that case, GetWornItemMods will help.

 

Not tested but code will be like this:

Function copyClothes(Actor a, Actor b)
  int i = clothes_scan_startslot
  While i < (clothes_scan_endslot + 1)
    Form clothesItem = a.GetWornItem(i).Item
    b.RemoveItem(clothesItem, -1, true, container_tmp)
    b.addItem(clothesItem)
    ObjectMod[] mods = a.GetWornItemMods(i)
    int j = 0
    While j < mods.length
      b.AttachModToInventoryItem(clothesItem, mods[j])
      j = j + 1
    EndWhile
    b.EquipItem(clothesItem, false, true)
    container_tmp.RemoveItem(clothesItem, -1, true, b)
    i = i + 1
  EndWhile
EndFunction

 

What is the best way to set up the "container_tmp"?

 

Is there an existing container that is commonly used for this kind of thing? If possible, I would prefer not to add things to the world.

Link to comment
Share on other sites

You can always create a specific outfit with the exact armor bits included... Just make sure the outfit covers the exact bpdy parts the original outfit covers, otherwise it will crash the CK...

 

That's a very good solution for an individual play-through. But, I'm hoping for a solution that automates it via code for everyone.

 

I think that the above code could work. But, I'm a little unsure what the best way to set up the temp container is. I've seen that kind of thing discussed for other mods before. But, haven't set it up myself.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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