Heyyyyyyyyy so I’m making a game which revolves around a lot of PvE against Zombie type enemies.
I’m attempting to make a rather interesting AI for said Zombies which allows them to perform plenty of different tasks other than simply running around and hitting people. One of these tasks would be wall climbing walls. I am attempting to solve this by creating a truss on the wall required to climb a surface in order to be able to reach the destination (like an elevated surface the Zombie wouldn’t normally be able to reach). However I seem to be unable to make the NPC calculate a path with a truss present no matter what I try.
The NPC Attempts to look in the direction of the goal destination if a path to it is not found and create a truss allowing it to perhaps reach the destination. However after the creation of the truss the Path is still failing to be computed and the NPC repeats the attempt to create a new truss over and over even though a path should theoretically be possible now that trusses are supported by pathfinding.
I have tried creating a path with a pre-existing truss as well, which has a PathfindingLink in it too which also results in a failure and the NPC spawns more trusses on top.
Relevant code:
local PathInfo = {
AgentHeight = 4,
AgentRadius = 4,
AgentCanJump = true,
AgentCanClimb = true,
WaypointSpacing = 2,
Costs = {
Climb = 1
}
}
function WalkPath(Destination)
Active.Value = true --temporary
local ReachedConnection
local NextWaypointIndex
local success, errorMessage = pcall(function()
Path:ComputeAsync(HRP.Position, Destination)
end)
if success and Path.Status == Enum.PathStatus.Success then
local Waypoints = Path:GetWaypoints()
local BlockedConnection
if not ReachedConnection then
ReachedConnection = Humanoid.MoveToFinished:Connect(function(reached)
if reached and NextWaypointIndex < #Waypoints then
-- Increase waypoint index and move to next waypoint
NextWaypointIndex += 1
Humanoid:MoveTo(Waypoints[NextWaypointIndex].Position)
if Waypoints[NextWaypointIndex].Action == Enum.PathWaypointAction.Jump then
local SpeedBoost = Essentials.createvalue(Body, "SpeedAlter", 0.15)
SpeedBoost.Value = 16
Humanoid.Jump = true
end
else
ReachedConnection:Disconnect()
end
end)
end
NextWaypointIndex = 2
Humanoid:MoveTo(Waypoints[NextWaypointIndex].Position)
end
if Path.Status == Enum.PathStatus.NoPath then
Humanoid:MoveTo(HRP.Position)
local Turn = Essentials.tween(HRP, {CFrame = CFrame.new(HRP.Position, Vector3.new(Destination.X,HRP.Position.Y,Destination.Z))},0.5)
Turn:Play()
Turn.Completed:Wait()
Climb()
print("helppppppppppppppppppppppp")
WalkPath(Destination)
end
end
Stuff to note:
AgentCanClimb is indeed on
I have tried different Agent Sizes, the result remains unchanged
I have tried different WaypointSpacing, the result remains unchanged
I have tried changing the Climb cost around, the results remains unchanged
I wish to figure out why exactly my NPC is unable to pathfind when a truss is involved.