question

DRAKE avatar image
DRAKE asked

Rule with player_inventory_item_added

I want to add player tag "ad_free" when player get "ad.free" item.

So I created a rule with player_inventory_item_added.

handlers.AddTag = function (args, context) {
    try {
        server.AddPlayerTag({
            PlayFabId: currentPlayerId,
            TagName: args.tag
        });
        log.debug("add tag : " + args.tag);
    } catch (error) {
        log.error(JSON.stringify(error));
        return null;
    }
}

I added a "ad.free" item to player.

I only got a "Player inventory item added" event.

And I purchased this item with virtual currency, got same result.

There is no add tag event, [add tag] result.(GetPlayerTags show none tag)

I tried adding the conditions.[or entity.id is not ""] and many other things.

But I still couldn't get playstream event, [add tag] result.

Rule with player_inventory_item_added is working?

apisPlayer Inventory
rule.png (53.4 KiB)
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

DRAKE avatar image DRAKE commented ·

Tried with null conodition, to check ItemId in context.playStreamEvent.

This also didn't call cloud script function.

Cloud script works fine. Just didn't called.

0 Likes 0 ·
DRAKE avatar image DRAKE DRAKE commented ·

conodition->condition

0 Likes 0 ·

1 Answer

·
Ivan Cai avatar image
Ivan Cai answered

In your case, the event type should be chosen to playstream event "com.playfab.player_inventory_item_added ", please modify Ad Free Add rule as follows:


forum1.png (39.2 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.