I've figured it out, it was actually quite simple. I just had to put if object position y() is same as the object that is directly above the player.
// find object directly above player
objectabove=sc_raycastgroup(1,object position x(1),object position y(1)+10,object position z(1),object position x(1),object position y(1)+100,object position z(1),1)
// ghost objects that are in between the camera and player
for x=100 to 5000
if objectabove>0
abovefade#=sqrt((object position x(objectabove) - object position x(x))^2 + (object position y(objectabove) - object position y(x))^2 + (object position z(objectabove) - object position z(x))^2)
// radius = 60
if abovefade#<60
ghost object on objectabove
fade object objectabove,10
// fade objects on same height and within a radius
if object position y(x)>object position y(objectabove)-5 and object position y(x)<object position y(objectabove)+5 // (THIS IS WHAT I NEEDED!)
ghost object on x
fade object x,10
endif
endif
endif
next x
I'll post a video later tonight on the games forum page
here which showcases this.
www.liambradburymusic.com - professional music for your games.