orkel1215 Posted September 23, 2020 Share Posted September 23, 2020 (edited) Im making a mod and I want it to be as compatible with other mods as possible. I want to prevent the player from dropping Power armor without setting it as a quest item and without attaching a script. The way I'm trying to get this to work right now is when the player is in the pipboy menu it iterates over there inventory and compares it to what was in there inventory to what is now in there inventory to detect when the player drops an item. Then I get refs in cell that are apparel items and then compares all of the items that have the same base id and then adds the closest item back to the players inventory. This is alot of foreach loops. My computer can handle it no sweat but I'm worried that other people might have frame rate drops. Is there a better way to do this? Edited September 23, 2020 by orkel1215 Link to comment Share on other sites More sharing options...
dubiousintent Posted September 23, 2020 Share Posted September 23, 2020 (edited) Have you considered using a "token" (unplayable, invisible, weightless piece of "armor")? Add the token to the inventory when equipping the PA, and only remove it when the PA is "properly" unequipped. Then just check for the token in the inventory. -Dubious- Edited September 23, 2020 by dubiousintent Link to comment Share on other sites More sharing options...
UnvalidUserName Posted September 23, 2020 Share Posted September 23, 2020 Try with an OnDrop Event Handler Link to comment Share on other sites More sharing options...
orkel1215 Posted September 23, 2020 Author Share Posted September 23, 2020 Try with an OnDrop Event HandlerIf you mean the ondrop block in a script attached to the price of armor, then yes I have but it would require attaching that script to every price of PA, witch would require patches with mods as well as touching every PA in the game. But if you mean a event that I can register a UDF with then I haven't been able to find any information on it. Link to comment Share on other sites More sharing options...
UnvalidUserName Posted September 23, 2020 Share Posted September 23, 2020 I mean an Event Handler. A feature from NVSE that allows you to have a UDF fire when a defined event is detected to happen. It does not involve scripting directly any of the reference involved. Look up Event Handling in the wiki and you should find a reference on how to use them the events you can detect. Link to comment Share on other sites More sharing options...
orkel1215 Posted September 23, 2020 Author Share Posted September 23, 2020 Have you considered using a "token" (unplayable, invisible, weightless piece of "armor")? Add the token to the inventory when equipping the PA, and only remove it when the PA is "properly" unequipped. Then just check for the token in the inventory. -Dubious-I never thought about that. I would like for the player to unequip normally but be unable to drop the PA. Can you go into a little more detail on how I would prevent the player from dropping the item? Link to comment Share on other sites More sharing options...
orkel1215 Posted September 23, 2020 Author Share Posted September 23, 2020 I mean an Event Handler. A feature from NVSE that allows you to have a UDF fire when a defined event is detected to happen. It does not involve scripting directly any of the reference involved. Look up Event Handling in the wiki and you should find a reference on how to use them the events you can detect.Wow I guess I was looking at the JIP events. I believe this is what I needed thank you. I'll test it out and I'll let you know if it worked. Link to comment Share on other sites More sharing options...
dubiousintent Posted September 23, 2020 Share Posted September 23, 2020 It has probably become obvious by now, but just in case: UnvalidUserName and I are talking about the same combination of techniques. The OnDrop EventHandler is where, when the ref object was your PA, you would check for the presence of the PAtoken and return without doing anything if it was still present in the Inventory. Only if the PAtoken was absent would you then proceed to drop the PA. Other objects would be handled as normal. Similarly you could use the OnEquip EventHandler to add the PAtoken. But from what you have said so far, have you considered how you intend to permit the player to eventually remove the PA at some point if not by unequipping? You need some mechanism to remove the PAtoken. Unless you intend to make the PA a "cursed" item that can never be removed. -Dubious- Link to comment Share on other sites More sharing options...
orkel1215 Posted September 23, 2020 Author Share Posted September 23, 2020 (edited) It has probably become obvious by now, but just in case: UnvalidUserName and I are talking about the same combination of techniques. The OnDrop EventHandler is where, when the ref object was your PA, you would check for the presence of the PAtoken and return without doing anything if it was still present in the Inventory. Only if the PAtoken was absent would you then proceed to drop the PA. Other objects would be handled as normal. Similarly you could use the OnEquip EventHandler to add the PAtoken. But from what you have said so far, have you considered how you intend to permit the player to eventually remove the PA at some point if not by unequipping? You need some mechanism to remove the PAtoken. Unless you intend to make the PA a "cursed" item that can never be removed. -Dubious-Yeah basically I'm making an updated version of immersive power armor. So the player can not actually drop the power armor. Now that I know that this is available (I completely overlooked the script extenders event handlers) I just want to drop the PA in a different way. Thank you for clarifying. Edited September 23, 2020 by orkel1215 Link to comment Share on other sites More sharing options...
orkel1215 Posted September 24, 2020 Author Share Posted September 24, 2020 It I mean an Event Handler. A feature from NVSE that allows you to have a UDF fire when a defined event is detected to happen. It does not involve scripting directly any of the reference involved. Look up Event Handling in the wiki and you should find a reference on how to use them the events you can detect.Wow I guess I was looking at the JIP events. I believe this is what I needed thank you. I'll test it out and I'll let you know if it worked. It worked perfectly. Thank you for pointing out the obvious. (Seriously I don't know how I missed this.) Link to comment Share on other sites More sharing options...
Recommended Posts