Sign In Register

How can we help you today?

Start a new topic

Get Challenge Instances on Cloud Code

What is the equivalent of "FindChallengeRequest", when we need to reach challenge collection? PlayerChallenges is always empty. How will I get it?


var challengeCollection = Spark.metaCollection("challengeInstance");

var currPlayer = Spark.getPlayer().getPlayerId();

var playerChallenges = challengeCollection.find(

    {

        "state":"COMPLETE",

        "accepted" : {$in : [currPlayer]} 

    }

);


1 person has this question

Hi Seclan,


We have a system event for getting challenges in a particular state, it is called a ListChallengeRequest, you can read more about it here. If you have any more questions just let me know.


Thanks,

Liam

What if there is no contextual player? I'm trying to make an admin screen (read: in the portal) that shows all the challenges and some state about them.

Login to post a comment