You'll want to learn arrays - they're tricky at first, but the gateway to much more powerful stuff! And they're a lot simpler than you think - an array is essentially a basic spreadsheet (Imagine the 'Z' axis as being 'Sheets' on the spreadsheet).
Back to your problem: you you could try
on [player] collision with [enemy]
for each [item]
where [item] is overlapping [inventorybox]
drop items (however that works)
That should identify your items one-by-one for you, and make it easy to create the necessary logic to create the dropped items on the floor.