ID:147361
 
I've been trying to make it so I can change the view var when someone enters a turf. I have been completely unsuccessful.

Here's a failed bit of code:

obj/a
Enter()
view = 1

I get a compiler error, stating that view is undefined. How must I format this?
Gathin wrote:
obj/a
Enter()
view = 1

I get a compiler error, stating that view is undefined. How must I format this?

First, obj/Enter is not called when you step on that object; rather it is called when you physically enter that object (Such as when entering a vehicle obj). Second, you have to tell it whos view you wish to change.

In turf/Entered loop through objects of type obj/a in that turf and call a function belonging to that object.

Example:
turf/Entered(atom/movable/A)
if(ismob(A))
var/mob/M=A
if(M.client)
for(var/obj/a/O in contents)
O.AlterView(M)
obj/a
proc/AlterView(mob/M)
M.client.view=1