Skip to main content
removed the tag from the title, made it a question.
Link
Vaillancourt
  • 16.4k
  • 17
  • 56
  • 61

Game maker studio 2 -- Randomly Why are the randomly generated numbers are not random?

fixed some minor typos, removed tags that aren't relevant to the question
Source Link
Pikalek
  • 13.4k
  • 5
  • 49
  • 54

I'm trying to make a game where the damage you deal is rolled by a dice. itIt all works. However, it keeps on giving the same values in a row so it isn't entirely random

ini_open("Health.ini");
attack = ini_read_real( "Attacks", "Felix", 0);
ini_close();
global.damage=0
repeat(attack){
global.damage=irandom(6)
}


if (global.damage ==0){instance_create_depth(300, 400, 0, obj_numbers0)}
if (global.damage ==1){instance_create_depth(400, 400, 0, obj_numbers1)}
if (global.damage ==2){instance_create_depth(500, 400, 0, obj_numbers2)}
if (global.damage ==3){instance_create_depth(600, 400, 0, obj_numbers3)}
if (global.damage ==4){instance_create_depth(700, 400, 0, obj_numbers4)}
if (global.damage ==5){instance_create_depth(800, 400, 0, obj_numbers5)}
if (global.damage ==6){instance_create_depth(900, 400, 0, obj_numbers6)}

theThe attack value is 1 because it is only one dice that is used for damage for now. theThe software iI am using is game maker studioGame Maker Studio 2

I'm trying to make a game where the damage you deal is rolled by a dice. it all works. However, it keeps on giving the same values in a row so it isn't entirely random

ini_open("Health.ini");
attack = ini_read_real( "Attacks", "Felix", 0);
ini_close();
global.damage=0
repeat(attack){
global.damage=irandom(6)
}


if (global.damage ==0){instance_create_depth(300, 400, 0, obj_numbers0)}
if (global.damage ==1){instance_create_depth(400, 400, 0, obj_numbers1)}
if (global.damage ==2){instance_create_depth(500, 400, 0, obj_numbers2)}
if (global.damage ==3){instance_create_depth(600, 400, 0, obj_numbers3)}
if (global.damage ==4){instance_create_depth(700, 400, 0, obj_numbers4)}
if (global.damage ==5){instance_create_depth(800, 400, 0, obj_numbers5)}
if (global.damage ==6){instance_create_depth(900, 400, 0, obj_numbers6)}

the attack value is 1 because it is only one dice that is used for damage for now. the software i am using is game maker studio 2

I'm trying to make a game where the damage you deal is rolled by a dice. It all works. However, it keeps on giving the same values in a row so it isn't entirely random

ini_open("Health.ini");
attack = ini_read_real( "Attacks", "Felix", 0);
ini_close();
global.damage=0
repeat(attack){
global.damage=irandom(6)
}


if (global.damage ==0){instance_create_depth(300, 400, 0, obj_numbers0)}
if (global.damage ==1){instance_create_depth(400, 400, 0, obj_numbers1)}
if (global.damage ==2){instance_create_depth(500, 400, 0, obj_numbers2)}
if (global.damage ==3){instance_create_depth(600, 400, 0, obj_numbers3)}
if (global.damage ==4){instance_create_depth(700, 400, 0, obj_numbers4)}
if (global.damage ==5){instance_create_depth(800, 400, 0, obj_numbers5)}
if (global.damage ==6){instance_create_depth(900, 400, 0, obj_numbers6)}

The attack value is 1 because it is only one dice that is used for damage for now. The software I am using is Game Maker Studio 2

Source Link
S L
  • 21
  • 2

Game maker studio 2 -- Randomly generated numbers are not random

I'm trying to make a game where the damage you deal is rolled by a dice. it all works. However, it keeps on giving the same values in a row so it isn't entirely random

ini_open("Health.ini");
attack = ini_read_real( "Attacks", "Felix", 0);
ini_close();
global.damage=0
repeat(attack){
global.damage=irandom(6)
}


if (global.damage ==0){instance_create_depth(300, 400, 0, obj_numbers0)}
if (global.damage ==1){instance_create_depth(400, 400, 0, obj_numbers1)}
if (global.damage ==2){instance_create_depth(500, 400, 0, obj_numbers2)}
if (global.damage ==3){instance_create_depth(600, 400, 0, obj_numbers3)}
if (global.damage ==4){instance_create_depth(700, 400, 0, obj_numbers4)}
if (global.damage ==5){instance_create_depth(800, 400, 0, obj_numbers5)}
if (global.damage ==6){instance_create_depth(900, 400, 0, obj_numbers6)}

the attack value is 1 because it is only one dice that is used for damage for now. the software i am using is game maker studio 2