//:://///////////////////////////////////////////// //:: Name: pv_get_backpacks //::////////////////////////////////////////////// /* Checks the player's inventory for merchant backpacks and stores them as local objects */ //::////////////////////////////////////////////// #include "pv_utils" int StartingConditional() { object oNPCMerchant = OBJECT_SELF; object oPC = GetLocalObject(oNPCMerchant, "PV_MERCHANT_OWNER"); object oItem = GetFirstItemInInventory(oPC); int nBackpackCount = 0; // Delete possible backpack info so that there isn't any conflict if one was removed // from the previous set. for (nBackpackCount = 0; nBackpackCount < MAX_BACKPACKS_PER_INVENTORY; nBackpackCount++) { DeleteLocalObject(oNPCMerchant, "PV_BACKPACK_NUM_"+IntToString(nBackpackCount)); } nBackpackCount = 0; while (GetIsObjectValid(oItem) && nBackpackCount < MAX_BACKPACKS_PER_INVENTORY) { if ( ( GetTag(oItem) == "merc_backpack" ) && ( GetIsObjectValid(GetFirstItemInInventory(oItem) ) ) /* Only include backpacks that have at least one item*/ ) { SetLocalObject(oNPCMerchant, "PV_BACKPACK_NUM_"+IntToString(nBackpackCount), oItem); nBackpackCount++; } oItem = GetNextItemInInventory(oPC); } if (nBackpackCount > 0) { return TRUE; } return FALSE; }