question

Alexander Tsangaris avatar image
Alexander Tsangaris asked

How do you add or subtract statistics values through cloud script?

I'm trying to figure out how to add 10 exp every time I call a cloud script function. I know I can just get the player statistics and then add to the value given. But I was looking for a shortcut around it by just adding + 10 to everytime I call the funcrion.

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

·
brendan avatar image
brendan answered

The simplest thing would be to set the statistic's aggregation type to Sum, so that anything you submit via the update stat call gets added to the player's current value.

But can you describe in more detail what the gameplay is you're trying to enable? How often does the player need to update this stat?

8 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.

Alexander Tsangaris avatar image Alexander Tsangaris commented ·

I want everytime someone gets a kill in the match it calls a function that adds + 1 kill to the current kill and +10 exp to the exp earned statistic.

0 Likes 0 ·
brendan avatar image brendan Alexander Tsangaris commented ·

And how often can that occur? If this is something that can happen frequently (more than a few times a minute), it would be a better idea to aggregate that, and submit the update for the total at the end of the session.

0 Likes 0 ·
Alexander Tsangaris avatar image Alexander Tsangaris brendan commented ·

It will be called at least every min or more (100 times per match). I was going to use a statistic called exp earned and zero it at the end of every match. But before I zero it add the exp to the overall exp.

0 Likes 0 ·
Show more comments
Show more comments

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.