How do you know, in script, if an inventory item is marked PlayerStartsWithItem?

Started by bx83, Wed 12/05/2021 01:13:16

Previous topic - Next topic

bx83

I'm trying to add/remove ONLY items that a player starts with, however InvWindow, Inventory, Game, player.Inventory* etc. doesn't contain a function to check for this, or a property.
How do I do the following (pseudocode):

Code: ags
//add all 'starts game with' items back to empty inventory
for (int x=1; x<=Game.InventoryItemCount; x++) {
  if (player.InventoryItemStartsWith[x])
    player.InventoryQuantity=1;   
}

Crimson Wizard

There's no way to do this as far as I know, but you may remember which items are in inventory at startup.

Code: ags

int startingItems[MAX_INV];

function game_start()
{
    for (int i = 0; i < Game.InventoryItemCount; i++) {
        startingItems[i] = player.InventoryQuantity[i];
    }
}


Then you simply copy startingItems to player.InventoryQuantity backwards.

SMF spam blocked by CleanTalk