//save+load code
mob
proc
Savenow()
if(src.cansave && src.issaveing == 0)
var/savefile/F = new("[src.ckey].sav")
Write(F)
F["i"] << src.image
F["X"] << src.x
F["Y"] << src.y
F["Z"] << src.z
spawn(10) src << "<font color=green><b>Your game has been saved!"
spawn(10)for(var/mob/m in world)
if(m.admin >= 1)m << output("<font color = red>[src] has saved.","info")
usr.issaveing = 1
spawn(500)usr.issaveing = 0
mob
verb
LoadPlayer()
set hidden = 1
if(src.canload == 0)return
if(fexists("[src.ckey].sav"))
var/savefile/F = new("[src.ckey].sav")
Read(F)
var/image/i = new/image(F["i"],src)
src.image = i
src << i
world<<output("<font size=1><font color=green><B>Info: <font color=white>[src]([src.key]) has loaded a character...","info")
src.loc = locate(F["X"],F["Y"],F["Z"])
if(src.ko == 1)
src.ko = 0
spawn()src.KO(,src)
if(src.isSleeping == 1)src.sleep_cycle()
issonared = 0
whosonared = null
src.canmove = 1
src.isfly = 0
src.grabbing = 0
src.grabbed = 0
src.whoGrabbed = null
src.whoGrabbing = null
src.canload = 1
src.UpdateCansee()
src.age()
loggedyet = 1
online += "<font color=[src.player_clr]>([src.key])[src.name]"
winshow(src, "outputs", "show=0")
winshow(src, "window1")
else alert(src,"You have no save")
//Obj that seems to be causing the issue
obj/Captain
droppable = 0
caninv = 0
var/repPoints = 0
var/influence = 0
var/squadMembers = 1
var/demeanour = "Unknown"
var/squadNumber
var/mob/user
var/squadTheme
verb
////////////***//////////////captain verbs!///////////***//////////
Apoint_Trainee()//As a side note, the code that decides when to appoint a shinigami as fully fledged is in the spirit gain part of the statgain proc
set category = "Squad"
var/tmp/mob/m = input("Who do you wish to apoint as a trainee Shinigami?")as mob in view()
if(m.race != "Spirit")
usr << "They can't be made a Shinigami Trainee, either they aren't dead or they are already a different race."
return
m.Become_Shini()
m << output("<br><br><Font color = green>As you were made a trainee directly by a Captain, you learn a bit about shakkahou, the basic Shinigami Kidou! You also gain a hell butterfly.","OOC")
var/obj/h = new/obj/Hell_Butterfly
h.loc = m.contents
for(var/obj/skill/projectile/Shakkahou/s in m.contents)
s.MasterIncrease(25,m,1)
// ** // ** // ** // ** // ** //
Invite_To_Squad()
set category = "Squad"
var/tmp/mob/m = input("Who do you wish to invite into your squad?") as mob in view()|"None"
if(m == "None"||m.race != "Shinigami")
return
else
switch(input("Are you sure? This will cost you 15 rep points if they accept.")in list("Yes","No"))
if("No")
return
if("Yes")
for(var/tmp/obj/Captain/c in usr.contents)
if(c.repPoints < 15)
usr << output("Not enough rep points.")
return
if(m.squad != null)
usr << "They are already in a squad."
return
switch(alert(m,"[usr] is inviting you into their squad. Do you wish to accept?","Squad invite","Yes","No"))
if("Yes")
view() << "<font color = green>[m] courteously accepts [usr]'s invite into their squad!"
var/tmp/obj/Squad/s = new/obj/Squad
m.contents += s
s.squadNumber = usr.squad //s = the object containing the squads details that the new squad member receives.
s.user = m
m.rank = "Rank and File"
s.captain = usr
src.influence += 1+(m.basesp/1000)
for(var/tmp/obj/Captain/C in usr.contents)
C.repPoints -= 15
if("No")
view() << "<font color = red>[m] rejected [usr]'s offer to join their squad...ouch."
// ** // ** /// ** /// ** // ** // ** // ** // ** // ** // ** //
Spend_Reputation_Points()
set category = "Squad"
var/tmp/reppoints
for(var/tmp/obj/Captain/c in usr.contents)
reppoints = c.repPoints
var/tmp/t = input("What do you wish to spend your reputation points on? You have [reppoints] to spend.","Choose something.")in list("Change Squad Theme: 50 points","Temporary Gains Increase: 40 points")
if(t == "Temporary Gains Increase: 40 points" && reppoints >= 40)
squadgainup(usr,0.5)
for(var/tmp/obj/Captain/C in usr.contents)
C.repPoints -= 40
if(t == "Change Squad Theme: 50 points" && reppoints >= 50)
switch(alert("Change your squad's theme?",,"Yes","No"))
if("Yes")
var/tmp/i = input("What do you wish to change it to?")in list("Politics","Technology","Healing and Protection","Reiatsu Speciality","Warrior Speciality","Bloodlust","Shadow Operations","Honour Bound","Kidou Specialisation","Businessman-ship","Lone Wolf","Teamwork","None")
if(i == "None")
return
if(usr.squad == 1)
squad_1_theme = i
if(usr.squad == 2)
squad_2_theme = i
if(usr.squad == 3)
squad_3_theme = i
if(usr.squad == 4)
squad_4_theme = i
if(usr.squad == 5)
squad_5_theme = i
if(usr.squad == 6)
squad_6_theme = i
if(usr.squad == 7)
squad_7_theme = i
if(usr.squad == 8)
squad_8_theme = i
if(usr.squad == 9)
squad_9_theme = i
if(usr.squad == 10)
squad_10_theme = i
if(usr.squad == 11)
squad_11_theme = i
if(usr.squad == 12)
squad_12_theme = i
if(usr.squad == 13)
squad_13_theme = i
for(var/tmp/mob/m in world)
if(m.squad == usr.squad)
usr << output("Your Captain [usr] has set your squad's theme to [i].","OOC")
if("No")
return
else usr << "<font color = red>Not enough Reputation Points. You currently possess [reppoints]."
Problem description:
For the longest time I've not understood fully saving/loading. I thought I'd finally cracked it, but for some reason, when a player is made a "Captain", and they are given the above Captain obj, an error occures when loading the savefil containing said obj.
Searching.dmb...connected
runtime error: cannot append to list
proc name: LoadPlayer (/mob/verb/LoadPlayer)
source file: Saveing.dm,36
usr: Jin150 (/mob/Player/admin/Jin150)
src: Jin150 (/mob/Player/admin/Jin150)
call stack:
Jin150 (/mob/Player/admin/Jin150): LoadPlayer()
Line 36 is the part of the load code that says "Read(F)". This error only seems to occur when a player has been made a "Captain". Any thoughts guys?
Does anyone at least have any idea what "Cannot append to list" means??