Граждане!у меня есть одна функция, которая сильно грузит игру, помогите пожалуйста её оптимизировать!Если можно, выложите свю версию, заранее спасибо!

Function update_friz()
For i = 1 To num
If abc(i)\times=0
If (abc(i)\count%=1) Then
Animate abc(i)\friz,1,0.2,1
abc(i)\count%=0
EndIf
If (abc(i)\count=2) Then
Animate abc(i)\friz,3,0.4,5
pointer(abc(i)\friz,user)
abc(i)\count=0
EndIf
If (abc(i)\count=3) And (health>health_die) Then
pointer(abc(i)\friz,user)
If AnimTime(abc(i)\friz)>13 Then
If health>health_die Animate abc(i)\friz,1,0.4,6
EndIf
If abc(i)\times2%=5 Then create_shot_f(EntityX(abc(i)\frizbox),EntityY(abc(i)\frizbox)+1,EntityZ(abc(i)\frizbox)):EmitSound sound10,abc(i)\friz:abc(i)\count_bull%=abc(i)\count_bull%-1:abc(i)\times2%=20
abc(i)\times2%=abc(i)\times2%-1
If abc(i)\count_bull=0 Then
If AnimTime(abc(i)\friz)>7 Then
EmitSound sound8,abc(i)\friz
Animate abc(i)\friz,1,0.4,10
abc(i)\count_bull%=8
EndIf
EndIf
EndIf
EndIf
If abc(i)\count=4 Then
SeedRnd(MilliSecs())
x1=Rnd(1,4)
If x1=1 Then EmitSound sound2,abc(i)\friz
If x1=2 Then EmitSound sound3,abc(i)\friz
If x1=3 Then EmitSound sound4,abc(i)\friz
If x1=4 Then EmitSound sound5,abc(i)\friz
EntityType abc(i)\frizbox,friz_d_type
SeedRnd(MilliSecs())
Animate abc(i)\friz,3,0.4,Rnd(11,13)
abc(i)\count%=100
abc(i)\times=abc(i)\times+1
EndIf
If (abc(i)\count=5) And (abc(i)\times%=0) Then
U#=360
pointer(abc(i)\friz,user)
abc(i)\times1%=abc(i)\times1%+1
If (180 - Abs(-DeltaYaw(abc(i)\frizbox,user))) < U# And EntityDistance(abc(i)\friz,user)<50 And EntityVisible(abc(i)\frizbox,user) And (abc(i)\times=0) Then
If AnimTime(abc(i)\friz)>30 Then
SeedRnd(MilliSecs())
x=Rnd(1,2)
If x=1 Then EmitSound sound7,abc(i)\friz Else EmitSound sound6,abc(i)\friz
Animate abc(i)\friz,3,0.5,5
EndIf
EndIf
EndIf
If (180 - Abs(-DeltaYaw(abc(i)\frizbox,user))) < U# And EntityDistance(abc(i)\friz,user)<20 And EntityVisible(abc(i)\frizbox,user) And (abc(i)\times=0) Then
abc(i)\count=5
If abc(i)\times1%>170 Then abc(i)\count=3
EndIf
Next
End Function