What I mean is...
How can I make it so that an NPC disappear after you talk to it, but only for that user, so the user no longer sees it, but other people can (sort of like a mission), then after they get done, and talk to the NPC, the NPC disappears for them too.
Any help would be nice.
ID:164374
Jun 19 2007, 7:12 pm
|
|
In response to Mikau
|
|
Well, it is a mob, but I understand what you mean, but if there is such an easier way that gets the job done, I'm willing to hear it, but that is a nice idea that I can consider. But thanks for a response atleast.
|
Not a particularly easy thing to do. Images can be used to display an image to only one client (see: http://developer.byond.com/docs/ref/info.html#/image ), but to display them to everyone but one person takes a bit of fiddling around. However, this is what I'd do:
Create an image variable for all NPCs that are transient. In fact, that's a good word. Use that. mob/NPC/transient/var/image/ghost. Ghost is a good variable name, I think. (You may have an additional type, like mob/NPC/questgiver, but I think you get the idea). Now, in mob/NPC/transient/New(), you'll want to enter them into a global list, so you can keep track of them. In addition, you'll want to set their ghost image, which will be set to their current icon. So, ghost = image(icon=src.icon,icon_state=src.icon_state,loc=src). That will set ghost to an image that is the transient mob's current image, and will be, when displayed to a client, on top of the transient mob (that's what the loc variable is for). Now, once we've got the image, set our icon to null, so nobody can see us any more. Next, you'll need a way to track which transient mobs we should see and which we shouldn't. For simplicity, we'll just track the ones we SHOULDN'T, and then assume we can see the rest. This is best because we can add new mobs without having to clear saved lists. However, here's the real kick in the pants: You can't store a list of the transient mobs, because this will not be saveable (without causing problems). So, we need something else. My suggestion is to use the tag variable. See: http://developer.byond.com/docs/ref/info.html#/datum/var/tag . This will allow us to easily take a text string and locate the mob that we want to find. The downside is that you can't specify tags at compile-time, it has to be done at run-time (such as in the New() proc). So, go back to mob/NPC/transient/New(), and add the line tag="whatever". Better yet, give mob/NPC/transient a variable specifying the tag it should have. Then, attempt to locate() that tag. If it does, put out a big honkin' error, because tags should always be unique. If you can't, then we can set our tag to that variable. Anyway, so that means players will have a list of tags that specify what they can and can't see. However, our transient mobs are still invisible. We need to write a proc that will display what we want to see, and what we don't want to see. Fortunately, we can use our global list of transients and our mob's list of transients we don't want to see to do that. I'll give you this, and hopefully you'll be able to use it to get an idea of what the rest of this requires. mob Now, I said it wasn't easy. At least it wasn't hard. The hard part will be taking it beyond the visual effect. Even if you can't see the mobs, you will still be able to interact with them (including bumping into them). You can most easily solve this by a humorous message to the user whenever they try to interact with somebody not there (something questioning their sanity works well). A more complete solution, however, is up to you. |
In response to Garthor
|
|
Well, it definitely does seem like a long process, and I wish there were an easier way, but if it gets me what I want, then I'll try it.
Let me write it up and read up more about this and I'll post my outcome if it does what I want or not, but I thank you, Garthor. |
However, after thinking about it, why not try instead of having the NPC as a mob, have it something you view with the client screen. I'm not sure if you can have something at a fixed destination, as most of the time the client screen is used for HUDs. However if you can, it might work.
You might have to wait for Garthor to come give you a real answer, but it at least gives you something to try while you wait.