ID:171975
 
Ok, I have ~tons~ of things in my Move() proc. The problem is that the end of it doesn't take effect. It's probably something really simple that I missed, but I can't seem to figure it out. :/

        Move()
if(move_lock == 0)
..()
else return 0
usr.movecount -= 1
if(usr.movecount == 8)
usr.hunger += rand(1,2)
if(usr.movecount == 4)
usr.thirst += rand(1,2)
if(usr.movecount == 0)
usr.energy -= rand(1,3)
usr.movecount = 22
usr.warmth -= rand(1,5)
usr.speed = (100 - usr.hunger - usr.thirst) / 10
if(usr.hunger >= 50)
usr.hunger = 50
if(usr.thirst >= 50)
usr.thirst = 50
if(usr.energy <= 0)
usr.energy = 0
if(usr.warmth <= 0)
usr.warmth = 0
if(usr.warmth <= 40) //starts here
var/W = rand(1,16)
if(W == 1)
return 0
usr << "You're cold, and stop to warm up for a second. You should either sit by the lodge fire or buy a Hot 'N Spicy bar to warm up."
else
..()
else if(usr.warmth <=30)
var/A = rand(1,12)
if(A == 1)
return 0
usr << "You're cold, and stop to warm up for a second. You should either sit by the lodge fire or buy a Hot 'N Spicy bar to warm up."
else
..()
else if(usr.warmth <= 20)
var/R = rand(1,8)
if(R == 1)
return 0
usr << "You're cold, and stop to warm up for a second. You should either sit by the lodge fire or buy a Hot 'N Spicy bar to warm up."
else
..()
else if(usr.warmth <= 10)
var/T = rand(1,4)
if(T == 1)
return 0
usr << "You're cold, and stop to warm up for a second. You should either sit by the lodge fire or buy a Hot 'N Spicy bar to warm up."
else
..()
else if(usr.energy <= 40)
sleep(1)
else if(usr.energy <= 30)
sleep(2)
else if(usr.energy <= 20)
sleep(3)
else if(usr.energy <= 10)
sleep(4)
else if(usr.energy == 0)
sleep(5)


*waits*
try this:

        Move()
if(move_lock == 0)
..()
else return 0
usr.movecount -= 1
if(usr.movecount == 8)
usr.hunger += rand(1,2)
if(usr.movecount == 4)
usr.thirst += rand(1,2)
if(usr.movecount == 0)
usr.energy -= rand(1,3)
usr.movecount = 22
usr.warmth -= rand(1,5)
usr.speed = (100 - usr.hunger - usr.thirst) / 10
if(usr.hunger >= 50)
usr.hunger = 50
if(usr.thirst >= 50)
usr.thirst = 50
if(usr.energy <= 0)
usr.energy = 0
if(usr.warmth <= 0)
usr.warmth = 0
if(usr.warmth <= 40) //starts here
var/W = rand(1,16)
if(W == 1)
return 0
usr << "You're cold, and stop to warm up for a second. You should either sit by the lodge fire or buy a Hot 'N Spicy bar to warm up."
else
..()
else if(usr.warmth <=30)
var/A = rand(1,12)
if(A == 1)
return 0
usr << "You're cold, and stop to warm up for a second. You should either sit by the lodge fire or buy a Hot 'N Spicy bar to warm up."
else
..()
else if(usr.warmth <= 20)
var/R = rand(1,8)
if(R == 1)
return 0
usr << "You're cold, and stop to warm up for a second. You should either sit by the lodge fire or buy a Hot 'N Spicy bar to warm up."
else
..()
else if(usr.warmth <= 10)
var/T = rand(1,4)
if(T == 1)
return 0
usr << "You're cold, and stop to warm up for a second. You should either sit by the lodge fire or buy a Hot 'N Spicy bar to warm up."
else
..()
if(usr.energy <= 40)
sleep(1)
if(usr.energy <= 30)
sleep(2)
if(usr.energy <= 20)
sleep(3)
if(usr.energy <= 10)
sleep(4)
if(usr.energy == 0)
sleep(5)


the problem is that wot ur saying is if ur warmth is less than 40 do this, else if ur warmth is 30 do this etc etc. Then at the end ur usage of else would only work IF ur warmth is over 50.

By using just if it means after all the else commands, it check through energy.

Post again if you have more problems or didn't understand what i said but the code worked.
No put usr in proc. Ungh.

Lummox JR
In response to DeathAwaitsU
I don't think you understand exactly what you mean, but I think I've figured it out. (by the way, the end of that code wouldn't work I don't think. everything after the 'if(usr.energy <= 40)' part should be else if statements. Because if your energy was 0, all of those if's would take effect. But anyways, I'll try it out.

Edit: While that did help out, it still didn't fix anything. o.o

(By the way, lummox. What should I replace usr with? src?)
In response to Rippy
Use src, and read this http://www.byondscape.com/ascape.dmb/LummoxJR.2002-1104/
This should help clear up the confusion of usr
In response to Troglodyte
Ok, I replaced all the usr's with M (var/mob/Boarder/M). Also, I think I should explain what the code that doesn't work is supposed to do, since I think I did it wrong anyways XD

Warmth is supposed to dictate the chance you have of simply not moving when you try to. Energy is supposed to change the delay between movement.

(by the way, I added ..() under all the sleeps, because I don't think they'd be doing anything otherwise o.o here's an example, and tell me if it won't work.)

else if(M.energy <= 30)
sleep(2)
..()


Edit: Great... using var/mob/Boarder/M gives me a 'cannot modify null.movecount' error... >.> always something...