try this i tested it and it works, i used an ss sniper from default ww2 pack, a default unarmed wehrmacht officer from same pack, the sniper did the shooting and the wehrmacht unarmed was the target so you can test with stock media, simply place the two entities in the level and press the 'í' key, you can change the trigger to whatever you want.
;Artificial Intelligence Script
;Header
desc = Zone Activate if any 'key object' enters it
;Triggers
:state=0,scancodekeypressed=23:settargetname=wehrmacht (unarmed),etimerstart,state=1
:state=1,etimergreater=1000:rotatetotarget,state=2
:state=2,etimergreater=2000:useweapon,state=3
:state=3,etimergreater=3000:reloadweapon,etimerstart,state=1
;End of Script
but whatevers breaking your script ISNT the settarget, rotatetotarget, they work just fine.
Hope it helps, just add whatever other code you need to it, instead of monitoring frameatend and random variables i just put one second delays between the actions to give the animation time to play out naturally.
Have fun
smoke em if you got em