From b4d5b38996081fffee92782f930f9472e5800067 Mon Sep 17 00:00:00 2001 From: reloecc Date: Sat, 23 Mar 2024 23:41:20 +0100 Subject: [PATCH] Fixed CreateStackArrayInContainer so it doesn't return error if there is none. --- scripts/include/std.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/include/std.inc b/scripts/include/std.inc index 763ad5408..579e7cb5d 100644 --- a/scripts/include/std.inc +++ b/scripts/include/std.inc @@ -45,7 +45,10 @@ function CreateStackArrayInContainer (container, objtype, amount, limit_per_stac for loops := 1 to (amount/limit_per_stack) result.append(CreateItemInContainer(container, objtype, limit_per_stack)); endfor - result.append(CreateItemInContainer(container, objtype, amount-(amount/limit_per_stack)*limit_per_stack)); + var remainder := amount-(amount/limit_per_stack)*limit_per_stack; + if (remainder > 0) + result.append(CreateItemInContainer(container, objtype, remainder)); + endif return result; endfunction