frogs345 Posted November 6, 2010 Share Posted November 6, 2010 I have a script for a set of clothes I am making that removes the pipboy glove when you equip, and then reequips the glove when you unequip the item. Problem is, it only does the first half of that. Anyone know how to fix this? Code:scn VriskaClothesPipboyGlove int InitGloveEquipped ; 0 = Glove not equipped, 1 = glove equipped initially Begin OnEquip if player.GetEquipped PipBoyGlove == 1 ; If this returns 1, it will run the following hooks: set InitGloveEquipped to 1 ; Sets the integer to 1 so that it will equip the glove when unequipping the clothes player.UnequipItem PipBoyGlove 1 1 ; Removes the glove (Wow what a surprise!!!) hiddenly endif End Begin OnUnequip if InitGloveEquipped == 1 ; Checks if the glove was equipped when you put on your clothes, returns 1 if it was. player.AddItem pipboyglove 1 1 player.EquipItem PipBoyGlove 1 1 set InitGloveEquipped to 0 ; Sets the integer back to 0 so if the PC will (somehow) unequip the glove, it won't equip it again. endif End Link to comment Share on other sites More sharing options...
frogs345 Posted November 7, 2010 Author Share Posted November 7, 2010 I'm guessing no one knows how to fix this then? Link to comment Share on other sites More sharing options...
Cipscis Posted November 8, 2010 Share Posted November 8, 2010 It looks to me like it should work, although I'm unsure why you're adding another glove to the player's inventory when you re-equip it. If you remove the AddItem line, does the script function any differently? Cipscis Link to comment Share on other sites More sharing options...
gsmanners Posted November 8, 2010 Share Posted November 8, 2010 More importantly, how exactly are you equipping and unequipping? In my experience, the OnUnequip block only executes if you use a shortcut key and unequip an item in gamemode. Link to comment Share on other sites More sharing options...
frogs345 Posted November 8, 2010 Author Share Posted November 8, 2010 I think the AddItem code was either from an old version of the script, or to make sure the glove was in the inventory if it got removed somehow. I'm equipping and unequipping the item normally through the PipBoy. Link to comment Share on other sites More sharing options...
frogs345 Posted November 12, 2010 Author Share Posted November 12, 2010 Anyone know how to fix this then? Link to comment Share on other sites More sharing options...
Shoobydoo Posted November 12, 2010 Share Posted November 12, 2010 Are you trying to replace the pipboy glove with another custom type and still have a pipboy attached, or remove it entirely? In either case, if you are creating a custom outfit/armor you will setup its armor addons which will determine what gloves (pipboy or otherwise) and pipboy (should such be part of the outfit) and as such, there is really no need for the "OnEquip" part, unless you are adding a custom pipboy, in which case you'll want to add a 'resetpipboymanager' statement. The primary thing you want to worry about in custom armor scripts is the part dealing with when you Unequip it, so anything else you put on will have it's normal pipboy interface added and initialized properly on the switch (and since most default armor and outfits already come with associated pipboy gloves for player-wearing, you only need to allow for re-equipping and initiating the pipboy when switching which, I think, also takes care of its associated pipboy glove as well. For example, a script for armor with a custom textured pipboy (already added to the armor addon-list for the outfit along with the pipboyglove and right hand glove): scn VriskaClothesPipboyGlove Begin OnEquip resetpipboymanager end Begin OnUnequip player.EquipItem PipBoy 1 resetpipboymanager End Or, if you are making an outfit with the default pipboy but no pipboy glove (remember, both of these are setup in the armor addon-list and not in scripts as far as what is equipped by default when you put the outfit on) and you want to make sure when you put somehing else on that everything goes back to the normal defaults for said new outfit: scn VriskaClothesPipboyGlove Begin OnUnequip player.EquipItem PipBoyGlove 1 End Keep in mind I'm just going by memory here as I'm at work and can't check my scripts at home from my mods that deal with such things so.....but thats basically what works for me. Link to comment Share on other sites More sharing options...
gsmanners Posted November 12, 2010 Share Posted November 12, 2010 Yeah, that'll work. :rolleyes: A fix would obviously have to avoid the bug that I told you about: int InitGloveEquipped Begin OnEquip if player.GetEquipped PipBoyGlove set InitGloveEquipped to 1 player.UnequipItem PipBoyGlove 1 1 endif End Begin OnUnequip if InitGloveEquipped player.AddItem PipBoyGlove 1 1 player.EquipItem PipBoyGlove 1 1 set InitGloveEquipped to 0 endif End begin MenuMode if (player.GetEquipped YourGlove == 0) && InitGloveEquipped player.AddItem PipBoyGlove 1 1 player.EquipItem PipBoyGlove 1 1 set InitGloveEquipped to 0 endif end Link to comment Share on other sites More sharing options...
Shoobydoo Posted November 13, 2010 Share Posted November 13, 2010 Yeah, that'll work. :rolleyes: A fix would obviously have to avoid the bug that I told you about: int InitGloveEquipped Begin OnEquip if player.GetEquipped PipBoyGlove set InitGloveEquipped to 1 player.UnequipItem PipBoyGlove 1 1 endif End Begin OnUnequip if InitGloveEquipped player.AddItem PipBoyGlove 1 1 player.EquipItem PipBoyGlove 1 1 set InitGloveEquipped to 0 endif End begin MenuMode if (player.GetEquipped YourGlove == 0) && InitGloveEquipped player.AddItem PipBoyGlove 1 1 player.EquipItem PipBoyGlove 1 1 set InitGloveEquipped to 0 endif end Sorry but I don't really see the point of that script since its still being used to remove a glove from an outfit that would already be gone if the armor was setup correctly to begin with in its armor addon list in the geck...it just seems to be a way of making it more difficult than it needs to be IMO lol More importantly, how exactly are you equipping and unequipping? In my experience, the OnUnequip block only executes if you use a shortcut key and unequip an item in gamemode. Not really sure what you mean there as I use Begin OnUnequip in my scripts for both mods I've made (one for Fo3 and one for NV) for custom pipboys and pipboy gloves and it works like a charm with no glitches when equipping the custom armor then changing to something else /shrug Link to comment Share on other sites More sharing options...
frogs345 Posted November 14, 2010 Author Share Posted November 14, 2010 I am trying to make it so that the glove doesn't reequip if you didn't have the glove on you equipped the item. Link to comment Share on other sites More sharing options...
Recommended Posts