How to define a variable for item in a list?
|
|
mob/verb/list_add(mob/m) if(m.ingroup==0) friend1.Add(m) m.ingroup=1 while(1) var/mob/x=friend1[1] var/mob/y=friend1[2] if(src.loc==locate(12,6,1) && (x in friend1) && (y in friend1)) x.loc=locate(12,3,1) y.loc=locate(11,9,1) cancelfor=1 else if(cancelfor==0 && x in friend1 && src.loc==locate(12,6,1)) x.loc=locate(12,3,1) sleep(10)
|
I'm making a party system that encounters enemies and whenever I add a friend it says list index out of bounds. I think it says that because var/mob=friend1[2] doesn't exist and I'm trying to define it as a variable. How do I make it define only if there is a second person in the list?
|