• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

[SOLVED] Total n00b question - object_exists says "yes", next line says "no"!

T

Tset_Tsyung

Guest
Hey all,

So this is my first post on here (ignoring the muppet 'Humble Bundle' question I posted, ahem).

I've been using Unity since January this year, and thought I'd try Game Maker as well as it was on offer. My first project (after various tutorial projects) is a 2 part game to compare the two IDE'S. First part in GM, second in Unity.

However I'm having an interesting problem.

As this is a tutorial level a player doesn't exist at the start (instead there's a tutorial_player object). The patroling character mentioned below is added in the room creation code.

1. I add a patroling character to the environment. It checks to see if there are any players with an object_exists check. All good.
2. It then activates a script to check Line Of Sight to the player, passing the player object as an argument.
3. The first line in that script is to, again, check if the passed object exists. It clears the check, displays text to debug and continues to the next line.
4. Now we try to measure the distance to the object and, instead of doing as asked, it crashes stating that NO SUCH OBJECT EXISTS...

Needless to say I'm dumbfounded. Is there a better check that object_exists(obj)?

I'd be happy to upload code if you want to check that.

P.S. I know I could work around this by adding a player object and perhaps altering it to have a 'tutorial mode'. But since this is an interesting bug I'd rather solve it if possible.

Many thanks for reading all this - sorry if I've gone on a bit ;)
 
T

Tset_Tsyung

Guest
IGNORE THIS! I solved it straight after posting.

It was a stupid mistake.

I should've been using instance_exists() instead of object_exists().

After realising that, of course, there's no player for it to check against the checks themselves should NOT be returning true... unless I was checking for object and NOT and actual running instance.

That's it, I'm getting a "Rubber Duck Debugging" duck...
 
Top