ID:143952
 
Problem description:

I'm making a game, its an RTS an u select a unit and click the icon on what to build, but I just put in a path finder and an error comes up each time I click build. Help

Error:
runtime error: Cannot read null.x
proc name: dd get dist (/proc/dd_get_dist)
usr: Poal (/mob)
src: null
call stack:
dd get dist(Snow (3,4,1) (/turf/Snow), null)
/BaseCamp/PathController (/BaseCamp/PathController): Path(10)
/BaseCamp/PathController (/BaseCamp/PathController): StepTowards(Build Center (/obj/hud/HUD/Build_Center), 0, 10)
Spartan (/mob/Spartan): base StepTowards(Build Center (/obj/hud/HUD/Build_Center), 0, 10)
Spartan (/mob/Spartan): base EventCycle(120)
GameController (/BaseCamp/GameController): EventCycle()
GameController (/BaseCamp/GameController): EventCycle()
GameController (/BaseCamp/GameController): EventCycle()
runtime error: Cannot read null.x
proc name: search (/BaseCamp/PathController/proc/_search)
usr: Poal (/mob)
src: /BaseCamp/PathController (/BaseCamp/PathController)
call stack:
/BaseCamp/PathController (/BaseCamp/PathController): search()
/BaseCamp/PathController (/BaseCamp/PathController): Path(10)
/BaseCamp/PathController (/BaseCamp/PathController): StepTowards(Build Center (/obj/hud/HUD/Build_Center), 0, 10)
Spartan (/mob/Spartan): base StepTowards(Build Center (/obj/hud/HUD/Build_Center), 0, 10)
Spartan (/mob/Spartan): base EventCycle(120)
GameController (/BaseCamp/GameController): EventCycle()
GameController (/BaseCamp/GameController): EventCycle()
GameController (/BaseCamp/GameController): EventCycle()
runtime error: Cannot read null.x
proc name: dd get dist (/proc/dd_get_dist)
usr: Poal (/mob)
src: null
call stack:
dd get dist(Spartan (/mob/Spartan), null)
/BaseCamp/PathController (/BaseCamp/PathController): StepTowards(Build Center (/obj/hud/HUD/Build_Center), 0, 10)
Spartan (/mob/Spartan): base StepTowards(Build Center (/obj/hud/HUD/Build_Center), 0, 10)
Spartan (/mob/Spartan): base EventCycle(120)
GameController (/BaseCamp/GameController): EventCycle()
GameController (/BaseCamp/GameController): EventCycle()
GameController (/BaseCamp/GameController): EventCycle()


What's it mean?
Well, the PathFinder routine works by determining a path to the clicked thing. Here, you clicked a HUD object and passed a null reference to dd get dist(), so it spits an error.

You're going to need to add some sort of check or state system that call the PathFinding procs only when appropriate.
Means you are sending an atom, which does not exist, through the procedure and you are trying to read its x value.
In response to Jmurph
Oh ty
In response to Poal
Oh and another problem, I have resource gathering and when I click the Cut Wood HUD icon, the selected unit goes to the FARTHEST tree on the map to cut it...How come?