1. flyinian

    SOLVED Assign object to variable or not to assign to variable?

    Would assigning an object that is used often to a variable of any kind be faster than referencing it's full name? I understand that each time the object is referenced somewhere, it has to be looked up first. If this is faster, would it be good practice to assign the object to a variable? If...
  2. otterZ

    SOLVED Does declaring many global variables at the start of a game slow loading time down?

    In the project I am working on I have around 200 global variables being declared and initialised in a Create event in the very first room (start up screen). As I add more content to the project I could end up with 1000+ global variables, so my question is this . . . Does declaring and...
  3. flyinian

    SOLVED Any simpler way of placing parent variables into children besides the copy & paste into each child?

    What the title says. Not talking about inheritance. That's already being done. I'm overriding the children variables. I'm looking for a simpler way of doing this instead of copy & pasting into each child. While avoiding variable definitions.
  4. flyinian

    SOLVED Could I just throw a script with the variables I need for an object in its create event and it'll work? Obviously?

    I'm currently using variable definitions but, it doesn't have the functionality that I'd like so, I'm looking for an alternate besides the obvious "write variable in create event per object". Any potential problems I may face doing this method? Thanks.
  5. flyinian

    SOLVED Need some eyes real quick

  6. S

    Variable doesn't seem to change even though I'm using "variable -= otherVariable"

    My code is supposed to draw a white rectangle and an orange rectangle on top. The white rectangle is supposed to get bigger in the y-direction when you hover over it, and go back to normal when you stop hovering over it. But when not hovering over the rectangles, the white rectangle doesn't seem...
  7. William Garrison

    GMS 2.3+ Variable not working?

    So simple enough. I am trying to make a parent asset that utilizes the in room variable for what object is being controlled and/or called. But the game doesn't seem to be recognizing it. So here is the setup... Inside the Step Event if (triggered = 1) { instance_create_layer(oHero.x+150...
  8. FoxyOfJungle

    SOLVED How to get many values from 3d array? (or multi?)

    Hello! First time trying to use 3D arrays, it may seem a little stupid but you learn by making mistakes. 😅 I have this situation: array[0][spr_sprite][2] = "Text 1"; // [index] [sprite] [sprite_subimage] = "Text"; array[1][spr_sprite][3] = "Text 2"; array[2][spr_sprite][4] = "Text 3"...
  9. Gigicom

    GMS 2 Use code in json file

    Hey, I‘m trying to figure out how to use pre-defined json files for some item data in my game. Before, I simply assigned all values to variables and assigned those to a ds_map like this: constantData =; name = „Apple“; graphic = spr_ItemApple; list = ds_list_create(); listVal =...
  10. paulog

    SOLVED Instances acting differently

    Hello! I'm making a game in GM1.4 but I'm facing some issues. I really hope somene can help me out. In the game some objects have to jump to another position if the player clicks a button. I made two variables, "global.rot" and "global.oldrot". They both have the value of 1 when the room...
  11. G

    Instance_nearest and Variables

    I'm making an Insaniquarium Spiritual successor in game maker studio 2 and I'm looking to have the Piranha seek out the nearest fish with a size equal to 1. it works fine until any of the fish no longer have a size of 1. if (instance_exists(Fish) && (Fish.size = 1) ){ Target =...
  12. flyinian

    SOLVED Is there a way to null a variable from being used?

    I am using the parenting system for my navigation system in my project. Some buttons will go to a room when clicked and others will create instances. If I use the below code with the buttons that don't go to a room, it will give an error. Is there a way to have a variable return a value to...
  13. flyinian

    SOLVED Assistance with code help

    I am trying to add randomization to my combat system and experimenting with different code styles. When I use "var enemy" or "totalcounttarget" directly to adjust the value of "Count 1", it doesn't work. If I use the "Count 1" directly, it works but, I lose the randomization for my combat...
  14. flyinian

    Assistance w/ adding a value per value.

    I have a time system in my game. Minutes, Days, months, years. What are ways that I could add a value(lets say 100) for every day that passes in game? I know I could go: if (day == 1 || day == 2 || ect.) { value += 1; }; That will only add 1 if day is equal to 1. Are there better ways of...
  15. S

    GML Use variables of one instance in another

    I've been looking for a more code-efficient way to pull instance variables from one instance to be used in another. My current code is this: Target = id; // Instance id of another object is passed here. var a; with (Target) { a = CharacterName; // Instance variable created in the create...
  16. flyinian

    (SOLVED)Total exp count not calculating correctly with large numbers.

    I am currently developing a leveling system. So far, everything seems to work fine besides the total exp which calculates how much exp is gained on achieved levels(exp gain isn't calculated for not achieved levels). The issue I am having is that the total exp(_SkillTotalExp) is calculated...
  17. josyanf1

    GMS 2 [SOLVED] Discover 'direction' with hspeed and vspeed positions

    Hello! I am trying to discover the direction variable having the hspeed and vspeed positions. Since if you use hspeed or vspeed the direction variable gives 0. I'm a little lost, can someone help me? :S Thanks in advance ^^
  18. pumblerak

    GML [Solved!] Finding a variable of an instance outside of the current room?

    Running GMS:2 Version Hello everyone! I've been on GM for a number of years now, and I've encountered a problem that I can hardly even begin to solve. I have an object named obj_musicmanager. obj_musicmanager fades the currently playing music between rooms, changes music as need be...
  19. FoxyOfJungle

    SOLVED Stop running a part of the step event?

    Hi, I'm making a Clock and in some part I need to "stop" executing a part of the code, note below, every dn_phase == "anything", I need to execute what is inside only once, because the "clock_bg_fade_alpha" needs to be at "1" only once. I've tried using boolean, but I couldn't do it efficiently...
  20. ChaoticNeutral

    Store statements in variables

    I have a statement stored within an array like this: choices = array_create(5, 0) choices[0] = event_perform(ev_other, ev_user0) choices[1] = event_perform(ev_other, ev_user1) ect. I then called it like this: if keyboard_check_pressed(ord("Z")) { choices[selection] } It gave me a red...