It didn't work very well because the bears would get stuck replaying the same attacking animation if the player moved out of the way before the animation was over. They also got stuck when shot. Therefore, I modified the script to make it work better. I thought I should share the script with my modifications.
Here it is (all credit goes to GamerX):
;AI Intellegence
; GAMER X
desc = Melee Follow and Attack
;Triggers
:random=20,plrhealthless=450:state=3
:random=30:none
:state=0,plrdistwithin=500:state=1
:state=1,plrdistfurther=90:rotatetoplr,movefore=2,animate=2,plrdisable=0
:state=1,plrdistfurther=500:animate=1,state=0
:state=1,plrdistwithin=90,rateoffire:rotatetoplr,animate=6,state=2
:state=2,animationover=6,plrdistwithin=100:plraddhealth=-30,sound=audiobank\misc\melee.wav,state=1
:state=2,animationover=6,plrdistwithin=100:plraddhealth=-30,sound=audiobank\misc\melee.wav,state=1
:state=2,animationover=6,plrdistfurther=100:state=0
:state=2,plrcannotbeseen:rotatetoplr
:state=3,plrdistwithin=80,rateoffire:rotatetoplr,plrdisable=1000,animate=95,state=4
:state=4,animationover=95,plrdistwithin=100:plraddhealth=-500,sound=audiobank\misc\melee.wav,state=0
:state=4,animationover=95,plrdistfurther=100:state=0
;END SCRIPT
Don't waste your life