How can you add real time, Dynamic Waypoints? like lets say I drop a chest during the game, players know where the chest is dropped so I want the AI to go there also…
then to what is the syntax to remove the chest from the AI table so if the chest is opened, it will not go there any more?
Interesting. The Dynamic Waypoints feature is handled by the main AI script. The script adds a Dynamic Waypoint whenever an action is made.
The current actions are;
AI Heard a player
AI Saw a player
AI Killed a player
AI Stopped chasing a player
The dynamic waypoint adder function is
function Components.GenerateDynamicPoint(position : Vector3)
This function also automatically optimizes dynamic waypoints by merging them into one waypoint to prevent clumps
Now if you want to add a Dynamic Waypoint when a chest is opened, there is another feature my AI has, which is Custom Mechanisms which enables you to add custom mechanics to the main AI
for example you want to detect whenever a chest is opened:
-- This is an example of a custom mechanism script structure (similar to AIENGINE by
-- Sythivo, make sure to research about that!
-- We will run the mechanism on start
-- ai.MechanismsSource script:
local MechanismHandler = require(script.Parent.Parent.Components["ai.MechanismHandler"])
MechanismHandler.runOnStartUp("ChestDetector")
-- ChestDetector mechanism script:
local Components = require(script.Parent.Parent.Components["ai.Components"]
return function()
chest.Opened:Connect(function()
Components.GenerateDynamicWaypoint(chest.Position)
end)
end
Now this is just a sample script
The generate dynamic waypoint function automatically removes dynamic waypoints in a configurable matter of seconds
DYNAMICWAYPOINTS = {
enabled = true,
lifeTime = 45,
listenTo = {
heardPlayer = true,
sawPlayer = true,
killedPlayer = true,
stopChased = true,
},
optimiation = { --ignore the misspelling
distance = 60,
startingNumber = 5,
}
},
1 Like