ID:172323
May 30 2004, 6:54 am
|
|
Is it possible to make an object that will wander randomly? Like an example is what im planing to do is make "dolls" u can call them that to get them you buy them from a store, so they are in ur inventory, then when u drop them, they just run around randomly and say stuff if you use a talk verb on them.
|
May 30 2004, 9:20 am
|
|
You could maybe make them mobs, but have them become objs when picked up... if that's possible x_o
|
In response to Rippy
|
|
Like maybe a drop code like
Drop() ??? Maybe that would work. They cant be picked up again, so it would only be in the drop |
An Obj is a movable atom, and so can move unless I'm mistaken. Just make a proc:
obj ~Ease~ |
In response to Metroid
|
|
exactly. You could have the doll be a mob, but when you pick it up, it gets deleted and replaced with a doll obj. I could try to give some code, but I think it would be much too buggy. x_o
|
In response to Rippy
|
|
It'd be much, much simpler just to keep it as an object.
~Ease~ |
In response to Rippy
|
|
The only difference between an obj and a mob is that an obj cannot be logged into by a client (and a few other minor differences, like the default layer, and the setting for verbs).
|
In response to Ease
|
|
Evil....I make them have this
obj And they get made SOUTH of me, yet when I turn that off, they get made in my inventory, is there a way I can FORCE them into my inventory? |
In response to Metroid
|
|
Metroid wrote:
Evil....I make them have this obj And they get made SOUTH of me, yet when I turn that off, they get made in my inventory, is there a way I can FORCE them into my inventory? Yes, but how you need to do it depends on how you are making them. Basically, all you need to do is pass a mob in the New() proc, and they will appear in their inventory. mob Then, in your dolls Drop() proc, call the Wander() proc. Test the dolls loc, and if it is not a turf, have it stop wandering. obj Those Get and Drop verbs should be generalized to all gettable objects, but they'll do for an example. |
In response to Flick
|
|
I have new /obj/doll (usr) but it forces it under me. What your suggesting (I think) is to activate thier movement when you drop them, but I also have it so that they get saved (So you dont have to buy them everytime the server restarts) so thats why I have it with every New version of the doll. How can I get it to always make them move but not make them appear under me when they are bought?
|
In response to Metroid
|
|
I'm not real sure what exactly you mean, but you could do this.
obj That creates a bit of extra processing for each doll that is in someones inventory though. When you say the doll gets created to the south of you, does that happen every time? Does the doll wander after it is created? I would think that step_rand would fail if the objects location is not a turf, but I could be wrong. |
In response to Flick
|
|
It appears below me, then on the sides of the other ones each time if theres one in the way. But I do have an Idea. What if I delay until its moved? Like
New() sleep(10) Wander()?? Then it would put it in my inventory but still have it move. |
In response to Metroid
|
|
Well, I just set up a little demo, and it seems to be working fine for me. Show the proc you are using to create the dolls. That might help.
|
In response to Flick
|
|
Well Im only showing one doll =P but basically this is the guy you buy them from.
mob Then when I buy Blue Slime Doll, it would appear in my inventory if that wander is off, but if its on it appears basically as close to me as possible. What Im thinking, is if I delay the wander to start fdor a new doll obj, that it would hopefully make it appear in my inventory, then I can carry it whereever from there. EDIT I just tried that, it makes it appear in my inventory for the sleep then it pops it out of my inventory. A tad annoying. I need it to just NOT come out of my inventory and just stay in my inventory tilll I drop it. |
In response to Metroid
|
|
Well, I just copied your dollseller code, and used it with the object code from [link], and it worked fine. I did add a simple Drop() verb as well.
obj *shrug* Are you overriding the objects New() proc somewhere? |
In response to Flick
|
|
Not that I know of, ill look though...under obj/housetag but mine is obj/dolls, Ill keep looking...No. Absoulutly no where else effects obj/New() Theres a bunch of world/New()s and client/News() but no other obj/News() except for obj/housetag/New() but how could that effect obj/dolls/New()?
EDIT I just ran a test with this code obj And the same thing still happens to me. Every time I buy it, it will be in my inventory then just drop out and start wandering. |
In response to Metroid
|
|
You aren't checking the dolls loc in the RandWalk proc. Only call step_rand if the dolls loc is a turf.
|
Metroid wrote:
Is it possible to make an object that will wander randomly? Like an example is what im planing to do is make "dolls" u can call them that to get them you buy them from a store, so they are in ur inventory, then when u drop them, they just run around randomly and say stuff if you use a talk verb on them. How about this? Have the obj's Drop() verb call a proc called Dropped (much like Enter() and Entered()), then have the Dropped() verb for the dolls call walk_rand() to make them start walking randomly. <code>obj/verb/Drop() if(src.Move(usr.loc)) usr << "You drop \the [src]." src.Dropped(usr) else usr << "You can't drop \the [src]." obj/proc/Dropped() return</code> <code>obj/doll Dropped() walk_rand(src, 5)</code> |
In response to Flick
|
|
Haha there we go! Thanks! I dunno why I didnt just make sure they were on a turf in the first place, now whenever I buy one, it will be in my inventory forever until I drop it because RandWalk() isnt intialized. THANKS!
|
In response to Foomer
|
|
Well me and my friend together decided to do this, but the major problem is getting them to move when they are reloaded. we tried
for(var/obj/dolls/O) if(isturf(O.loc))O.RandWalk in world/New() but for some reason, it doesnt work. |