Skye Posted March 31, 2019 Share Posted March 31, 2019 Is there an easier way to destroy items taken from player inventory via script than calling DestroyItem() for every single instance? The problem I have is the following: Let's say I want an NPC to accept a stack of items, for instance 10 sunstone gems. Doing that is simple enough by using TakePartyItemNum("MISC18",10). The issue here is that every single gem is taken individually and ends up occupying its own inventory slot (which is a problem in and of itself but whatever), meaning that if I call DestroyItem("MISC18") immediately after, it will only destroy one gemstone and the other 9 will still be occupying the slots. Is there a way to avoid having to call DestroyItem() ten times in a row? I know that one option would be to create an invisible creature, have it take the items and destroy itself, but I was just wandering if there's a better way. Quote Link to comment
Jarno Mikkola Posted March 31, 2019 Share Posted March 31, 2019 (edited) I don't know... but presumably the area script could take the items... which then, won't have them left anywhere. Which is why the smiths and others like Thalantyr & Cespenar all have their own special small areas in the game. Edited April 1, 2019 by Jarno Mikkola Quote Link to comment
Skye Posted April 1, 2019 Author Share Posted April 1, 2019 Hrm, I haven't actually tried that. I've never seen any of the smiths do that either. As far as I know, they all take and destroy your items via conversation actions. I'll take it under consideration. It would certainly make my dialog files cleaner, although maintenance becomes a bit more of a chore with split files. Quote Link to comment
Skye Posted April 1, 2019 Author Share Posted April 1, 2019 Firing the actions from an area script does seem to work well enough. I did encounter one issue, however. When I use the trigger NumItemsPartyGT() from an area script, it doesn't seem to be able to detect items from bags, whereas the same trigger has no issue when used in a conversation. Since there's obviously a delay between ending a conversation and triggering the area script, I need this check to work if I want to avoid shenanigans from players. Any ideas? Quote Link to comment
Jarno Mikkola Posted April 1, 2019 Share Posted April 1, 2019 Use the dialog to detect the items and then gives a go to have the option to give the items to the NPC, that then fires an area scripts action via a THEN SetGlobal(customthing,GLOBAL,1) END ..with ends in a closure of the action, say like: IF Global(customthing,GLOBAL,1) THEN RESPONSE #100 //Takealltheitems SetGlobal(customthing,GLOBAL,2) END Extended to the top to the area script. It fires about 15 times a second, so the dialog exit should distract the player enough for them not to be able to remove the items before they are gone. Quote Link to comment
Skye Posted April 2, 2019 Author Share Posted April 2, 2019 Yeah, that's exactly what I did. And the first thing I tried after testing it was if I could pause the game and drop the items before the script fires and I had no trouble doing so. The disconnect between the two events isn't really something I'm comfortable with. It should be just fine in practice, but the perfectionist in me is struggling really hard with introducing an obvious exploit into the mod. Also the fact that the same triggers from the area script and the dialog file work differently is entirely mind-boggling to me. It's always one step forward, two steps back... Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.