They'll work one time, then not another...any idea why this is happening? It ONLY Loads the cars when I have NPC cars marked as "purchased=1" for some reason when it's 0, it doesn't want to load.
proc
SaveCars()
var/savefile/cars=new/savefile("cars.sav")
var/carNum=0
var/mobcount=0
for(var/mob/vehicles/C in world.contents)
if(C.purchased==1)
cars["car[carNum]"]<<C //save each car individually
carNum++
mobcount++
cars["carNum"]<<carNum //save the total number of cars
world<<"[mobcount] car\s saved!"
proc
LoadCars()
var/savefile/cars=new/savefile("cars.sav")
var/carNum=0
var/mobcount=0
cars["carNum"]>>carNum
if(carNum)
for(var/i=1 to carNum)
var/mob/vehicles/newCar
cars["car[i]"]>>newCar
world<<"[newCar.x],[newCar.y],[newCar.z]"//DEBUG Message
mobcount++
world<<"[mobcount] car\s loaded!"
I get this run-time from my debug message:
runtime error: Cannot read null.x
proc name: LoadCars (/proc/LoadCars)
source file: procs.dm,20
usr: null
src: null
call stack:
LoadCars()
: New()
Lummox JR