Here my script attached to the shop guizmo :
class ShopScript extends hz.Component<typeof ShopScript> {
static propsDefinition = {};
start() {
this.connectCodeBlockEvent(this.entity, CodeBlockEvents.OnItemConsumeComplete, (player, item, success) => {
if (success) {
console.log(`${player.name.get()} successfully consumed the item: ${item}`);
if(item === "+1_knockback_multiplier_2dfd2123")
{
// Ajouter +1 knockback multiplier
const knockbackMultiplier = this.world.persistentStorage.getPlayerVariable(player, PersistentVariables_Data.playerPersistentVariables.number.knockbackMultiplier);
this.world.persistentStorage.setPlayerVariable(player, PersistentVariables_Data.playerPersistentVariables.number.knockbackMultiplier, knockbackMultiplier + 1);
console.log(`Increased knockback multiplier for ${player.name.get()} to ${knockbackMultiplier + 1}`);
}else if(item === "+1_recoil_multiplier_0ec76b29")
{
// Ajouter +1 recoil multiplier
const recoilMultiplier = this.world.persistentStorage.getPlayerVariable(player, PersistentVariables_Data.playerPersistentVariables.number.recoilMultiplier);
this.world.persistentStorage.setPlayerVariable(player, PersistentVariables_Data.playerPersistentVariables.number.recoilMultiplier, recoilMultiplier + 1);
console.log(`Increased recoil multiplier for ${player.name.get()} to ${recoilMultiplier + 1}`);
}else if(item === "+1_resistance_multiplier_6517be99"){
// Ajouter +1 resistance multiplier
const resistanceMultiplier = this.world.persistentStorage.getPlayerVariable(player, PersistentVariables_Data.playerPersistentVariables.number.resistanceMultiplier);
this.world.persistentStorage.setPlayerVariable(player, PersistentVariables_Data.playerPersistentVariables.number.resistanceMultiplier, resistanceMultiplier + 1);
console.log(`Increased resistance multiplier for ${player.name.get()} to ${resistanceMultiplier + 1}`);
}
}
});
}
}
All items are set to auto-consume. It seems to work fine when purchasing with meta-credits, as the console output and PPV are updated. However, when purchasing with Flouz, there is no console output and the PPV does not update.