Tengo scripts de Java para un juego, pero este juego es como una prueba y si el usuario no pasa el juego, volverá a realizar la prueba (rehacer el juego), pero quiero una cantidad específica de intentos solo para que el usuario vuelva a hacer la prueba. ahora lo que tengo, hace que el usuario comience desde el principio sin ninguna limitación, incluso si lo vuelve a hacer como 100 veces, seguirá volviendo al principio.
Necesito en el masaje fallido para dar otro intento (como un máximo de 4 intentos) si falla una vez, luego el siguiente masaje fallido para darle 3 intentos y luego 2 y luego el último, y luego no puede volver a hacer la prueba.
Guión 1;
var player=GetPlayer(); var textArray = []; for (var i = 1; i <= 15; i++) { textArray.push(i); }; var itemsLeft = textArray.length; textArray=textArray.map(String).toString(); player.SetVar("Text_Array", textArray); player.SetVar("Items_Left", itemsLeft);Guión 2:
//get the StoryLine player var player=GetPlayer(); //get Storyline variable value as a string var textArray=player.GetVar("Text_Array"); //Convert string to a numeric array numArray=textArray.split(",").map(Number); //Get a random number from the array and send it to StoryLine var randNum = numArray[Math.floor(Math.random() * numArray.length)]; player.SetVar("Random",randNum); //Remove the random number from your array and get the array's length numArray.splice(numArray.indexOf(randNum), 1); var itemsLeft=numArray.length; //Convert array to a string and send it back to SL along with the array's length textArray=numArray.map(String).toString(); player.SetVar("Items_Left", itemsLeft); player.SetVar("Text_Array", textArray);