Discarding invalid turn in MultiPlayer turn based game
S
Shubham Dhabhai
started a topic
over 6 years ago
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
T
Tech Support
said
over 6 years ago
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,
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
S
Shubham Dhabhai
said
over 6 years ago
Hi Gabriel ,
I will try this . But I think this will do the trick.
Shubham Dhabhai
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
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
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstTech Support
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
Shubham Dhabhai
Hi Gabriel ,
I will try this . But I think this will do the trick.
Thanks for the reply
Shubham
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2486 topics