Hooks.on("createItem", async (item) => { // Specify the source ID of the item you want to update const targetSourceId = "Compendium.pf2e.equipment-srd.Item.5Ew82vBF9YfaiY9f"; // Replace with the actual source ID of the item // Check if the created item's sourceId matches the target sourceId if (item.sourceId !== targetSourceId) return; // Define the updated data const updatedData = { system: { description: { value: "This is a credit, a digital currency originaly created by the mysterious Grenth Moro. Starting as a decentrilized cryptographic currency, it eventually grew to be used by every world in the outer rim systems.", }, bulk: { value: 0, }, }, name: "Credits", img: "modules/sf2e-silver-to-credits/icons/equipment/treasure/currency/credits.webp", }; // Update the item await item.update(updatedData); console.log(`Updated item with sourceId "${item.sourceId}" upon creation.`); });