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?
You're going to need to add some sort of check or state system that call the PathFinding procs only when appropriate.