Sign In Register

How can we help you today?

Start a new topic
Answered

Discarding invalid turn in MultiPlayer turn based game

Hi

I am making a multiplayer turn based game. In this I have created a challenge and added an event (turnEvent) . In this every player perform turnEvent on each turn.(I have added an script to the turnEvent in challenge events under cloud code). But sometime it may happen that the turn taken by a player is invalid .

Suppose there are 2 players and player1 makes an invalid move, the script associated with turnEvent will be executed and thus i can know that the turn was invalid. Now I want that the turn should not be counted and the next chance should be again of player 1 and not of player 2.


Thanks 

Shubham



Best Answer

Hi Shubham


If you call Spark.setScriptError in your request script, the request will be rejected and not processed by the platform. This will stop the request taking a turn for the player,


Does that make sense?


Gabriel


Answer

Hi Shubham


If you call Spark.setScriptError in your request script, the request will be rejected and not processed by the platform. This will stop the request taking a turn for the player,


Does that make sense?


Gabriel

Hi Gabriel ,

I will try this . But I think this will do the trick.

Thanks for the reply

Shubham

Login to post a comment