ID:155572
 
How would you permanently disable a certain mobs movement?


Example being, a player being a immobile object like a base in an RTS?

Not that i'm making an RTS i just want to understand how that would be done :)
To disable the arrow keys
client
North()
return
Northeast()
return
East()
return
Southeast()
return
South()
return
Southwest()
return
West()
return
Northwest()
return
Is this a mob connected to a client, or an NPC?
In response to Warlord Fred
these procs are built in for client but if you want to do that for npc then instead of client use
mob/npc
North()
return
Northeast()
return
East()
return
Southeast()
return
South()
return
Southwest()
return
West()
return
Northwest()
return
In response to Hassanjalil
No, if you don't want an NPC to move you don't move it. NPCs don't move unless your code tells them to.
In response to Prf X
Overriding the arrow keys isn't particularly robust. You'd end up with 8 versions of the same code if you want the arrow keys to behave differently under the same situations, and not to mention these are client procs and not mob procs, so they don't apply to NPCs.

Instead, try overriding Move() if you're trying to stop or limit movement.

Here's an example of what I mean.
mob
var/frozen=0
Move(turf/newloc,newdir)
if(frozen) return 0
.=..(newloc,newdir)

When mob.frozen = 1, the mob will not move. Because of inheritance, all NPCs that are a subclass of /mob will also inherit the frozen attribute and behavior.


Making a building or other immobile object in an RTS merely requires that Move() not be called or that Move() fails.
In response to Warlord Fred
i am referring to the player...
In response to D4RK3 54B3R
Ok since no one seriously understands what i meant, except maybe that last guy let me rephrase.


Disable player movement, making the arrow keys only for moving the client.eye not the player.
In response to Komuroto
still waiting...
In response to Komuroto
This is what I came up with hoping this is what you are looking for...
client
perspective=EYE_PERSPECTIVE
North()
if(get_step(mob.client.eye,NORTH))//IF EYE CAN MOVE NORTH
mob.client.eye=get_step(mob.client.eye,NORTH)
South()
if(get_step(mob.client.eye,SOUTH))//IF EYE CAN MOVE SOUTH
mob.client.eye=get_step(mob.client.eye,SOUTH)
East()
if(get_step(mob.client.eye,EAST))//IF EYE CAN MOVE EAST
mob.client.eye=get_step(mob.client.eye,EAST)
West()
if(get_step(mob.client.eye,WEST))//IF EYE CAN MOVE WEST
mob.client.eye=get_step(mob.client.eye,WEST)

I do believe this is what you are asking for...only reason I put the "if" statements in was when eye hit the edge of the map the whole screen would go black, but with my testing it just moves the eye and your player stays in place.