ID:179418
 
How do you make monsters walk around randomly but stay in a SPECIFIC area?

What is the difference between sleep and spawn?

Also how do I detect to see if someone moved away from a location. For example they moved away from a door that takes 15 seconds to open and when they are out of oview(1) the countdown to open it terminates?

I'm using the missle library and I wam wondering. How do I detect if it ever reaches its destination?
Also how would I give each object a limited lifespan?

I am trying to make a shopkeeper system. Also I will use that same system for recharging items, and other functions.
I have it so that when you wish to open the store window it creates a statpanel that for buying contains that objects contents. Now how would I check if one of those objects was double clicked? Also how would I check for like regenerating items it shows you your contents. How would I check for a double click there? Also I want to having when you click it shows the price or amount of cash needed for recharge.
Also for the store how would I add to that objects contents by selecting an object randomly from a list that every different store type has.

How do you check if something is in someone's inventory,check its variables, be able to delete it and also edit it?


I am trying to make a spawn location. Now how do you create an object from a variable. In the variable I have the location of the item I want generated. Now how would I make a new object at the spawn location using that variable?

Now another slightly more important question. How would I check if it already generated that object or that type of object is on that location?
Also how do you change from one map to the next if both of the maps layers are designed? For example map 1 has layer 1 designed and map 2 also has layer 2 designed.
You have a slew of questions on the board there, but I will attempt the one that intrigued me (because I have never tried it before):
area/npcwalkzone
mob/npc/New()
WalkInArea()
mob/npc/proc/WalkInArea()
var/oldloc = src.loc
var/localarea = area in src.loc
if(istype(localarea,/area/npcwalkzone))
step_rand(src)
localarea = area in src.loc
if(istype(localarea,/area/npcwalkzone))
spawn(rand(3,6)) WalkInArea()
else
step_to(oldloc)
spawn(1) WalkInArea()
else
world.log << "[src] (/mob/npc) is not on /area/npcwalkzone!"
return


Try that out and see if you can get it to work!

-Lord of Water
In response to Lord of Water (#2)
It says are is not a valide variable
In response to Exadv1 (#1)
Exadv1 wrote:
Also how do you change from one map to the next if both of the maps layers are designed? For example map 1 has layer 1 designed and map 2 also has layer 2 designed.

you mean you are using different DMP files?
or not?

<hr>
Psycho Posting Person
In response to Exadv1 (#3)
make are into area, and it will probably work. Try to debug things on your own sometimes. :-D
In response to Lord of Water (#5)
Where is there an are. What do you mean

Pillsvery yes I am using separate files
Also how do you check what area you are in?
In response to Exadv1 (#7)

atom/proc/Area_Check()
var/atom/possible_area = loc
while (!istype(possible_area, /area))
possible_area = possible_area.loc
return possible_area

This is a nice little proc returns the area you are in. A nice example that would show how to use it would be..

mob/verb/Check_My_Area()
var/area/a = usr.Area_Check()
usr << "You are in [a]!"

which in turn would return the area the user is in.
In response to Exadv1 (#1)
Anyone
In response to Exadv1 (#6)
Anyone?
In response to Exadv1 (#10)
<font color=black>Anyone? Anyone? *crickets* croak(or whatever they do)</font>
Stop bumping your post <font size=1> annoying teacher from Ferris Bueler's Day Off</font>
In response to Air _King (#11)
I waited a whole day and this post got lost.
In response to Exadv1 (#12)
Exadv1 wrote:
I waited a whole day and this post got lost.

It doesn't get lost until it gets deleted from the forum (which, simply put, doesn't happen unless it is vulgar).

I read all of the posts on the forum, and while I might not immediately jump on top of it, especially when bored of posting on the forum, you will always get a reply from me unless someone else already helped you, or it is not in my power to answer.
In response to Spuzzum (#13)
Could you help me because no one seems to want to help me.
The main reason I bumped was because I have a lot of questions unlike the normal 1 questrion per thread and I could have just postyed every question seperately but this way I am not cluttering the forum with a lot of questions.
Another question.
I have it so that you can gain skills by reading a book. However I want it so that when you read it again you can't gain more skills but other people can if they want. Is there an easier way to do this instead of putting the name of every character who reads the book in a list contained as a var of the book objectr. Also could someone help meon my post in Code Problems on Player Owned Houses. My code is very ineffient ad I'm open to suggestions.
Exadv1 wrote:
How do you make monsters walk around randomly but stay in a SPECIFIC area?

Make them walk randomly as normal, but make area/YourArea/Exit(atom/M) return 0 if M is a monster.


What is the difference between sleep and spawn?

sleep() halts the current proc for that amount of time. spawn() runs the other proc in a certain amount of time and continues on in this proc immediately.


Also how do I detect to see if someone moved away from a location. For example they moved away from a door that takes 15 seconds to open and when they are out of oview(1) the countdown to open it terminates?

Too much work for me... =P


I'm using the missle library and I wam wondering. How do I detect if it ever reaches its destination?

Good question. I'm planning on either scrapping that library or revamping it to be more useable and intuitive -- right now, it's a mess to work on or adapt.

For now, change the s_delwithinrange() proc to suit your needs.


Also how would I give each object a limited lifespan?

spawn() a del(src) code after you create the object.


How do you check if something is in someone's inventory,check its variables, be able to delete it and also edit it?

var/obj/O
for(O in M.contents) break
//now O contains the first /obj found, or null if nothing was found


I am trying to make a spawn location. Now how do you create an object from a variable. In the variable I have the location of the item I want generated. Now how would I make a new object at the spawn location using that variable?

turf/var/spawntype = /obj/potion

turf/proc/Spawn()
new spawntype(src)


Now another slightly more important question. How would I check if it already generated that object or that type of object is on that location?

Make a turf variable that points to that object. If that variable is true, then don't create it. Just clear the variable when you want it to make a new one.
In response to Spuzzum (#15)
Would there be a way for an object say the soawner thought to actually do the checking by using a variable for the item. It goes in with the Spawner code. I can't quite figure it out.
In response to Exadv1 (#14)
I also have books that have information that you have written in them. Do you have any ideas on how to make a good plain writing method where you write actually text that others can read. Every book has multiple pages. I thought og having it so that you read books in the browser. This would be somewhat like Ensya but a little more in depth.
In response to Exadv1 (#14)
I would like to help you but I am stuck in Dream Maker too.
In response to Exadv1 (#17)
Let me clarify
You have books
There are two typws
1. Learning books.
You can learn skills from them. They can only be used once. now in order to make it so they can only be used once by a single mob do I store that mobs name in a list. This way other mobs can use it.
2. Information books
These are somewhat like Ensya