Here's a turret script I made using v1.16.18, stock code, and no mod.
It's not the best in the world but it should work. Whenever the player comes within sight the turret activates, and inflicts more attacks per second depending on how much damage it has taken.
;Artificial Intelligence Script
;Created by CrescentMoon, of Crescent Moon Productions
;Header
desc = Turret Fires at Player When Player is within a certain range
;Triggers
;Entry States
:state=0:state=1
;Loop Area (Scanner)
:state=1:timerstart,state=2
:state=2,timergreater=3000:rotatehead=45
:state=2,timergreater=6000:rotatehead=-90
:state=2,timergreater=9000:rotatehead=45,state=1
;Discovers Player
:state=2,plrcanbeseen:state=10
;Attack Mode
:state=10:rotatetoplr,timerstart,state=11
:state=11,plrcanbeseen:rotatetoplr,shootplr
:state=11,plrcanbeseen,timergreater=2000:rotatetoplr,shootplr
:state=11,plrcanbeseen,timergreater=4000:rotatetoplr,shootplr
:state=11,plrcanbeseen,timergreater=6000:rotatetoplr,shootplr
;Cool down and loop
:state=11,plrcanbeseen,timergreater=8000:sound=audiobank\atmos\steamhum.wav,state=10
;Player is no longer within sight
:state=11,plrcannotbeseen:state=1
;Attack Mode 2 (Extra attacks before cool down, rage mode)
;change shot damage to alter damage required to enter this mode
:state=11,plrcanbeseen,shotdamage=100,timergreater=1000:rotatetoplr,shootplr
:state=11,plrcanbeseen,shotdamage=100,timergreater=2000:rotatetoplr,shootplr
:state=11,plrcanbeseen,shotdamage=100,timergreater=5000:rotatetoplr,shootplr
:state=11,plrcanbeseen,shotdamage=100,timergreater=7000:rotatetoplr,shootplr
;End Script
I never quite figured out how to edit the properties of the turrets so that they could hold weapons, but if you can, do it.
[WIP] Paranorma Chapter 1, The Forgotten Inn
Level 1 - In Progress