ID:141116
 
Code:
mob
Move()
if(Riding==1)return
return ..()

mob/var
Riding = 0

turf
Train_point

obj
icon = 'Objects.dmi'
Train
Train1
icon_state = "T1"
density = 1
verb/Ride()
set src in oview(1)
alert("You stagger up onto the platform and look around. Are you sure you want to board the train?")
switch(input("Are you sure you'd like to board the train?","Train")in list("Yes","No"))
if("Yes")
if(usr.Riding==1)
src << "You're already riding the train!"
else
src << "You decide it's time to board the train."
usr.loc = locate(/turf/Train_point)
usr.icon = 'Objects.dmi'
usr.icon_state = "T1"
usr.Riding = 1
walk(usr,WEST,1)
var/obj/A = new/obj/Train/Train2(usr.loc)
var/obj/B = new/obj/Train/Train2(usr.loc)
var/obj/C = new/obj/Train/Train3(usr.loc)
walk_to(A,usr,1,0)
walk_to(B,A,1,0)
walk_to(C,B,1,0)
sleep(600)
usr.icon = 'Mobs.dmi'
usr.icon_state = "Normal"
if("No")
return

Train2
icon_state = "T2"
density = 1
Train3
icon_state = "T3"
density = 1


Problem description:
My train decided it doesn't want to move. >.>



Extra Information:
Well, it's a pretty simple process(I thought). You go to the front of the train and then use the Ride verb. It then changes you into the icon of the front of the train, transports you onto a spot on the map, creates the rest of the train which then follows you, and is supposed to move you forward! However, I've noticed two things wrong with this code. For one, I'm pretty sure that making them unable to move will affect the chances of the "Walk" proc. However, I need them to be unable to move, or it could mess up the track the train goes on and cause bugs later on. So I looked up "Walk" using F1, but I still couldn't fix it. So I removed freezing them completely, but it still wouldn't work. So I have to figure I'm using "Walk" incorrectly. I'm still relatively new to programming on BYNOD, but I'm trying my best to get better at it. Perhaps there's an easier way to do this? I really don't know. But if you can help me that'd be really great.
Omgdudewtf wrote:
For one, I'm pretty sure that making them unable to move will affect the chances of the "Walk" proc. However, I need them to be unable to move,

Yes, there's one of your problems. The truth is that this overriding mob/Move() approach to preventing movement is a very poor solution, which creates problems just like what you can see here. What you want is not to make the mob completely locked in place and unable to be moved by everything, you just want the mob to be unable to move himself. For players, this can be done by overriding the client/Move() proc instead, which governs what happens when a player sends a movement command in an attempt to move his mob. So it applies for player-initiated movement only.
In response to Kaioken
Ah! That seems like a much better solution. Thanks for the help. I'll go and change that right now. Am I using the Walk procedure correctly? This is my first attempt at using it and I'm not sure if I didn't specify what it's supposed to be doing or something.
In response to Omgdudewtf
Omgdudewtf wrote:
Am I using the Walk procedure correctly?

I guess it's fine. But you have to realize that a dense object will be blocked by other objects in the way (though walk_to() will try to walk around them), so keep that in mind.
There are multiple things I'll also change there... first, you shouldn't compare to 0 or 1 (Var==1) to check for truth, doing if(Value) (or if(!Value) to reverse it) is a better (more efficient and robust) method and is easier to do. Also, in some places you're outputting messages to the train obj, src... =P
In response to Kaioken
Wow... Well that's embarassing. <.<; I also feel like such an idiot now, I just was re-reading the "Walk" procedure in the Reference and it says, "Move Ref in the direction Dir continuously. Each step will be preceded by Lag time of inactivity. " I took it as they would continously move. Don't see why I didn't notice that beforehand. Oh well, learn as we go, I suppose! Thanks for your help, I changed it so the message goes out to the person instead of the train now, and fixed the values.