diff --git a/.swo b/.swo deleted file mode 100644 index dac3526901..0000000000 Binary files a/.swo and /dev/null differ diff --git a/asm/macros/event.inc b/asm/macros/event.inc index a4057b22db..dff3faf83a 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -2339,7 +2339,7 @@ callnative ScriptHideItemDescription .endm - @ Remove all of specified item from the player's bag + @ Remove all of specified item from the player's bag and return the number of removed items to VAR_RESULT .macro removeallitem itemId:req callnative RemoveAllItem .2byte \itemId diff --git a/src/scrcmd.c b/src/scrcmd.c index 12ec041895..7062721a94 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -2477,5 +2477,7 @@ void ScriptSetDoubleBattleFlag(struct ScriptContext *ctx) void RemoveAllItem(struct ScriptContext *ctx) { u32 itemId = VarGet(ScriptReadHalfword(ctx)); - RemoveBagItem(itemId, CountTotalItemQuantityInBag(itemId)); + u32 count = CountTotalItemQuantityInBag(itemId); + gSpecialVar_Result = count; + RemoveBagItem(itemId, count); }