Chronepsys Posted June 3, 2022 Share Posted June 3, 2022 Hi all, I am asking to myelf (and you now) if it is possible to switch the equipment worn by the player with the one worn by a mannequin or contain in a chest or what else. Unfortunatly, i have not enought knowledge in scripting for work on this and i have no idea to the way to get it without a script. Could you tell me if it does already exists and/or if you have a solution to tell me ? Thanks for reading. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 3, 2022 Share Posted June 3, 2022 It is theoretically possible. But you need to know what equipment is in the container in order to transfer and equip it on the player. It would be a touch easier with a mannequin as the mannequin actor will be wearing the gear and equipped items can be obtained without knowing exactly what object it might be. Do I know of an existing script? Not off the top of my head. Link to comment Share on other sites More sharing options...
ocloki Posted June 4, 2022 Share Posted June 4, 2022 Are you talking about something like the Legacy of the Dragonborn mod uses in the safehouse? It has a cabinet that you can store outfits and has a spell that you can use anywhere to switch to them. Link to comment Share on other sites More sharing options...
dylbill Posted June 5, 2022 Share Posted June 5, 2022 Yes it's possible and not too difficult. I agree with Ishara, it'd be easier to do on a mannequin. Attach this script to the mannequin, and when you active it, it should swap armor: Scriptname TM_ActorScript extends Actor Event OnActivate(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() SwapAllArmor(Game.GetPlayer(), Self) ;swap all armor between this actor and the player Endif Endevent Function SwapAllArmor(Actor ActorA, Actor ActorB) Int i = 30 While i < 61 ;cycle through all availbale armor slots ;get current equipped armor in slot(i) for Actors A and B Armor ArmorA = ActorA.GetEquippedArmorInSlot(i) Armor ArmorB = ActorB.GetEquippedArmorInSlot(i) If ArmorA != ArmorB ;Are ArmorA and ArmorB different? If ArmorA ;does ActorA have something equipped in (i) slot? ActorA.UnEquipItem(ArmorA) Endif If ArmorB ActorB.UnEquipItem(ArmorB) Endif If ArmorA ActorA.RemoveItem(ArmorA, 1, true, ActorB) ;remove ArmorA from ActorA and give it to ActorB ActorB.EquipItem(ArmorA) Endif If ArmorB ActorB.RemoveItem(ArmorB, 1, true, ActorA) ;remove ArmorB from ActorB and give it to ActorA ActorA.EquipItem(ArmorB) Endif Endif i += 1 ;add 1 to i EndWhile EndFunctionChange the name of the script, and also note that it requires SSE to compile as GetEquippedArmorInSlot is exclusively an SSE function. I haven't tested it but I think it should work. Link to comment Share on other sites More sharing options...
dylbill Posted June 5, 2022 Share Posted June 5, 2022 Hey so I did test it cause I was curious, there needed to be a small change to make sure an armor piece wasn't swapped twice. Here's the modified script: Scriptname TM_ActorScript extends Actor Event OnActivate(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() SwapAllArmor(Game.GetPlayer(), Self) ;swap all armor between this actor and the player Endif Endevent Function SwapAllArmor(Actor ActorA, Actor ActorB) Int i = 30 Form[] SwappedArmor = New Form[100] Int SwappedArmorIndex = 0 While i < 61 ;cycle through all availbale armor slots ;get current equipped armor in slot(i) for Actors A and B Armor ArmorA = ActorA.GetEquippedArmorInSlot(i) Armor ArmorB = ActorB.GetEquippedArmorInSlot(i) If ArmorA != ArmorB ;Are ArmorA and ArmorB different? Int ArmorACheck = SwappedArmor.Find(ArmorA) Int ArmorBCheck = SwappedArmor.Find(ArmorB) If ArmorACheck == -1 ;ArmorA hasn't been swapped yet If ArmorA ;does ActorA have something equipped in (i) slot? ActorA.UnEquipItem(ArmorA) SwappedArmor[SwappedArmorIndex] = ArmorA ;save armorA to SwappedArmor array SwappedArmorIndex += 1 Endif Endif If ArmorBCheck == -1 If ArmorB ActorB.UnEquipItem(ArmorB) SwappedArmor[SwappedArmorIndex] = ArmorB SwappedArmorIndex += 1 Endif Endif If ArmorACheck == -1 If ArmorA ActorA.RemoveItem(ArmorA, 1, true, ActorB) ;remove ArmorA from ActorA and give it to ActorB ActorB.EquipItem(ArmorA) Endif Endif If ArmorBCheck == -1 If ArmorB ActorB.RemoveItem(ArmorB, 1, true, ActorA) ;remove ArmorB from ActorB and give it to ActorA ActorA.EquipItem(ArmorB) Endif Endif Endif i += 1 ;add 1 to i EndWhile EndFunction Link to comment Share on other sites More sharing options...
Chronepsys Posted June 8, 2022 Author Share Posted June 8, 2022 Hi all, I just came back from Brocéliande this week and so i did not read before. I will test it soon and will come back to thank you again ! Thank you for your answers. Link to comment Share on other sites More sharing options...
Recommended Posts