GM:S 1.4 [Need Help]Making instances

Discussion in 'Programming' started by Sugor, May 29, 2019.

  1. Sugor

    Sugor Member

    Joined:
    May 28, 2019
    Posts:
    17
    How can whats the right way to do it... I wanted to run a script even the instance doesn't exist but the
    name of the obj is in the script for example

    Code:
    case 0:
     room_goto(obj_player_stats.prev_room);
    break;
    but i want the player to go to the prev_room even the obj_player_stats doesn't exist in the room
     
  2. YoSniper

    YoSniper Member

    Joined:
    Jun 24, 2016
    Posts:
    409
    If you try to query an attribute of an object and no instance of that object type exists, you will get an error.

    In order to go to the previous room, you don't even need an object. You can merely say:

    Code:
    room_goto(room_previous)
    HOWEVER, if you try to do this in the first room, you might get an error because there is no room previous to the first room.
     
  3. Sugor

    Sugor Member

    Joined:
    May 28, 2019
    Posts:
    17
    Thank you!
     

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