mob
NPC // I personally prefer to use an extra "NPC" parent so that my followers will still have some of the same attributes as other NPC's, this is not required.
Follower //This is required. It's a "Follower" parent, that way you can easily create multiple followers without having to write all this code over and over again
var
Leader // Who is (s)he following?
Following = 0 // Is she still following them?
DidWait = 1 // This variable indicates whether or not your follower disappears when you click them again after dismissing them.
Click()
if(Leader == usr) //If their leader clicked them.
if(DidWait) //Did you click them after their timer ran out?
if(!Following)
usr << "<b>[src]:</b> Alright, you lead the way.</b>"
walk_to(src,usr) // Follower(src) will now constantly walk to the person who clicked her
Following = 1
else
Following = 0
walk(src, 0) //Stop walking
DidWait = 0 //They didn't wait long enough
sleep(10)// Wait a second to make DidWait = 1. Use Spawn() if you want to display the message immediately.
DidWait = 1
usr << "<b>[src]:</b> I'll wait here, master..</b>" //Tell the player it's safe to click them without deleting their loyal follower.
else
del(src) // Delete the follower
else
Leader = usr //This is just for testing purposes, in case you can't be bothered to immediately make a quest, much less play one to test a follower that may or may not work.
return
What this snippet does is create a very basic follower for your player. If you click them while they're waiting, they will follow you. If you click them while they're following you, they will stop following you, but if you click two times without waiting, you dismiss them.