Index · Preferences · Help
Announcements · BYOND Features · Bug Reports · Fixes and Features · Developer How-To · Code Problems · Design Philosophy · Creations · Classified Ads · Gaming · Computers & Technology · Community
Forum Search:

[Advanced Search]

[Messages in this Thread] [Show All (12)] [Return to Developer How-To]

Author:AJX [Posts]
Date:11/7/09 12:51 pm
Topic:Re: Walk/Step_With?
Post ID:726171
Parent ID:726170
Next ID:726177
Dark Vendetta wrote:
> Walk, Step, Loc?
mob/Zombies/Body
 var/mob/Zombies/Head/MahHead
 Move()
  .=..()
  if(.)
   MahHead.loc=loc

First line is self explanatory,

Second line is a variable where you will need to store a reference to your head.

Third line is where we begin to override the Move() proc

Fourth line is a tiny bit more complex, and most people who use it don't understand what it does. '.' is an internal variable that any proc will return by default unless you manually override return. ..() calls the parent of whatever proc you're using, so in this case it would be calling atom/movable/Move() (unless you overrode Move() again in /mob or /mob/Zombies, in which case it would be referring to that.)

The Move() proc by default returns a 1 if it is successful and a 0 if it fails, so the next line ('if(.)') basically means "If the move() was successful", and the line after that moves the head to the body loc.

Messages in this Thread: [Show All (12)]

  Walk/Step_With? Dark Vendetta (11/7/09 10:45 am)
      Re: Walk/Step_With? Jeff8500 (11/7/09 12:09 pm)
      Re: Walk/Step_With? Loduwijk (11/7/09 11:28 am)
          Re: Walk/Step_With? Dark Vendetta (11/7/09 12:02 pm)
              Re: Walk/Step_With? Loduwijk (11/7/09 12:27 pm)
                  Re: Walk/Step_With? Dark Vendetta (11/7/09 12:34 pm)
                      Re: Walk/Step_With? AJX (11/7/09 12:51 pm)
                          Re: Walk/Step_With? Dark Vendetta (11/7/09 1:12 pm)
                              Re: Walk/Step_With? Loduwijk (11/7/09 1:20 pm)
                                  Re: Walk/Step_With? Dark Vendetta (11/7/09 1:27 pm)
                                      Re: Walk/Step_With? AJX (11/7/09 1:47 pm)
                                          Re: Walk/Step_With? Dark Vendetta (11/7/09 2:41 pm)