ID:174294
 
HI

1)

I have a party code but is there any way i can change it so npc's follow you if they see you?

Here is code:

mob
var
ispartied = 0//This will be used later on

area
icon='icons.dmi'
icon_state="area"
mob//player mob
icon='icons.dmi'
icon_state="mob"
mob/NPC
icon='icons.dmi'
icon_state="mob"
/*This code is so the NPCs move around*/
mob
proc
randwalk()
for(var/mob/NPC/M in world)
if(!M.client)
walk(M,NORTH)
sleep(20)
walk(M,SOUTH)
sleep(20)
M.randwalk()
else
return..()

mob
Click()
if(usr == src)
..()//Don't party with yourself
else
switch(input("What do you want to do?")in list("Party","Nevermind"))
if("Party")
if(usr.ispartied>=1)
..()
else
usr.ispartied = 1
usr.group.Add(src)//Adds the person you click on to your party
usr.Group()//calls the group proc
else
..()

mob/proc/Group()
for(var/mob/M in src.group)
if(src.group == null)
return..()
else if(M == src)
continue//keeps going after it checks and finds the user
else
walk_to(src,M,1,0)//You follow who you're partied with.
sleep(10)
Group()//loops the proc


client/Move()//Here we call the group proc everytime you move
if(mob.ispartied<=0)
return..()
mob.Group()
else
return//can't move if partied
mob.Group()

mob/New()//when a mob is created
randwalk()//calls the randwalk proc and group proc
Group()
mob/Login()
..()//shows the map


mob/verb/Leave_party()
var/leave = input("Are you sure you want to leave?")in usr.group
usr<<"You leave [leave]'s party"
usr.group.Remove(leave)//removes the person in your party from your party.
usr.ispartied = 0//Back to normal

2)

Is it possible to add like a boarder round your game screen ? what comes with your game?
To make NPCs follow you automatically, they'd need to run some kind of AI loop that repeatedly checks their vicinity every so often for you. Something like this might be good:
mob/NPC
var/autojoin // set this to 1 for some NPCs on the map

New()
if(autojoin)
spawn() ScanAutojoin()

proc/ScanAutojoin()
var/mob/M
while(src)
for(M in view(src, world.view))
if(M.client)
if(JoinParty(M)) return
// if mobs are nearly in view but not quite, scan faster
for(M in view(src, world.view * 2))
if(M.client)
spawn(rand(5,15)) ScanAutojoin()
return
// scan again in about 2 or 3 seconds
sleep(rand(15,30))

Lummox JR