ID:150217
 
Ok.. I finally coded it in so that there is characters that are two spaced tall, but now they dont move.. they only can look left right up and down, but not move anywhere.. plus when I load up my game, the upper body doesnt show up until I try and move... anyone have any clues? Here is my coding for the double sized chars..

mob
var
obj
head
top
/obj/head/top
movetimer

Move(loc)
if(world.time < movetimer) return
movetimer += 5
..()

var/turf/T = (locate(src.x,src.y + 1,src.z))
if(T)
top.loc = T
else
top.loc = null
return ..()
MaNiAcK wrote:
Ok.. I finally coded it in so that there is characters that are two spaced tall, but now they dont move.. they only can look left right up and down, but not move anywhere.. plus when I load up my game, the upper body doesnt show up until I try and move... anyone have any clues? Here is my coding for the double sized chars..

I think the main problem you have here is that movetimer isn't initialized to 0. It's an arbitrary value, so if(world.time < movetimer) may remain false for a long time.
If that doesn't do it, you may want to consider changing the return ..() at the end. Try cutting out that line, and in the line above that calls ..(), change it to . = ..() instead.

There are a couple other places where your code could use some touch-ups, though. First, I'd change movetimer += 5 to:
  movetimer = world.time+5

Also, this block can be replaced with one simple statement:
  var/turf/T = (locate(src.x,src.y + 1,src.z))
if(T)
top.loc = T
else
top.loc = null

This can simply be done as:
  top.loc = locate(src.x,src.y + 1,src.z)

Lummox JR
In response to Lummox JR
And exactly how would I set it up so that movetimer = 0 at all times?
In response to MaNiAcK
MaNiAcK wrote:
And exactly how would I set it up so that movetimer = 0 at all times?

No no, you just need to make sure it starts at 0:
var/movetimer=0

After that it will be reset to world.time+5 the next time Move() runs, if you include the modifications I suggested.

Lummox JR
In response to Lummox JR
Okie.. I put all the adjustments you told me to and it still doesnt work.. here is what I have in my code:

mob
var
obj
head
top
/obj/head/top

var/movetimer = 0

Move(loc)
movetimer = world.time+5
. = ..()

top.loc = locate(src.x,src.y + 1,src.z)

And when I hit run and create the character, he starts out as only the lower body.. when I try and move the upper body shows up, but I cannot move..
In response to MaNiAcK
MaNiAcK wrote:
And when I hit run and create the character, he starts out as only the lower body.. when I try and move the upper body shows up, but I cannot move..

Do you overide Login? Normally Login calls Move(), which would place the top over the body. Your modified Login probably sets loc directly instead of using Move(). Anytime your code sets the mob's loc, you should also set the top's loc in the same code block.


Are you aware that movetimer is doing nothing but eating memory and processor power the way you have it here? If you aren't going to use it, just take it out. You also have redundant declarations of the mob var top. The following code does the same thing without the clutter.

mob
var
/obj/head/top

Move(loc)
. = ..()
top.loc = locate(src.x,src.y + 1,src.z)