corrado33 Posted September 12, 2018 Share Posted September 12, 2018 (edited) Say I put the following script on a chest. event onActivate(objectReference akActivator) int mannItems = self.GetNumItems() int counter = 0 debug.notification("TotalItems: " + mannItems) while (counter < mannItems) self.removeitem(self.GetNthForm(counter),1,TRUE,game.getplayer()) counter += 1 endwhile endEvent It will transfer everything in a chest to the player. It works great. But... it won't let me then transfer the items BACK to the chest. It's like it continues to run forever. If I try to put something that's been transferred to me BACK into the chest, it'll just give it right back to me. How cant I make it... not do this? EDIT: Geeze programmer's curse strikes again. As soon as I ask for help I figure it out. change counter += 1 to mannItems -= 1 Edited September 12, 2018 by corrado33 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 12, 2018 Share Posted September 12, 2018 (edited) Why loop through each item individually? Just use RemoveAllItems() and transfer everything in the container to the player. EDIT: added link Edited September 12, 2018 by IsharaMeradin Link to comment Share on other sites More sharing options...
corrado33 Posted September 12, 2018 Author Share Posted September 12, 2018 Say I put the following script on a chest. event onActivate(objectReference akActivator) int mannItems = self.GetNumItems() int counter = 0 debug.notification("TotalItems: " + mannItems) while (counter < mannItems) self.removeitem(self.GetNthForm(counter),1,TRUE,game.getplayer()) counter += 1 endwhile endEvent It will transfer everything in a chest to the player. It works great. But... it won't let me then transfer the items BACK to the chest. It's like it continues to run forever. If I try to put something that's been transferred to me BACK into the chest, it'll just give it right back to me. How cant I make it... not do this? EDIT: Geeze programmer's curse strikes again. As soon as I ask for help I figure it out. change counter += 1 to mannItems -= 1Ah, I didn't know such a command existed. That's the downside to just discovering this language. :) Thanks! Link to comment Share on other sites More sharing options...
JonathanOstrus Posted September 13, 2018 Share Posted September 13, 2018 Ah, I didn't know such a command existed. That's the downside to just discovering this language. :smile: Thanks! If you haven't already you might check out https://www.creationkit.com/index.php?title=Category:PapyrusAs boring as it's going to be it's worth at least browsing through the list of all the different functions to know what's out there. You don't necessarily need to understand what they all do immediately. But later having seen the names, it may prove useful to remember that something might exist to do what you want. Link to comment Share on other sites More sharing options...
corrado33 Posted September 13, 2018 Author Share Posted September 13, 2018 Ah, I didn't know such a command existed. That's the downside to just discovering this language. :smile: Thanks! If you haven't already you might check out https://www.creationkit.com/index.php?title=Category:PapyrusAs boring as it's going to be it's worth at least browsing through the list of all the different functions to know what's out there. You don't necessarily need to understand what they all do immediately. But later having seen the names, it may prove useful to remember that something might exist to do what you want. Ah! I had been to that specific site but was unaware that it listed all available commands. I thought you had to go into each individual... part (like object reference) It's perfect! Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts