Need help making mercenary system for my horror game inspired by Isle

Hi,
I’m currently working on a mercenary system for my horror game inspired by isle.

I’d like to know how I will be able to script this system, and the skills required needed for create this system.

This is how the system works:
The mercenaries will spawn somewhere around the map, they will start wandering around the map searching for players to execute on sight.

So what skills would I need to create this system? If you want to, please provide with any tips to help with the whole mercenary system.

if these locations are preset (but chosen randomly):

local wanderParts = {
-- array of parts
}

local randomPart = math.random(1, #wanderParts)
local pathToWanderTo = wanderParts[randomPart]

-- pathfind towards it

since you want to do sight, you could raycast from the mercenary’s head in a “cone” like shape that has a specific range

idrk how to code something like this, but in a nutshell:

-- all of this should be considered as "pseudocode" and shouldn't be expected to work
local coneRadius = 90

for i = 1, #coneRadius do
   local direction = -- calculate the current angle, idk how to do this
   local distance = direction * -- any distance you want

   local lineOfSight = workspace:Raycast(head.Position, distance, raycastParams)
   if not lineOfSight then continue end
   
   -- write code here

   
end