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

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:
    430
    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