Closed S7vie closed 1 year ago
Just a important notice that I modified the AIEngine
originally to my liking and this version that I will send over in the place will be the unedited version. I forgot to put this in the message.
GitHub should allow you to link urls or images.
Are you able to show the code?
I'll see when I have time
Ok I should be able to send it as the only main module was modified so I'll send whenever I can
@Sythivo Sorry if I took a while, here
Now the code is too big to fit in one picture so here :
function Movement:PathfindMoveTo(target_vector : Vector3) local AI = self.__ref::AI; self.__ref.PathfindingMovement = SimplePath.new(AI.Character, self.__ref.PathAgentParams); local Humanoid, RootPart = AI.Physical:GetHumanoidRoot(); if (Humanoid and RootPart and self.__ref.PathfindingMovement) then local NewPath = self.__ref.PathfindingMovement; local StopPathMovement = function() if (NewPath and NewPath._moveConnection) then NewPath:Stop(); end end if (not NewPath or NewPath.LastError == "ComputationError" or NewPath.LastError == "TargetUnreachable" or not Humanoid or not RootPart or Humanoid.Health <= 0) then self.__ref.OnMovementFinished:Fire(false); StopPathMovement(); if (FFlag.EngineDebuggingLevel >= 4) then print("[AIEngine(Pathfinding)] Error -> SimplePath failed"); end return; end self.__ref.PathfindingMovementConnection = NewPath.Reached:Connect(function() if (FFlag.EngineDebuggingLevel >= 4) then print(
[AI(Pathfinding)] AI Reached Position< {target_vector}); end StopPathMovement(); self.__ref.OnMovementFinished:Fire(true); if (typeof(self.__ref.PathfindingMovementConnection) == "RBXScriptConnection") then self.__ref.PathfindingMovementConnection:Disconnect(); end end); --// pcall function just incase local DestinationResult, PathError = pcall(function() NewPath:Run(target_vector); end); return DestinationResult, PathError; end return; end
I'm not too familiar with SimplePath
. I would not be able to help much on that module, You could check on their own documentation.
@Sythivo (it's me again lol)
Feature Implement
I haven't had any issues in a while but I wanted to implement a feature of my own and I did but I don't think I can call it a feature as it's just PathFinding to the Movement in Chase because it had no PathFinding and it can get stuck sometimes.
// The module I used for the PathFinding is ["
SimplePath
"] if you're aware of it.On a unserious topic I don't think I'd be surprised if it was because of a small un-noticed mistake I made so I'm sorry if it is the case as it happens to me a lot.
Issue(s)
The AI after stopping chasing the Player walks to the nearest Points over and over again If you don't understand, here's a example Let's say we have 3 RoamPoints and 2 of them are near each other but the last one is far away The AI just walks over to the 2 nearest RoamPoints in a infinite loop
Final
Overall the "feature" works decently except that as well as another bug; Chasing/NotChasing events firing while chasing (I know we fixed this back then but that was when I didn't add the
PathFinding Chase
, this only happens with my "feature" for some reason)The function I put is at line
350
or a bit below. (AIEngine Module)And I just realized that Github does not support any Roblox related files, just great Discord so I can send you the .RBXL testing place file over:
.0x7z20.