Set VAR_RESULT to the number of removed items from removeallitem per https://github.com/rh-hideout/pokeemerald-expansion/pull/5177\#issuecomment-2294980531

This commit is contained in:
pkmnsnfrn 2024-09-12 05:47:12 -07:00
parent f87440a25a
commit 979c9994f7
3 changed files with 4 additions and 2 deletions

BIN
.swo

Binary file not shown.

View file

@ -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

View file

@ -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);
}