ID:169350
 
How do you enter an area upon which a mob is created? Enter() is being called when the mob is created and until the mob moves to a different area, the coding for my area's Enter() doesn't work.

I tried:

mob/New()
..()
src.loc.loc.Enter(src)


But just got spammed with runtime errors saying cannot modify null.loc.
src.loc=locate(/turf/Whatever)
DeathAwaitsU wrote:
I tried:

> mob/New()
> ..()
> src.loc.loc.Enter(src)
>

But just got spammed with runtime errors saying cannot modify null.loc.
This src.loc.loc.Enter(src) doesn't make sense. src.loc.loc means the location, of the src' location... besides I don't think locs have an Enter proc, (src) means the mob again, and that means that the mob would Enter himself.
mob/New()
..()
src.loc='your turf' //move src to the turf, put here the turf you want

If a mob moves to a turf(set his loc to the turf) it calls the Enter() proc.
In response to CIB
But the point is that I want the Enter() to be called at the place the mob is created. Doing src.loc = src.loc I'm sure won't call Enter(). And even if it does, it still won't call Enter() for the area.
In response to CIB
why the hell did you use text strings?
it should be:
mob/New()
..()
src.loc=/turf/the-turf-name


O-matic


In response to DeathAwaitsU
I'm still a little confused.
so what you want is that Enter() is called at the place were the mob is created?
I don't understand it very clearly,
please explain it again :P

O-matic
In response to CIB
CIB wrote:
> mob/New()
> ..()
> src.loc='your turf' //move src to the turf, put here the turf you want
>

If a mob moves to a turf(set his loc to the turf) it calls the Enter() proc.

Enter() and Entered() will only be called if Move() is called. Setting loc manually does not call any of those procs.

Lummox JR
In response to O-matic
http://members.byond.com/DeathAwaitsU/files/Area.PNG

Imagine that to be the map. The black bit is the map flooded with the SAME area. The white bit with black lines is where the mob is being created.

If the mob moves around on the map, Enter() isn't being called for my area because all the areas are the same.

But if we ignore the moving thing, how do I call Enter() at the white bit with black lines so that my area's Entered() process is called?

area
Flood
Entered(atom/movable/A)
A.place = "flood"

In response to Flame Sage
Or you could set it to a coordinate...

src.loc = locate(1,1,1)
In response to Flerix
What this guy is saying is that he needs Enter() to be called upon teleportation. I'd guess this has something to do with calling procs or setting/changing variables. I've had this problem for some time, but I took the easy way out.

I just made a specific verb or selection in a list that teleported me to some place, and set the variables for that location and/or called the proc that would normally be called for Entering that location.

While I have no tried teleporting to a specific turf, teleporting to a coordinated location will not help this situation. As Lummox Jr has stated, Enter() can only be called by Move(). So, two other ways other than my simple way would be to overwrite Enter() or Move(), move maybe being easier, or teleport to a place and have the character move North, or South or wherever your heart should desire.

Other than those solutions, I have no ideas.
Look up Move's args.
ex:
Move(locate(location),dir)
In response to Ol' Yeller
...

Enter/Entered() isn't called for an area until you move from area A to area B.

So you can't keep running along area A and hope Enter() to be called, you have to move to area B and then back to area A for Enter() to be called.
In response to CaptFalcon33035
mob/New()
..()
src.Move(locate(/area/name_of_area)

Try that.