SandMouseAnarchy Posted November 15, 2018 Share Posted November 15, 2018 Hi guys, im hoping someone can help (another week another problem haha) - Im trying to swap an armor's ObjectMod via script depending on the players gender.(The ObjectMod has a mesh) This is what i have so far - Scriptname ModularEquipMods extends ObjectReference Const Keyword Property ModularArmorKeyword_Mod_1 Auto Const Keyword Property ModularArmorKeyword_Mod_2 Auto Const Keyword Property ModularArmorKeyword_Mod_3 Auto Const ObjectMod Property ModularArmor_M_Mod_1 auto const ObjectMod Property ModularArmor_M_Mod_2 auto const ObjectMod Property ModularArmor_M_Mod_3 auto const ObjectMod Property ModularArmor_F_Mod_1 auto const ObjectMod Property ModularArmor_F_Mod_2 auto const ObjectMod Property ModularArmor_F_Mod_3 auto const int property ModularArmorKeyword_BipedSlot auto const Event OnEquipped(Actor akActor) if akActor == Game.GetPlayer() Actor Player = Game.GetPlayer() Debug.Notification("Armor piece equipped... starting test") Form Equipment = Player.GetWornItem(ModularArmorKeyword_BipedSlot).Item Debug.Notification("... got biped slot") Objectreference ArmorRef = GetBaseObject() as Objectreference Debug.Notification("... got biped slot as armor") ;______________________________________________________________________________ If(ArmorRef.HasKeyword(ModularArmorKeyword_Mod_1)) Debug.Notification("Keyword 1 found...") ActorBase PlayerBase = Game.GetPlayer().GetBaseObject() as ActorBase if (PlayerBase.GetSex() == 1) RemoveMod(ModularArmor_M_Mod_1) Utility.Wait(0.5) AttachMod(ModularArmor_F_Mod_1) Debug.Notification("...Female armor added") endIf if (PlayerBase.GetSex() == 0) RemoveMod(ModularArmor_F_Mod_1) Utility.Wait(0.5) AttachMod(ModularArmor_M_Mod_1) Debug.Notification("...Male armor added") endif else Debug.Notification("...no keyword 1") endif ;______________________________________________________________________________ endif Debug.Notification("... ending equip test...") endEvent ((My script checks if the armor has a keyword, if it does, and if the player is female then the ObjectMod on that armor that corilates to that keyword is replaced with a female version.)) When i equip the armor in game though, i get the notifications telling me that the ObjectMod has been swapped, but the mesh doesnt change. i wonder if im removing and adding the ObjectMods to the right piece of armor(?)Im not really sure what the problem is with this script. any ideas guys? Link to comment Share on other sites More sharing options...
pra Posted November 15, 2018 Share Posted November 15, 2018 Have you looked at the armor in a workbench to see if the swapping really happened? Or, tried unequipping and reequipping the armor manually? I have the suspicion that these modification-related functions aren't uptading worn equipment properly, so it might be that it actually works, but you don't see it right away. Link to comment Share on other sites More sharing options...
SandMouseAnarchy Posted November 15, 2018 Author Share Posted November 15, 2018 (edited) Thankyou for the reply Pra :) I did a little messing around, added everything to an OnTutorialEvent, ModSuccess event and tested it in the workbench - It seems like the ObjectMod is being swapped correctly but the 3rd person model doesn't change, maybe the worn equipment isn't updating - just like you say. (this is a power armor armor piece so when in the workbench or when just looking at the power armor furniture - the correct model shows, but when I'm wearing the power armor the model stays looking like the original.)((if I unequip and re-equip the armor, nothing happens - the model still looks like the original, if I save and load back in to game - the model still looks like the original)) So, if this issue is because the worn equipment isn't updating, how can I make it update?Is there a Force3DUpdate function? **EDIT** I tried:"AttachModToInvintoryItem(Equipment, ModularArmor_FMod_1)"and "RemoveModFromInvintoryItem(Equipment, ModularArmor_M_Mod_1)" instead of "AttachMod()" and "RemoveMod()" because I found on the wiki that those lines force a 3d update, but now neither the furniture or 3rd person models change with the script, and the ObjectMod in the workbench isn't actually changed by the script either... I'm not sure if I'm pointing it to the right piece of armor or not (the one I'm wearing/the one that was just modified) I think I'm attaching and removing ObjectMods from the "BaseObject" (from "GetBaseObject()") instead of the reference object (what I'm wearing/modifying) I don't know, I'm feeling pretty stupid and stumped on this one. Any ideas? Edited November 15, 2018 by SandMouseAnarchy Link to comment Share on other sites More sharing options...
Recommended Posts