Can someone please tell me in code below about how to make only a certain amount items be in one stack instead 64 items in one stack.
Not easy possible. You'd have to listen for all Inventory events (pickup, move, ...) and set the amount yourself, drop the rest away if inventory is full, so that they don'g get pickuped.