1
2
ID:161284
May 25 2008, 11:30 am
|
|
Ok, so I'm making a MUD and I want to know how I would make a clone of myself, my stats anyway and make it follow me around?
|
May 25 2008, 11:40 am
|
|
To make a copy of an object, you'd basically create a new object of the same type, and set all its variables to the value of the original's variables. You can do this with the type variable and the vars variable. Look them up and have a go at it.
|
In response to Kaioken
|
|
I got the whole creating part, now I need help with the following part, in a MUD its kinda different for me, then if it were on turf..
|
In response to Lundex
|
|
I am unsure as to whether this would work but from looking at the refrence (which you should do as suggested) I came up with this rather crude way:
var/mob/clone = new src.type(src.loc) |
In response to Lyndonarmitage1
|
|
That I already know, I'm just looking for how to make them follow me from room to room, since I don't have any turf....
|
In response to Lundex
|
|
Each time your player 'moves' have the clone move. You could do this by adding a check proc to your default ways of movement.
E.G. mob/proc/Clone_Move() |
In response to Lyndonarmitage1
|
|
Uhh, wow that just lost me..
|
In response to Lundex
|
|
You could override the rooms' Entered() and make it so whenever a player enters a room, so does his clone, or something to that extent. But you should use the Move() proc instead of setting loc directly.
area/room |
In response to Kaioken
|
|
Hmm, only one question. what would M.clone.Move() be the normal Move() proc or a made one?
|
In response to Lundex
|
|
You wouldn't be able to make a new one, since mobs already have a proc named Move, eh. And there isn't a reason to make a new one, since Move() does what you need here... it moves the object to the new location.
|
In response to Kaioken
|
|
Well, its coming up as undefined...
|
In response to Lundex
|
|
You haven't defined the clone variable's type properly, then. It should be defined as a mob (or perhaps something more specific as appropriate, such as mob/person or mob/character).
|
In response to Kaioken
|
|
Just send me to the helpfiles...Cause I'm not getting it.
|
In response to Lundex
|
|
Right, the "help files" about this would be the reference's entry(ies) about variables and the DM Guide's chapter about variables. You're indeed welcome to try and solve your problem on your own by reading them. Although, you may have been confused or mislead by example (which is just an example, by the way, intended to demonstrate, not to be used), which assumes there is a variable called clone on mobs that references their clone. If your game doesn't have this, then you need to add this or something similar to it; the mob needs to keep track of its clone so we can work with it later.
|
In response to Kaioken
|
|
Well, I have a variable clone, just I don't think I'm using it right. For the examples..
|
In response to Lundex
|
|
Again, make sure the variable's type is defined as /mob. Look up 'vars' in the DM Reference to see how to define variables and their type. If the variable isn't defined as /mob, the compiler won't know that it has mob variables and procs (such as atom/movable/Move()).
|
In response to Kaioken
|
|
Ok, I have my clones set under mob/others, so it is a mob type....it still doesn't work..
|
In response to Lundex
|
|
Well, post all the relevant code so we can do more than just guess what the problem is, then. Others will help you then (I'm off for today).
|
In response to Kaioken
|
|
mob/verb |
In response to Lundex
|
|
No, you need to declare the variable pointing to the clone to be of type mob.
|
1
2