Ever wanted NPCs to wander around like zombies? Well, that can't really happen in this library, they don't chase you! But, they do wander, and it quite gives them more of a human-like way of thinking. Ha! Enjoy.
#1 Feb 3 2012, 5:48 am (Edited on Feb 3 2012, 6:05 am)
mob //Declaring it's going to be a mob NPC //Better Specification of what kind of mob (Can be anything, but in this case, it's named NPC.) Guy //NPC Clarification of which (Name) icon='NPCs.dmi'//the npc's icon file icon_state="Guy"//specification of the name of the icon in the icon file. New() //Creating a new proc ..() //declaring the new proc while(src) //Explaining when to run the process if(prob(rand(80,90)))//Rolling a dice (Giving the illusion it is running on ticks.) step_rand(src) //Making the src(mob/NPC/Guy) step randomly sleep(rand(40,120)) //Resetting the Proc
mob //Declaring it's going to be a mob NPC //Better Specification of what kind of mob (Can be anything, but in this case, it's named NPC.) Guy //NPC Clarification of which (Name) icon='NPCs.dmi'//the npc's icon file icon_state="Guy"//specification of the name of the icon in the icon file. New() //Creating a new proc ..() //declaring the new proc while(src) //Explaining when to run the process walk_rand(src,rand(40,120))
What you did was define an already built in proc, when you could have made it alot shorter, and more helpful to new programmers.
/* Format: walk_rand(Ref,Lag=0,Speed=0) Args: Ref: A mob or obj. Lag: Delay in world ticks between movement. Speed: Speed to move, in pixels. 0 uses Ref.step_size. */
If you are interested in knowing how it works.
Cheers.