AI Wander

by Dark Hollow Games
[Documentation] [Share] [Zip]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://DarkHollowGames.AIWander##version=0

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:

byond://DarkHollowGames.AIWander##version=0

170 downloads
Version 1
Date added: Feb 2 2012
Last updated: Feb 11 2012
1 fan
Ever wanted NPCs to wander around like zombies? [More]
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.

Advertisement

Comments

Bumblemore: (Feb 5 2013, 2:39 pm)
why is this allowed to be a library
Falacy: (Feb 8 2012, 3:13 am)
That delay is the same between each movement. Even if you pass it a rand() value, it is only configured once.
Avainer1: (Feb 8 2012, 2:36 am)
Lag: Delay in world ticks between movement. 

huh
Falacy: (Feb 8 2012, 2:09 am)
Avainer1 wrote:
What you did was define an already built in proc

walk_rand() does not vary the time between each movement
Avainer1: (Feb 8 2012, 1:44 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.