Skip to content

Change Inventory

Change Inventory

Adds or removes items or equipment from the party's inventory.

Properties

System

Name Explanation Type
Ignore Constraints When enabled, inventory constraints such as maximum stack size or carry limits are bypassed. Toggle
Instance When enabled, each item added to the inventory is treated as a unique instance with its own identity. Toggle
Inventory Slot When enabled, the command targets an inventory slot by its unique ID rather than an item or equipment by database index. Toggle
Item When enabled, the command targets an item from the items database. Toggle
Item Index The database index or unique ID of the item or equipment to modify. Variable or Value
Quantity The amount to add or remove. Positive values add to the inventory and negative values remove from the inventory. Variable or Value
Result The variable to store the number of items actually added or removed. Variable or Value
Store Results When enabled, the number of items actually added or removed is stored in a variable. Toggle

Examples

Add 3 of Item 5 to the Inventory

This adds 3 of item index 5 to the party's inventory.

change_inventory(5, 3, item);
{"Data":{"IgnoreConstraints":false,"Instance":false,"IsInventorySlot":false,"IsItem":true,"ItemIndex":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"5","VariableIndex":0,"Metadata":null},"ItemQuantity":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"3","VariableIndex":0,"Metadata":null},"Result":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"StoreResults":false,"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.Inventory.ChangeInventoryCommand"}

Remove 1 Equipment at Index from Global Variable 2 and Store the Result

This removes 1 of the equipment at the index stored in Global Variable 2, ignoring constraints, and stores how many were actually removed in Global Variable 0.

$gv[0] = change_inventory($gv[2], -1, equipment, ignore_constraints);
{"Data":{"IgnoreConstraints":true,"Instance":false,"IsInventorySlot":false,"IsItem":false,"ItemIndex":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":2,"Metadata":null},"ItemQuantity":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"-1","VariableIndex":0,"Metadata":null},"Result":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"StoreResults":true,"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.Inventory.ChangeInventoryCommand"}

Add 1 Instanced Item 0 to an Inventory Slot

This adds 1 of item 0 to the inventory as a unique instance targeting an inventory slot.

change_inventory(0, 1, inventory_slot, instance);
{"Data":{"IgnoreConstraints":false,"Instance":true,"IsInventorySlot":true,"IsItem":false,"ItemIndex":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null},"ItemQuantity":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"1","VariableIndex":0,"Metadata":null},"Result":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"StoreResults":false,"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.Inventory.ChangeInventoryCommand"}