ID:269038
 
Why wont it work! Here is the runtime error---
runtime error: Cannot read null.density
proc name: Gravity (/proc/Gravity)
usr: Jonathan E (/mob/Player)
src: null
call stack:
Gravity(Jonathan E (/mob/Player))
Gravity(Jonathan E (/mob/Player))
Jonathan E (/client): East()

and the gravity proc is
mob
var
inair
proc
Gravity(var/mob/per)
if(per.dir == EAST)
if(per.inair == 1)
var/turf/check = locate(per.x,per.y-1,per.z)
if(check.density == 1)
per.inair = 0
return
else
per.loc=locate(per.x,per.y-1,per.z)
sleep(2)
Gravity(per)
else
return 0
if(per.dir == WEST)
if(per.inair == 1)
var/turf/check = locate(per.x,per.y-1,per.z)
if(check.density == 1)
per.inair = 0
return
else
per.loc=locate(per.x,per.y-1,per.z)
sleep(2)
Gravity(per)
else
return 0
client
Northeast()
return
Northwest()
return
Southeast()
return
Southwest()
return
North()
if(src.mob.dir == EAST)
if(src.mob.inair == 0)
src.mob.inair = 1
for(var/i=1,i<4,i++)
src.Move(locate(src.mob.x,src.mob.y+1,src.mob.z),NORTH)
src.mob.dir = EAST
sleep(2)
Gravity(src.mob)
return
else
return
if(src.mob.dir == WEST)
if(src.mob.inair == 0)
src.mob.inair = 1
for(var/i=1,i<4,i++)
src.Move(locate(src.mob.x,src.mob.y+1,src.mob.z),NORTH)
src.mob.dir = WEST
sleep(2)
Gravity(src.mob)
return
else
return
East()
..()
if(src.mob.inair == 0)
var/turf/checkdense = locate(src.mob.x,src.mob.y-1,src.mob.z)
if(checkdense.density == 0)
src.mob.inair = 1
Gravity(src.mob)
return

West()
..()
if(src.mob.inair == 0)
var/turf/checkdense = locate(src.mob.x,src.mob.y-1,src.mob.z)
if(checkdense.density == 0)
src.mob.inair = 1
Gravity(src.mob)
return
South()
if(src.mob.inair == 1)
return

It just wont work! When I go to jump, it jumps up one time, and then just falls ALL the way to the ground going through solid objects, hence null.density
Try turning on debug mode and then telling us which line.
In response to N1ghtW1ng
mob
var
inair
proc
Gravity(var/mob/per)
if(per.dir == EAST)
if(per.inair == 1)
var/turf/check = locate(per.x,per.y-1,per.z)
if(check.density == 1) // <-- HERE
per.inair = 0
return
else
per.loc=locate(per.x,per.y-1,per.z)
sleep(2)
Gravity(per)
else
return 0
if(per.dir == WEST)
if(per.inair == 1)
var/turf/check = locate(per.x,per.y-1,per.z)
if(check.density == 1)
per.inair = 0
return
else
per.loc=locate(per.x,per.y-1,per.z)
sleep(2)
Gravity(per)
else
return 0
client
Northeast()
return
Northwest()
return
Southeast()
return
Southwest()
return
North()
if(src.mob.dir == EAST)
if(src.mob.inair == 0)
src.mob.inair = 1
for(var/i=1,i<4,i++)
src.Move(locate(src.mob.x,src.mob.y+1,src.mob.z),NORTH)
src.mob.dir = EAST
sleep(2)
Gravity(src.mob)
return
else
return
if(src.mob.dir == WEST)
if(src.mob.inair == 0)
src.mob.inair = 1
for(var/i=1,i<4,i++)
src.Move(locate(src.mob.x,src.mob.y+1,src.mob.z),NORTH)
src.mob.dir = WEST
sleep(2)
Gravity(src.mob)
return
else
return
East()
..()
if(src.mob.inair == 0)
var/turf/checkdense = locate(src.mob.x,src.mob.y-1,src.mob.z)
if(checkdense.density == 0)
src.mob.inair = 1
Gravity(src.mob)
return

West()
..()
if(src.mob.inair == 0)
var/turf/checkdense = locate(src.mob.x,src.mob.y-1,src.mob.z)
if(checkdense.density == 0)
src.mob.inair = 1
Gravity(src.mob)
return
South()
if(src.mob.inair == 1)
return
In response to Skye Reaver
Right before the if() put world << "[check]" . That will see if check is what you want it to be I think.
In response to N1ghtW1ng
Its something to do with the sky, here is the sky thingy, its SUPPOSED to be just a background, but i dunno
turf
Turfs
icon='Turfs.dmi'
layer=1
Sky
icon_state="Sky"
Cloud
icon_state="Cloud"
Cloud1
icon_state="Cloud1"
Cloud2
icon_state="Cloud2"
Bush1
icon_state="Bush1"
Bush
icon_state="Bush"
In response to N1ghtW1ng
It would probably be better to do if(check) and then the rest of his code if that really is the problem.