Skip to content

pathfinding

AiTechEye edited this page Sep 8, 2018 · 4 revisions

All bots are using pathfinding whatevery they walks, as long the target aren't very near them This functions is returns a table of positions

default distance is set by self.distance

base.lua

example of how to create one

	if self.node_to_dig and self.path then
		aliveai.path(self)
	elseif self.node_to_dig and self.done=="path" and aliveai.distance(self,self.node_to_dig)<=self.arm then
		aliveai.dig(self,self.node_to_dig)
		self.example=nil
	end

	local path=aliveai.creatpath(self,pos1,pos2)
	if path then
		self.path=path
		self.node_to_dig=node_pos
		return self
	end
Function Description
aliveai.path(self) pathfinding, is using self.path
aliveai.exitpath(self) exit pathfinding and restores values
aliveai.creatpath(self,pos1,pos2,distance,notadvanced) createing a path, notadvanced skips other kinds of pathfinding
aliveai.createpathbyladder(self,pos1,pos2,distance) create a path on a ladder, is used by aliveai.creatpath
aliveai.createpathbytower(self,pos1,pos2) the bot will build a tower, is used by aliveai.creatpath
aliveai.createpathbybridge(self,pos1,pos2) the bot will build a bridge, is used by aliveai.creatpath
aliveai.neartarget(self,position,start_height,end_height,step_height) returns path to node, so the bot can reach them, eg ores on a wall. is using aliveai.creatpath
Clone this wiki locally