ID:169908
 
area
treearea
Entered(atom/movable/A)
if(ismob(A))
var/mob/M = A
var/list/whowhowhatwhat = list("tree1","tree2")
var/a = pick(whowhowhatwhat)
M.camoarea = a


This is my first time using areas so please forgive all obvious mistakes.

That area code sets M's camoarea correctly only sometimes but not every time. Am I doing something wrong?
By sometimes do you mean only when you switch area types? If so, it is supposed to be that way.

All turf objects which are located in the same instance of an area are just that... all within the same location. So, if on your map you plaster the right side with /area/right and the left with /area/left you will not call /area/Entered until you actually cross over from right to left or left to right. You can run around all you want within the same area to no affect where areas are concerned.

If that is not what you meant, please explain further.
In response to Loduwijk
I've got a flood of different areas on the map in different positions on different turfs. When I move onto areas, it doesn't always set the area right.

In response to DeathAwaitsU
I've discovered the problem, Entered() for areas isn't working when a new mob is created.

So if I'm created on left, it wont change my camoarea until I go to the right and come back.

Any way to fix this?
In response to DeathAwaitsU
DeathAwaitsU wrote:
I've discovered the problem, Entered() for areas isn't working when a new mob is created.

Entered is called by Move. New does not call Move, therefor creating an object inside another does not call the entered object's Entered function.

Any way to fix this?

Either use Move to put the object where you want it or call Entered yourself.
var/obj/O=new
O.Move(location)
//or
var/obj/O=new(location)
location.Entered(O)