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.
|
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..
|
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) |
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....
|
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() |
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 |
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.
|
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).
|
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.
|
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()).
|
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).
|
mob/verb |