S
sirbranedamuj
Guest
I have an object that works like this:
Object Name: obj_Floor
Create:
Collision With obj_SomethingElse:
Collision With obj_Player:
My room is just a bunch of these obj_Floor objects arranged in a grid, and an obj_Player object moving around colliding with them. There's another object, obj_SomethingElse, that resets obj_Floor's color to 0. Nothing in the room has changed it at this point, it's there for other purposes.
Randomly, while playing this room which I have played literally hundreds of times previously, this error triggered while moving obj_Player around:
This code has not changed in over a month. There are dozens of obj_Floor objects also in this room under the same circumstances that did not have this happen.
This feels like a game maker bug to me, but I was just curious to see if anyone has run into this before. I had trouble googling for this problem because most of the relevant posts are from newbies that don't understand variable scope or something. In this case, as far as I can tell, the variable either became unset or the Create event never fired for this one instance on this one run of the game.
I don't know much about GMS internals but if I'm not mistaken, 100040 is the object ID for this object, and -2142147483648 is...the variable index maybe? That number looks like Integer.MIN_VALUE to me, which usually isn't a good sign
-------------------EDIT----------------------
Instead of necroposting the thread, I just wanted to put my "solution" here. We had some code that was activating/deactivating the instances based on where the player was, and we think that this was causing some funkiness. Ever since removing that ultimately useless feature, we stopped seeing this issue. So if you wound up here through google or otherwise, check if you're doing instance deactivation/activation, and if so, try not doing it. Hope that helps!
Object Name: obj_Floor
Create:
Code:
color = 0;
Collision With obj_SomethingElse:
Code:
color = 0;
Collision With obj_Player:
Code:
if (!global.some_global_var && color == 0) {
/* do some stuff */'
}
Randomly, while playing this room which I have played literally hundreds of times previously, this error triggered while moving obj_Player around:
Code:
FATAL ERROR in
action number 1
of Step Eventobj_Player
for object obj_Floor:
Variable obj_Floor.color(100040, -2147483648) not set before reading it.
at gml_Object_obj_Floor_CollisionEvent_37_1 (line 5) - if (!global.some_global_var && color != 0)
This feels like a game maker bug to me, but I was just curious to see if anyone has run into this before. I had trouble googling for this problem because most of the relevant posts are from newbies that don't understand variable scope or something. In this case, as far as I can tell, the variable either became unset or the Create event never fired for this one instance on this one run of the game.
Code:
Variable obj_Floor.color(100040, -2147483648)
-------------------EDIT----------------------
Instead of necroposting the thread, I just wanted to put my "solution" here. We had some code that was activating/deactivating the instances based on where the player was, and we think that this was causing some funkiness. Ever since removing that ultimately useless feature, we stopped seeing this issue. So if you wound up here through google or otherwise, check if you're doing instance deactivation/activation, and if so, try not doing it. Hope that helps!
Last edited by a moderator: