variable

  1. 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...
  2. 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...
  3. 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...
  4. 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!
  5. 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...
  6. 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...
  7. 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...
  8. 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...
  9. 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...
  10. 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.
  11. 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...
  12. 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...
  13. 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...
  14. 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...
  15. 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...
  16. B

    Legacy GM "Box" HP problem

    hey there. I've make a little project just to learn what I can do by myself, but I'm now with a problem: I've a box that's supposed to destroy after 6 attacks (box hp = 6), but just one actually is destroying this box. I can't explain exactly what did I do, I think that's something related to my...
  17. Silverfire

    [Solved] Error: Variable not set before reading it

    Hi all, thanks in advance for the help. Running GM Studio 1.4, I have obj_waterfall which is an invisible object that creates water objects every few steps. Instance Creation Code (set in Room window): endpoint=416 Create event: trigger=0 End Step event: trigger+=abs(global.time) if trigger>6...
  18. T

    Legacy GM Problem setting variables used in particle script. [SOLVED]

    Hello everyone, In my spellcasting-game I use a particle system which consists of two colours. Since many things in my game consist of two colours which depend on the elements of the spell you're gonna cast, I have made two variables called 'global.spellcolour1' and 'global.spellcolour2'. I...
  19. N

    global variable range

    Hey everyone!!! : ) I have what I would hope is a very simple and straight forward question. How would you ask in code if (global.fillintheblank is between -5 and +5){ instance_create(x,y, buttface); } Thank you very much. Your answer is much appreciated.
  20. Ayziak

    GMS 2 {SOLVED} Issues with scripts...

    So I've been working on some misc useful scripts to share here, yet this one isn't working, and it's driving me crazy. What am I doing wrong here? /// @description Ayziak's Two Value Variable Toggle /// @param variable Which variable /// @param val1 value 1 /// @param val2 value 2 variable =...
Top