Just because it works, does not mean it is the best way to handle it. There was a LOT of misundstanding of this functionality when it was first introduced years ago and a lot of working, but technically incorrect scripts went in the quest repo.
Best practice is to put it once at the end of the script. The %itemcount hash will have its contents modified by your prior logic and only ever needs called once to then summon the items still left in the hash onto the player's cursor.
All it takes is a bad logic loop without a return in it to have items never returned as noted by the OP.
|