ID:266845
 
How can i make it so if a chacter's energy is less then 0, it equals zero and he can't move?
mob
Move()
if(M.energy<=0)
return 0
else
..()
oh oh, you could also make fatigue and so when you are pretty knackered it gets hard to control

client
proc/UserMove(_dir)
mob.dir=_dir
if(mob.fat && prob(100-100*(0.85**mob.drunk)))

_dir=turn(_dir,prob(50)?45:(-45))
var/turf/T=get_step(mob,_dir)
if(T) mob.Move(T,mob.dir)

North() UserMove(NORTH)
South() UserMove(SOUTH)
West() UserMove(WEST)
East() UserMove(EAST)
Northwest() UserMove(NORTHWEST)
Northeast() UserMove(NORTHEAST)
Southwest() UserMove(SOUTHWEST)
Southeast() UserMove(SOUTHEAST)

make sure you set a variable for fat (Fatigue) and also the higher the fatigue the randomer the movement so make its defalt = 0
In response to Maz
erm... my method is far more condensed, and far more effective... I have no idea how you got all of that...
In response to Ter13
Thanks.
In response to Lucas Gates
Oh, and if you want it to only be effective to the players in your game, do this:

Move()
if(src.client)
if(src.energy>=0)
return 0
else
..()
else
..()

this will make it so that your NPCs won't be affected by this.