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 how to check depth from other object

Discussion in 'Programming' started by EZTALES, May 21, 2019.

  1. EZTALES

    EZTALES Member

    Joined:
    Apr 15, 2018
    Posts:
    182
    hey guys,
    having a error trying to check the depth from another object, says for an error "unexpected epression" code is below. anyone know why?
    thanks
    -EZ
    Code:
    if place_meeting (x,y, obj_oilman_2) && with obj_oilman_2 depth = -101;
    {
    image_speed = 0.1;
    }
     
  2. The-any-Key

    The-any-Key Member

    Joined:
    Feb 2, 2017
    Posts:
    1,524
    You can't use a with statement inside a if statement. With statement don't return anything.
     
    EZTALES likes this.
  3. EZTALES

    EZTALES Member

    Joined:
    Apr 15, 2018
    Posts:
    182
    okay, then do you know what I could write instead?
     
  4. Ushugun

    Ushugun Member

    Joined:
    Nov 23, 2016
    Posts:
    11
    If there is only once instance of obj_oilman_2 you can use
    Code:
    if place_meeting (x,y, obj_oilman_2) && obj_oilman_2.depth == -101;
    {
    image_speed = 0.1;
    }
     
  5. EZTALES

    EZTALES Member

    Joined:
    Apr 15, 2018
    Posts:
    182
    thank you!
     
  6. EZTALES

    EZTALES Member

    Joined:
    Apr 15, 2018
    Posts:
    182
    keeps giving a malformed if statment, any idea why?
     
  7. Guitarmike

    Guitarmike Member

    Joined:
    Jun 30, 2018
    Posts:
    68
    Get rid of the semi-colon at the end.
     

Share This Page