Sign In Register

How can we help you today?

Start a new topic

Withdraw Challenge

Hello,


We have a turn based challenge for two in our game. The challenge consists of 3 turns. Each turn the two players submit score. At the end of the 3 turns the player with the highest score wins, there is a leaderboard for the challenge, and it determines the winner. We want to add a withdrawal option to the game. So who withdraws from the game will be the loser. I have implemented a log event script in cloud code as below :


var challenge = Spark.getChallenge(Spark.data.challenge_id);


var accepted = challenge.getAcceptedPlayerIds();


for(i = 0 ;i<accepted.length; i++){

    if(accepted[i] != Spark.getPlayer().getPlayerId()){

        var player = Spark.loadPlayer(accepted[i]);

        challenge.winChallenge(player);

    }

}


However, when a player withdraws from the challenge, opponent does not win the game. Instead always the player with the highest score wins game even the script says the other way. 


How can we make the withdraw for the challenge?

1 Comment

Hi Seclan,


We are looking into this in the ticket you currently have open, awaiting your response there.


Thanks,

Liam

Login to post a comment