1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

instance_place not working the same (or has bug) in new version?

Discussion in 'Programming' started by BoB3k, Feb 1, 2019.

Tags:
  1. BoB3k

    BoB3k Member

    Joined:
    Feb 1, 2019
    Posts:
    7
    I've had a bug pop up and couldn't see anything I did to cause it, so I went back to the last version and it was gone. So, it looks like it is because of the new GMS2 version.

    Bug:
    instance_place() wasn't working (as in return -4 even though it should be finding an object) in the very specific circumstance of 1) when I went into a new room (using goto_room()) from the original room and call instance_place for an object that 2) did NOT appear anywhere in the original loaded room. -- that's right, if you have an object that DID appear in the original room, it will be detected. only objects not yet ever instantiated are missed.

    So, I reinstalled the old version and it worked again.

    I put in debug prints, and they confirm i'm getting -4s with the new version and valid instance ids with the old version.
    Working version: GameMakerStudio-Installer-2.2.0.343 (runtime 2.2.1.287 and 2.2.1.291)
    NOT working ver: GameMakerStudio-Installer-2.2.1.375 (runtime 2.2.0.258)


    Does anyone know why this would be happening on purpose as not a bug? Has anyone else had any instance_place() errors in the new code?

    Thanks,

    BoB
     
  2. FuRyvok

    FuRyvok Member

    Joined:
    Jan 13, 2019
    Posts:
    35
    The instance_place checks for collision with an object

    Code:
    var inst;
    inst = instance_place(x, y, obj_Enemy);
    if inst != noone
    {
    //Do something if there are collision with obj_enemy
    }
    Code:
    room_goto();
     
  3. Relic

    Relic Member

    Joined:
    Jun 27, 2017
    Posts:
    725
    Is the room_goto() in the same event as instance_place()? I believe the entire event has to finish before things like a cleanup event/destroy event (and maybe a room change) will occur. You may say go to the new room but are still in the old room until the next step. Why that works in one version and not the other is weird though.
     
  4. BoB3k

    BoB3k Member

    Joined:
    Feb 1, 2019
    Posts:
    7
    No, nothing that timing would effect. Once I'm in the new room, none of the objects will come back from the instance_place.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice