ID:2145694
 
(See the best response by Nadrew.)
Code:
usr.loc = locate(20,20,16)


Problem description:It does not move the player to the 16th z, or even the other coordinates for that matter. It just keeps them where they are.

Gonna have to show more than that.
In response to Nadrew
Nadrew wrote:
Gonna have to show more than that.


Okay, I did some more testing. It's the switch statement that's not working.

            switch(usr.village)
if("Leaf")
alert(usr,"You have been born in the Hidden Leaf Village!")
usr.loc = locate(/turf/leafspawn)



In response to Nadrew
2nd update: I found the actual source of the problem. I'm starting the player regen() proc right before the switch statement, and nothing after it is working.


mob
proc
Regen()
while(usr.login)
if(usr.stamina <= usr.maxstamina)
usr.stamina += usr.regenrate
if(usr.stamina > usr.maxstamina)
usr.stamina = usr.maxstamina
if(usr.health <= usr.maxhealth)
usr.health += usr.regenrate
if(usr.health > usr.maxhealth)
usr.health = usr.maxhealth
if(usr.chakra <= usr.maxchakra)
usr.chakra += usr.regenrate
if(usr.chakra > usr.maxchakra)
usr.chakra = usr.maxchakra
Best response
The while() is blocking the rest of the code, you'll want to spawn() off the call to Regen().
spawn() usr.Regen() worked, but can you explain to me why? I don't really understand it.
BYOND is a single-threaded system that executes things one by one in a stack. Calling a proc that never ends (an infinite loop) will block the stack from proceeding and prevent anything below that code to fire. When you use spawn() you're basically telling it to continue executing the stack while processing the things inside of the loop
Besides the above, you're also using usr in a proc. That's no good. Since this is a mob proc, one can safely assume this proc belongs to whatever mob you actually want to work with, so src would be the correct choice.

Rule of thumb: Never put usr in a proc. You should always assume it's bad juju outside of verbs.