• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

variable

  1. R

    Legacy GM Affect Single Instance (RESOLVED)

    I have 10 instances that work on an AI that I need variables changed when they hit a specific object but ONLY when they hit the object individually. An example would be I have an enemy that when colliding with a trigger its variables are affected but not the other 9 instances of the enemy. it...
  2. A

    GML [SOLVED]Typewriter effect dialog not working on first line of text (array)

    Hi there, I am currently trying to implement dialogue with a typewriter effect (letters appearing one by one), which is working so far except on the first text line. From line 2 and beyond, the typewriter effect works perfectly but for some reason the first line's letter appear all at once...
  3. lukbebalduke

    Legacy GM Built in variables questions

    Hi! I have some questions about the built in variables, so, I'm creating a game and I'm not using any built-in variables other them x, y, depth and visible, but the other variables still being created (right? ) such as speed, direction, gravity, score. Is there any way to avoid that? Does that...
  4. A

    GML [SOLVED] Problem with variable used in array. Incorrect dialog displayed.

    I'm having quite a weird problem (from my perspective at least). I'm using a variable "writing" to store a value to use in an array dail_in[writing]. But what happens now is that in the first two sentences the dialogue reads "0" and only at line 3, and onward, does it start displaying the...
  5. P

    Android How can we check if a variable exists or not?

    Game Maker Studio ditched the variable_local_exists() and variable_global_exists() functions, so my life is harder now in game programming. I found a function called is_undefined, and I rejoiced, thinking that it would help me. Zero. I tried something like this: is_undefined(variable), and...
  6. D

    Legacy GM Unknown global Variable

    FATAL ERROR in action number 1 of Step Event0 for object obj_tank2: global variable <unknown built-in variable>(-1610512732, -2147483648) not set before reading it. at gml_Object_obj_tank2_Step_0 This shows up when i try to run my game, but the only global variable in it is already known and...
  7. W

    GML Help with Variables?

    Hello, I'm gonna make this quick, I have a variable for my player's jump speed and I need to adjust the variable from another object as a jump boost power-up. I thought that the way to do this was to put "global." (the full variable would read "global.jumpspeed") before the variable name but...
  8. M

    Android Compiling creates "uninitialized variable" error

    Hey guys! It's been a while :) Before I get a comment saying there is an error in my code, allow me to explain :p : The game works flawlessly when compiled and ran with the target set to Windows. The error is also showing that it comes from objects that are NOT in the first room and therefor...
  9. D

    GMS 2 [HELP]...[SOLVED]...if image_angle += 1 {global.totalSpinned += 1};

    Why does this not work? "unexpected unary operator +="... What I'm trying to do is make a variable add 1 every degree spinned. DnD and code is welcome to solving!
  10. John Andrews

    [SOLVED]Things after room_goto()

    I just wanted to know if things put after room_goto() in a code are done, for example: if keyboard_check(any) { room_goto(room1); global.room++; } would that make the global variable "room" augment everytime I press any key? ALSO If it is not possible, the is there a...
  11. 2

    Check if Variable equals existing instance id without error if it doesn't

    If I set a variable to an instance id, what do I do to check later if the instance id contained in the variable exists, to avoid it throwing an error when I try to do something to the instance later, if the instance id value in the variable doesn't exist because it was destroyed. Keep in mind...
  12. C

    [solved] Issue passing variables using "with" and "other"

    Hi everyone. My issue is by using the with statement. I'm making a very simple dragon quest style rpg for practice. Basically the player collides with a enemy on the field... then a battleEvent object is created. This battleEvent object creates a playerBattle and a enemyBattle objects, each...
  13. T

    Windows DLL's Crashing When More than 4 Vars are used

    In the Game maker help file: "Finally you must give the number arguments that the function can take (from 0 to 15) and for each of the arguments you must specify its type too. Please note that for functions with 4 or more arguments, all of them must be of type ty_real. " When doing this now...
  14. J

    gamemaker choose variable by button

    Hey guys, I have this RTS Game in which i have workers. I want to choose what the workers are mining, but i want to be able to choose what each individual worker mines. I would like to choose what they mine with buttons that pop up. The only thing that has to occur is that a variable changes...
  15. F

    Legacy GM Problem with view_yview

    if the player view_yview is greater than 100 I want it to change the variable dirt to 1 if view_yview > 100{ global.dirt = 1; } I don't really get whats going on I swear this should work.
  16. 2

    GML Find if ID in Variable = an object_index Name, or Child Of

    Putting an instance id in a variable, I need to see later if the variable's instance id is equal to an object, or a child of that object without writing each of their object index name only the parent. eg. given var = an instance id, test if object_index name of id is something...
  17. S

    GMS 2 referencing a ds_list's ID using a string variable?

    So I have an object (obj_weapon_gui) and in that object's create event, I've created a ds_list named SHOTGUN, and a ds_list named CURRENT_WEAPON. The code snippet below is written in a script (scr_equip_weapon). The top code snippet works. but it isn't ideal. I have over 20 weapons, and I...
  18. O

    Windows How do I Make my Game run Code When Not Running?

    I'm creating game where you can hatch eggs. Some eggs will take about 8 hours to hatch. I don't think anyone would like to play a game for 8 hours straight just to hatch an egg! I tried using the current_second variable to set the time to the future, but it I don't know how to set to a future...
  19. D

    GMS 2 instance_position(xLocation,yLocation,all); returning 100099

    For some reason instance_position(xLocation,yLocation,all) is returning 100099 instead of -4 (or noone) like it should. It appears that the first time the code is run it returns -4. However, the second time it returns 100099 which is not the ID of any object and causes issues further down the...
  20. Posho

    Legacy GM Return Colliding Object's id

    I'm testing a collision between two objects and one of the objects should return the id of the other but it's not working. I've used instance_place(), instance_position(), collision_rectangle() and none are working. I know this is beginners' stuff and I've made this work in the past but it's...
Top