ID:178027
 
is there a Demo that will help me make mobs only walk in certain areas?

Alienman
Wank? <font size = 5>Wank!</font><font size = 6>WANK!</font><font size = 10>WANK!!!!!!!</font>
In response to Shun Di
....there i fixed it....

Alienman
In response to Alienman22774
Thanks... And I'll make a code and send it on AIM
In response to Shun Di
Shun Di wrote:
Wank? <font size = 5>Wank!</font><font size = 6>WANK!</font><font size = 10>WANK!!!!!!!</font>
did i miss something here ??
In response to Maz
my original post said wank instead of walk because i was typing too fast and wasn't paying attention.
Alienman22774 wrote:
is there a Demo that will help me make mobs only walk in certain areas?

I don't know if there's a demo, but the code is pretty easy to do.
Basically you'll want to set up your area on the turfs you want, and do this:
area
Enter(atom/movable/A)
if(istype(A,/mob/monster))
var/mob/monster/M=A
if(!istype(src,M.areatype)) return 0 // you can't come in
return ..()

mob/monster
var/areatype

deer
areatype=/area/forest
unicorn
areatype=/area/plain
fish
areatype=/area/water

You can also override Exit(), only there's slightly less contorl there because you can't compare the new area to the current one. Exit() would be good for other things:
area/penaltybox
var/list/inbox

proc/Penalty(mob/M,seconds)
if(!inbox) inbox=list()
inbox[M]=world.time+seconds*10
if(!M.Move(src)) // move to a random turf
M.loc=locate(/turf) in src // or an occupied one if need be
spawn(seconds*10)
if(M) M << "Penalty over!"
inbox-=M

Exit(atom/movable/A)
if(!inbox) return 1
var/release=inbox[A]
if(world.time<release) return 0
inbox-=A
return 1

mob
proc/Penalty(reason,seconds)
world << "<SPAN CLASS=penalty>[round(seconds/60)]:[round(seconds/10)%6][seconds%10]\
penalty on
[name] for [reason].</SPAN>"
var/area/penaltybox/A=locate(/area/penaltybox)
A.Penalty(src,seconds)

Lummox JR