JW1 Posted February 27, 2017 Share Posted February 27, 2017 I've created an armour item and an associated mod. The mod works: I can add it at a workbench and also add and remove it using attachmod and removemod in the console. For testing purposes, I've placed a very simple script on the armour: Scriptname testMod:ArmourScript extends ObjectReference ObjectMod property MyMod auto const mandatory Event OnEquipped(Actor akActor) attachmod(MyMod,1) EndEvent As you can see, all it does is attach the mod when the armour is equipped. I've set the objectmod property to my mod, the script compiles OK, but nothing happens when the armour is equipped. Does anyone have any idea why this isn't working? Link to comment Share on other sites More sharing options...
shavkacagarikia Posted February 27, 2017 Share Posted February 27, 2017 You havent specified to which object that mod should be attached. And you can use that function only on reference of your base armor. I mean it should be placed somewhere in world(i.e should have reference). Like yourArmorReference.attachmod(). Link to comment Share on other sites More sharing options...
JW1 Posted February 28, 2017 Author Share Posted February 28, 2017 Thanks very much for replying! I see what you mean, but I'm not sure how to get there. I originally had self.attachmod, but that didn't work either. Is something else needed to be able to get a 'self' reference? I don't see a 'GetSelf' function in the CK? Link to comment Share on other sites More sharing options...
shavkacagarikia Posted February 28, 2017 Share Posted February 28, 2017 You cannot get the reference of the object that is in your inventory. What you want to do isnt possible (Or maybe its possible with some workarounds) for any reference of that armor. Maximum you can place that armor somewhere in world and call that function on that reference, but if you then add other copy of that armor and equip it the mod still will be attached on that first reference. If you want I can check maybe there are some workarounds. Link to comment Share on other sites More sharing options...
JW1 Posted February 28, 2017 Author Share Posted February 28, 2017 (edited) I'm starting to see what's going on, even if I don't really understand it. If I drop the armour, pick it up and then equip it, the script works fine. If it's already in my inventory (as was the case when I was testing previously), then simply equipping it doesn't work. As you say, I suppose the item simply doesn't have a reference until an instance of it is created in the game. I see there's also an 'AttachModToInventoryItem' function - perhaps that's the one to use? (I also have discovered that OnEquipped really means what it says, it runs continuously while the armour is equipped, not just once like the old GECK OnEquip block. ) Edited February 28, 2017 by JW1 Link to comment Share on other sites More sharing options...
shavkacagarikia Posted February 28, 2017 Share Posted February 28, 2017 Yes thats the case. AttachModToInventoryItem will work if you have only one copy of the base armor, if you have multiple , the function probably won't work. And also I think you are wrong about OnEquipped it fires when the object is equipped, events never work continuosly. Link to comment Share on other sites More sharing options...
JW1 Posted February 28, 2017 Author Share Posted February 28, 2017 Thanks. Yes, there's only one copy of the armour so that may be the way to go. As for the OnEquipped: with the script as above, when I dropped the armour, picked it up and equipped it, the mod was definitely being equipped over and over as the 'equip mod' sound was being played continuously. Link to comment Share on other sites More sharing options...
Recommended Posts