question

subbakerlo avatar image
subbakerlo asked

How can I use actions with "character_inventory_item_added"?

Hello,

I tried to use a rule that should support me in changing the custom data of an Item Instance, whenever an item is granted to a character.

Playfab lists "character_inventory_item_added" as one of the events to fire an action like custom cloud script but I am not able to add it as an event. I tried with "custom." and "title.[MY_TITLE_ID]." as prefixes but without success.

The event is fired in the playstream but I cannot utilize it. How can I make this work?

Thanks in advance.

Best

entitiesCharacter DataCharactersPlayStream
10 |1200

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

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

To be clear, using actions with "character_inventory_item_added" is not supported. But as a workaround, you can create a custom event to do that. First, you can call Server/GrantItemsToCharacter to grant items to a character and get the InstanceId in its response. Then you can call WriteCharacterEvent and pass the InstanceId to trigger the custom event. The CloudScript/AzureFunction you set in the Rule can get the InstanceId and then modify the custom data with it.

For more information, please refer to https://docs.microsoft.com/en-us/gaming/playfab/features/automation/actions-rules/using-cloudscript-actions-with-playstream#the-context-input-parameter

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.