mob
verb
S_Create()
set hidden = 1
if(src.Squad)src<<"You must leave your squad first"
else
if(alert("Are you sure you would like to create a squad?","Create Squad","Yes","No")=="No"||src.Squad)return
for(var/mob/i=length(Squad)+1,i>0,i--)
if(SquadList.Find("Squad [i]"))
src.Squad="Squad [i]"
break
SquadList.Add(src.Squad)
SquadList+=src.Squad
SquadList[src.Squad]=list(src)
SquadList[src.Squad][src]="Leader"
Squad2Key+=src.Squad
Squad2Key[src.Squad]=list(src.key)
Squad2Key[src.Squad][src.key]="Leader"
winset(src,"Squad.S Label","Text=\"[src.Squad]")
src.Squad+=1
src<
src<[src] ([src.key]) - ( Level: [src.Level] | Clan: [src.clan] ) - \[ [SquadList[src.Squad][src]] ]","S Output")
src<
src<<"You have created the [src.Squad]!
You can invite a maximum of 6 members to your Squad and leaving it will disband the Squad"
basically this is my code for making squads but i keep getting this run time error and i dont know why
runtime error: list index out of bounds
proc name: S Create (/mob/verb/S_Create)
usr: Nykid (/mob/Player)
src: Nykid (/mob/Player)
call stack:
Nykid (/mob/Player): S Create()
PLEASE SOMEONE HELP MEEEEE!!!
ID:1609580
Jun 24 2014, 8:16 pm
|
|
Are you aware you are adding src's squad to SquadList twice?
And I'm not exactly sure what you are trying to do here, but it's probably the offender:
Here is a guild system Ter whipped up for someone else in need. It shares many of the characteristics of a squad system. I suggest you learn from it and refactor most, if not all of that code accordingly. (This isn't me telling you to copy it either; learning and copying are two entirely different things.)