ID:261512
 
When i use my movement lock code my screen goes blank

mob/var/l=0

mob/proc/lock_movement()
if(usr.l)
usr.l = 1
return
else
..()
mob/Move()
usr.lock_movement()
Knuckles skater wrote:
When i use my movement lock code my screen goes blank

mob/var/l=0

mob/proc/lock_movement()
if(usr.l)
usr.l = 1
return
else
..()
mob/Move()
usr.lock_movement()

Three problems: You need "return ..()" or ".=..()" instead of just ..(), you're not returning the return value of lock_movement() from Move(), and you shouldn't be using usr anywhere in there.

I'm not sure why you're farming all this out to another proc anyway; it's causing one of your problems, and it's of no benefit to you.

Lummox JR
In response to Lummox JR
i did what you said and it still doesn't work i can now see stuff but when i tell it to lock the movement then nothing happens
In response to Knuckles skater
Knuckles skater wrote:
i did what you said and it still doesn't work i can now see stuff but when i tell it to lock the movement then nothing happens

You'd have to show the new code, then.

Lummox JR
In response to Lummox JR
i tryed this but it doesn't work

mob/var/l=0

mob/proc/lock_movement()
if(usr.l)
usr.l = 1
return
else
..()
mob/Move()
if(usr.l)
usr.l = 0
return
else
return ..()
In response to Knuckles skater
Knuckles skater wrote:
i tryed this but it doesn't work

mob/var/l=0

mob/proc/lock_movement()
if(usr.l)
usr.l = 1
return
else
..()
mob/Move()
if(usr.l)
usr.l = 0
return
else
return ..()

Questions:

  • What are you using the lock_movement() proc for, now? If it's merely to set the player's l var, you don't need it and it's not doing what you want anyway.
  • Why are you resetting l to 0 in Move() if it's on? Shouldn't this be telling the player to ignore all movement, and simply return 0 from Move() here to prevent the action? Resetting l to 0 should be done elsewhere, if it's a flag to lock movement.
  • Why did you tell me you'd done the changes I suggestion when clearly you didn't? You've still got usr plastered all through there, and it shouldn't appear even once in the segments you showed me.

    Lummox JR