ID:161587
Apr 19 2008, 5:50 pm
|
|
I just read Zilal's MUD tutorial, so I have game code similar to hers. I've tried several ways(locating the object when it's created, putting the object in the area's contents, etc.), and I was wondering how you make the object just spawn in the area?
|
In response to YMIHere
|
|
I need the objects to spawn when the world is created, not when I tell them to. I tried making a spawn proc for the objects and looping through it based off of your example, but I forgot they have to exist to be acted upon by a proc.
|
In response to Darkmag1c1an11
|
|
Just create them in World/New() as Z did for the areas (after the areas get created of course). =)
|
In response to YMIHere
|
|
Alright, I got the objects to spawn, now I want a better way of seeing if they're in the area. It gets very annoying having a message telling you that there's objects in the area when there's nothing there. With that, I've tried:
if(A.contents) (Always returns true) var/obj/O if(O in A) (Always returns false) var/obj/O if(O in A.contents) (Always false) if(A.contents.len) (Always true) And none worked. Is annoying me pretty bad. |
In response to Darkmag1c1an11
|
|
If you're trying to see if a specific type of object is in something's contents, do this:
if(locate(/obj/o) in A.contents) |
In response to Popisfizzy
|
|
I'm looking for if any object is in the area.
|
In response to Darkmag1c1an11
|
|
If you mean /area, then just use that code with the /area.contents variable. If you mean "area" as in "region", then just loop through the turfs in that region and use the code provides on each turf's contents.
|
Example:
Now if you supply an area's name to the Create tattle tale verb it will be used by locate() to grab a reference to the area.