Sythivo / AIEngine

A Roblox module
MIT License
8 stars 1 forks source link

[AIEngine] Custom Feature Implement and some AI roaming/chase issues #5

Closed S7vie closed 1 year ago

S7vie commented 1 year ago

@Sythivo (it's me again lol)

// 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.

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.

S7vie commented 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.

Sythivo commented 1 year ago

GitHub should allow you to link urls or images.

Are you able to show the code?

S7vie commented 1 year ago

I'll see when I have time

S7vie commented 1 year ago

Ok I should be able to send it as the only main module was modified so I'll send whenever I can

S7vie commented 1 year ago

@Sythivo Sorry if I took a while, here image

image

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

Sythivo commented 1 year ago

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.