random

  1. W

    Choosing a random value from an enum

    How do I do it? I'm trying to pick a random value from an enum for an object at the creation of that object. Do I have to set that enum's value in the create event (to zero) and then make it random in a step event? Or can I set that random value right away in the create event. And, what...
  2. Daniel Mallett

    GMS 2.3+ Random bugs worth keeping

    This is just a point of interest I don't need help as such. Has anyone, or is it normal to find a bug in your game but keep it anyway because it has an unusual effect that actually enhances the game? Minecraft is an example (The farlands). So I guess my question is has this ever happened to...
  3. rainydaypictures

    Trying to generate phrase inside grid at random

    I'm new to game dev and it's my first time posting in this forum. I'm halfway through the trial period and about 40 hours deep into tutorials, free and purchased, and some playing around. Granted, this is a very short time. I'm just trying to figure out what GMS is capable of. I have a series of...
  4. Fluury

    GMS 2 Bizarre performance decreasing, random-number related Issue

    I had posted a thread earlier about my issues, but unfortunately to no avail. Given there was a lot of information to write, I just put it in a video. The gist is that as it appears, in some context, using random number generation just seems to cause some internal, permanent (until you close...
  5. yvodlyn

    SOLVED Random Room switching

    Hello everyone, I would like to simplify this code. What I want to do is change rooms randomly and the next room is not the same as the current room. Here my code: if (point_distance(o_player.x,o_player.y,o_portail.x,o_portail.y) < 8){ if (room == rm_player_1){...
  6. Nathan

    GMS 2 Randomize position by multiples of 24

    I have a very simple spawning object which randomly spawns an object every 2 seconds. What I would like it to do the spawner creates the objects in the same y position of the spawner, but the x position I want to be randomized multiples of 24 (ie. x, x+24, x+48, x+72, x, x-24, x-48, x-72 etc)...
  7. sinigrimi

    GMS 2 How to call a random key from ds_map?

    How do I call a random key from a ds_map structure? or will i have to create ds_list? a bunch of variables are created in ds_list, if for example I have 300 keys? I tried to do something with this, but my head is not working as it should var arts = global.artefacts; var arts_size =...
  8. sinigrimi

    GMS 2 [SOLVED]Summon monsters in random but different places in rooms

    I am generating random room with monsters and I need them to not spawn on each other. It works but looks terribly big, can it be simplified? That's what I'm doing: Script-Code: randomize(); var x1 = 160 + random(room_width - 320); var y1 = 160 + random(room_height -...
  9. L

    how do I make a key follow the player without it randomly moving? Help!

    so I'm making a game that has keys in it and when thay follow you thay can get stuck and thay randomly move the key will move randomly when the player is standing still. the code: //move to the player if (instance_exists(obj_player)){ mp_potential_step(obj_player.x, obj_player.y, 10...
  10. noé cambou

    Random doesn't work

    Hi, When I use fonctions like random() or choose(), it's Always the same Numbers wich are given. For exemple, with random(3), the program will give me 2,41 for sure the first time. Then 2,89 the second time. And 0,76 ; 1,94 etc... So the random is not random ?! It's Strange… In conclusion, my...
  11. Wicked

    GML Randomly generating chest spawns with a randomly generated level

    Hi, i've posted before about needing help with this for another problem, but here I am again. I've made some progress with a bunch of things but am currently stumped with trying to place down chests in the grid of the level. It is based off of this tutorial, and this is the code that came with...
  12. Smenkare

    Creating from, picking random and adding to ds_map

    Let me explain my problem in this example. i have variables for each object objvar1 = 1 obj1disable = false objvar2 = 1 obj2disable = true objvar3 = 3 obj3disable = false objvar4 = 1 obj4disable = false one empty ds_map and i have 4 objects...
  13. NotTayyy

    GMS 2 How Do Seeds Work?

    Hi I Had an Idea to Have a Random number that is Set at the beginning of thegame and depending on what number was rolled you would get slight variations to the main game. But I Was wondering, How does Seeds work, Is the seed That I Export the Game With The Seed everyone Gets? Or is the Seed...
  14. Wile94

    Legacy GM Maze/Room/Level Generation and Loading Time

    Hi, I've recently coded a maze generator inside a ds_grid. Each cell has a string value like "0000" or "1010", etc. Each number represents a wall/exit (0/1) around that cell (left-right-up-down), having a total of 16 combinations. Then I run a script that seals most of the "one way exit" cells...
  15. M

    GML Assign new random variable

    Hello, i make a game for mobile devices and faced a problem. After the player hits cube with the same color, player should change its color to random. I am trying to do it with random_range, but it does not work, looks like gamemaker does not understand that i want to assign new variable through...
  16. E

    RESOLVED ..! how can we ensure that a random number is not selected again

    Create; global.roomno = irandom_range(1,4); global.rm_go = asset_get_index("q_room"+string(global.roomno)); Mouse Clicking; room_goto(global.rm_go); .. I'm organizing random rooms for quiz and I'd appreciate it if you help.
  17. B

    [Solved] create objects in predefined location in room checking collisions

    I need to create 25 block objects in a predefined space (within the view area), only random and checking collisions with other objects and only appearing in place free, but I can't. delimitations (area where the object needs to appear inside): x 32 --- x 640. y 64 --- y 960. P.s: the object in...
  18. giraffeman210

    Drag And Drop Random Enemy Movement For A Maze Game

    I am trying to make random enemy movement work for my maze game but can't find any tutorials on how to do it. I am trying to make it work so the enemies move in random directions but can not choose backwards or where there is a wall. Below is a response I had gotten but I don't know how to add...
  19. T

    GML (solved) select random Boolean only with the value of true

    I have four booleans, npc_canmove_up, npc_canmove_down, npc_canmove_left, ncp_canmove-right, in my npc object's variable definitions section. Then in my create event I started this self repeating alarm. //start another alarm alarm[0] = random_range(ncp_rotatetime_min,ncp_rotatetime_max)...
  20. K

    Change imagespeed of a random object

    I am currently working on a pizza delivery game, for which I want to create random delivery locations. I want it to choose a random house after I collide with the pizza restaurant (the player gets a pizza in its 'inventory'). Currently I have this: ///Change pizza count if (obj_player.pizzacount...
Top