mob
follower
icon='m1.dmi'
Login()
usr.icon='player.dmi'
Move()
.=..()
var/oldloc = loc
var/mob/follower
if(.&&follower)
follower.Move(oldloc)
verb
Follow()
new /mob/follower(get_step(src,NORTH))
turf
icon='turffy.dmi'
ID:270839
![]() Sep 28 2006, 9:29 am
|
|
I have been practicing coding doing various stuff and I have a problem, the mob doesent follow me. Can someone tell me what I am doing wrong and not give me code, I want to learn myself.
|
mob still doesent work |
I sense a double variable error
And I see what you are trying to do with oldloc... and I'll say that this is probably a waste of your time when you could use walk_to() or walk_towards() (Read 'em up). I would use walk_to() with the min. dist being 1, because walk_to() unlike walk_towards() [according to the Ref.] takes obsticles into consideration - GhostAnime |
A few problems I've noticed here.
1.) Your design is out of whack. You don't supply the followed to the follower and then call it the follower of the follower. Using that little piece of common sense, your New() should simply go under as mob/New(). 2.) You never called the parent New() proc. Am I the only one who's against that? -_- 3.) How do you KNOW that the M supplied to that New() will be a mob at all? Hell, for all you know it could be a monkey, or a gorilla, or some other aggressive animal that you'd prefer to NOT follow you. istype'd. |
Xx Dark Wizard xX wrote:
I know what they do they do not follow directly. They dont follow like in an rpg party system. You mean like snake? [edit] OK, after examining your old code. I have found that I have gone crazy because of it *crys*. /* RIGHT, as to getting some one to follow you. That is up to you. |
2) In answer to 1), it's kinda hard for you to define the follower as the variable is under Move(), which there will be no way for you to access it directly. I recommand moving var/mob/follower to the parent type, or the parent of the heiarchy (sp?) it falls under. In addition, may I suggest you modify the New() proc [note the cap'd N] to help you with assigning the follower.
- GhostAnime - Got Questions?