array

  1. S

    GML Power Up that affects all weapons in inventory(array).

    I am trying to code a pickup that will affect all weapons in inventory. For example; all obtained weapons gain a decrease in cooldown for 10 seconds. I currently have a weapon creation script that uses an array for player weapon inventory and can adjust attributes from there. I was thinking the...
  2. J

    GameMaker Array Draw - Column / Row Adjustments (HELP)

    I'm lacking the math ability to figure out this problem. I'm trying to draw an array in the form of columns. (4 entries per column.) // DRAW EVENT var test = [4, 0, 3, 1, 0, 5, 0, 3]; var rows = 4; // entries var columns = array_length(test) div rows; var space = 20; var pos = 0; for (var...
  3. G

    GameMaker Trouble with array being out of range for NPC

    I've been working on an NPC dialogue system for my game, and right now it works with every NPC except for one. In one of the cutscenes (one which worked for the longest time, but seemingly has been broken or bugged due to me updating Gamemaker) it continuously crashes due to a variable being out...
  4. M

    SOLVED Minimum Value in an array

    How can I find the smallest value in an array, without having to sort it/change its order? Can I use min? Thanks
  5. H

    GML Problem with arrays within place_meeting (possibly) causes everything to freeze

    I'm not incredibly experienced with GameMaker so I might write bits of code wrong, like what appears to have happened with place_meeting. I've posted about the problem before and got advice so I changed a large chunk of my code, but it doesn't seem to have worked - the game still freezes...
  6. H

    GameMaker Problem with Arrays within place_meeting

    I'm experiencing another problem with the project I've already posted on here about (and got some incredibly useful help for, thank you!!!). In the game I'm making, the player is moving into a haunted house. A ghost doesn't want them to so they're throwing furniture at them. Within a certain...
  7. David Lorenz

    GML Problem with Switch of a Variable that can be set to different Arrays

    Hello, everyone! I have an object that manages a series of Arrays. I use a Function to add points to one of the Arrays: function add_points(target_array_as_string,amount){ with obj_point_system { if completed != 1 { if target_as_string[1][1] = 0 { // If the target Array...
  8. folhaslol

    GameMaker Variable Index [0] out of range [0] appears even when everything is apparently fine in my 2d array

    Hi!, I have some problems related to arrays in a branching dialog system that I'm creating and even though I searched a lot I didn't find any answer as to why this is happening. my problem is: when I try to run my game, the game maker says it is out of range even though I have defined...
  9. M

    SOLVED Please help Variable Index [1] out of range [1]

    i'm trying to make a text box for my game folowing a Textbox tutorial game maker studio 2 from FriendlyCosmonaut, but i keep getting this error ;-; on obj text_box draw event draw_sprite(caixa_txt, 0, x,y); draw_set_font(p_caixa); draw_text_ext(x,y, text[page], caixaH, caixaW); create event...
  10. O

    GML Array Glitch

    var _n_way = _way; show_debug_message("n_way 1"+string(_n_way)); show_debug_message("way 1"+string(_way)); array_push(_n_way,_new); show_debug_message("n_way 2"+string(_n_way))...
  11. Risen

    Accessing global struct within a global array.

    Hi everyone, I'm trying to create a script for storing biome information on an array and I'm having issues calling it from another scope. the error seems to think that it is meant to be an object if I'm reading it correctly. here is the biome script: // initialise biome grid variables...
  12. V

    SOLVED Random array with no repeat values

    Hi, I want to create a random array with no repeated values. This is my code: for(var i=0;i<4;i+=1) { do { list[i]=irandom_range(1,4) } until !array_contains(list,list[i],0,3) } I tried doing this in Python in a very similar way and it...
  13. Daniel Mallett

    GameMaker Unavoidable feather messages

    I am trying to use the array_length() function to get the length of a 2D array. It works fine, no problem. The problem is I have not found any combination of things I can do to prevent a feather warning or error. menu_id = 0; menu_selection_id = 0; // MENU TEXT menu_text = []...
  14. E

    Trouble sorting an array string that contains spawn locations paired with a specific enemy.

    function scr_create_spawn_data(_enemy_name, _enemies_requested, _range_min, _range_max){ array_resize(spawn_coordinates, _enemies_requested); // resizes array to the amount of enemies requested. for (var i = 0; i < _enemies_requested; i++) { var enemy_pos =...
  15. FrostyCat

    Asset - Scripts GMSortBy: Easy array_sort comparer methods for GM 2022+

    GMSortBy Overview GMSortBy is a companion library for getting the most out of array_sort in an easy-to-read, semantic way. Sort arrays of arrays, structs, and instances by intuitive helpers with support for sorting by multiple criteria, not by opaque-looking custom inline methods. Downloads...
  16. Lepto

    SOLVED Find the 10 closest instances

    I want to find the 10 closest instance to the player. My first idea was to try and find all the instances, save their distance to the player in an array, sort that array, and pick the 10 closest enemies. However, I can see this getting quite taxing... Surely, there must be a better way. Please...
  17. JesusOnExtasy

    GameMaker Array or Struct or Constructor !? Wtf !? Help guy's!

    Thanks everyone for the clarification and help, here is my new database for noobs Lv.1 Ready :)
  18. Tmanpdx

    GameMaker How to access variables in a predicate / call_back function for a STRUCTURED array?

    I'm having a problem with using the array_filter function and it's predicate function. A simplified portion of my code is something like this: function create_fleet_panel(_p){ function _findfleet(element, index){ return element.PlanetName = _p.PlanetName; } var...
  19. Anders__oo__

    SOLVED How do I save an array that contains dsMaps?

    Hi I have a quest system that uses an array that contains ds_maps with variabls that will change over time and how do i save these to a file and reload them when I load my game. my array is global.QUEST with ds_maps example: //example //my array is global.QUEST with ds_maps...
  20. E

    SOLVED Hazard randomizer guidance/suggestions.

    I have numerous rooms with many hazards of different types: projectiles, fire, acid, blades, etc. I chose not to have a object controller place the hazards in the rooms because they're all specifically placed and it would be quite tedious to get the coordinates of each one for such an approach...
Top