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.
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. |
![]() Sep 9 2016, 6:52 pm
|
|
Gonna have to show more than that.
|
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) |
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 |
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. |