--		Distance = 10

	end -- Player died.


	if Logic == 0 then  -- Defalt logic

		target = findNearestTorso(torsoPos)    ---  target is some Player. FindNearest and get xdir, ydir.
	
		if target ~= nil then 
			targ = target
	--		if ClimbingLadder and Distance >= 1 then
	--			targpos = torsoPos + AItorso.CFrame.lookVector * 9
	--		else
				targpos = target.Position
	--		end

			if Distance < 1 and (torsoPos - targpos).magnitude > 4 then  --  Check if we are stuck.
				GetDir()
					OldX = Xdir  -- Goal direction.
					OldZ = Zdir

				Logic  = 1 -- Impeded

			else
				if FireAtPlayer() then  -- hit

					GetDir()
					OldX = Xdir  -- Goal direction.
					OldZ = Zdir

					if FireDag() then
						Logic = 1 -- Go Left; Look Right.
						ClimbingLadder = true  -- first time thru logic 1 indicator
					else
						targpos = torsoPos + Vector3.new(Xdag,0,Zdag)  -- go Right

					end -- dagRight
				end -- hit?
			end -- impeded?
		else
print(AIName, number, ": No target. - ", target)