ID:168378
 
Block movementdir's? I forgot, kinda..
REMOVED
In response to Zmadpeter
None of 'em seem to work...
In response to Stefm
Stefm wrote:
None of 'em seem to work...

Probably because you blindly copy+pasted that code in your project, remember: Never copy+paste from the forums!

O-matic
In response to O-matic
REMOVED
In response to Zmadpeter
mob/Move()
if(!frozen)
return..()
if(!nomove)
return..()
if(src.dir == SOUTHEAST)
return
if(src.dir == SOUTHWEST)
return
if(src.dir == NORTHWEST)
return
if(src.dir == NORTHEAST)
return


I didn't copy paste it.. -.-
In response to Stefm
REMOVED
In response to Zmadpeter
Zmadpeter wrote:
// way 2
mob
Move()
if(src.dir == "North")
return 0
// and so on you could also use a switch

untested and unchecked

Madpeter, I know I've said this to you often, but I say it again: Don't post code you haven't tested, because your code more often than not is wrong.

dir is a number, not a string. src.dir=="North" will always be false.

The first method using client/North() does work, although probably what this poster wants is a way to block movement directions in a specific turf. He wasn't very specific about that, or even very coherent, but it doesn't often make sense to always block mobs from moving north.

Lummox JR
In response to Stefm
Stefm wrote:
> mob/Move()
> if(!frozen)
> return..()
> if(!nomove)
> return..()
> if(src.dir == SOUTHEAST)
> return
> if(src.dir == SOUTHWEST)
> return
> if(src.dir == NORTHWEST)
> return
> if(src.dir == NORTHEAST)
> return


You're doing your checks backwards. If the mob is not frozen, you've just told it to go ahead and move no matter what else the case may be. Instead you need to bail out if the mob is frozen, and if they're not supposed to move, and so on.

mob/Move(newloc, newdir)
if(frozen || nomove) return
// this will check for a diagonal direction
if(newdir & (newdir-1)) return
return ..()


Lummox JR
In response to Lummox JR
I dunno 'bout that... I use nomove too, and I have it like I think he has it.. Eur.. yeah. Nomove 1 = can move
In response to Mysame
Mysame wrote:
I dunno 'bout that... I use nomove too, and I have it like I think he has it.. Eur.. yeah. Nomove 1 = can move

Your post made absolutely no sense. What was the point of it?

It's clear of course that the if() checks in the existing code are wrong, and need to be fixed. If you're actually doing them the same way, you too will have the same issue. If you're not sure about that, why bother posting just to say... nothing?

Lummox JR