;Stranded - KI File
Function ki()
	Local x,y,z

	If e_fauna\visible=1
		
		ob_y=EntityY(ob_h)
		ob_yaw=EntityYaw(e_fauna\h)
		ob_typ=e_fauna\typ
		ob_timer=e_fauna\timer
		ob_mode=e_fauna\mode
		
		;Sterben
		If e_fauna\health<0 Then
			EntityColor ob_h, 255,100,100
			ob_mode=0
			TranslateEntity ob_h, 0,-0.15*speed,0
			If ob_typ=12 Then RotateEntity ob_h,-90,EntityYaw(ob_h),EntityRoll(ob_h):TurnEntity ob_h,0,0,-20*speed:TranslateEntity ob_h, 0,-4*speed,0
			TurnEntity ob_h, 0,+4*speed,0
			If ob_y<TerrainY(terrain, ob_x, ob_y, ob_z)-8 Then
				Select ob_typ
					Case 1 item_set(ob_x, ob_z, 6)
					Case 2 item_set(ob_x, ob_z, 19)
					Case 5 item_set(ob_x, ob_z, 6)
					Case 6 If tl_axt=0 Then tl_axt=1 : msg("Axt vom Kiffer Opa erhalten",0,3): PlaySound sfx_skill
					Case 9 item_set(ob_x, ob_z, 6)
					Case 12
						item_set(ob_x, ob_z, 19)
						PlaySound sfx_hitflesh
						For i=0 To 20
							effect_splatter(ob_x, ob_y+8.5, ob_z, Rnd(0.3,2), Rnd(-3,3),Rnd(1,3),Rnd(-3,3))
						Next
				End Select
				FreeEntity ob_h
				Delete e_fauna
				Return 0
			EndIf
		EndIf
		
					
		Select ob_typ
					
			;1 ----------------------------------------- Schildkröte
			Case 1	
				;Wellen?
				If ob_y<1.5 And timer_waves=0 Then
					effect_wave(ob_x,ob_z,1.1)
				EndIf																
				e_fauna\timer=ob_timer-1*speed
				Select ob_mode
					;Turn
					Case 1
						TurnEntity ob_h, 0,+1.5*speed,0
						If ob_timer<=0 Then e_fauna\mode=3 : e_fauna\timer=75 : Animate ob_h,1,1,0,1
					;Turn
					Case 2
						TurnEntity ob_h, 0,-1.5*speed,0
						If ob_timer<=0 Then e_fauna\mode=3 : e_fauna\timer=75 : Animate ob_h,1,1,0,1
					;Move
					Case 3
						MoveEntity ob_h, 0,0,-0.15*speed
						e_fauna\steps=e_fauna\steps+1*speed
						If e_fauna\steps>5 Then
							e_fauna\steps=0
							If ob_y<1.5 Then
								effect_wave(ob_x,ob_z,1.1)
							EndIf
						EndIf
						If ob_timer<=0 Then e_fauna\mode=0
					;Idle
					Case 4	
						If ob_timer<=0 Then e_fauna\mode=0
					;Turn to Targetdir
					Case 5
						If ob_yaw > e_fauna\targetyaw Then
							TurnEntity ob_h, 0,-1.5*speed,0	
							If ob_yaw-e_fauna\targetyaw<3.2 Then e_fauna\mode=3 : e_fauna\timer=150 : Animate ob_h,1,1,0,1
						Else
							TurnEntity ob_h, 0,+1.5*speed,0
							If e_fauna\targetyaw-ob_yaw<3.2 Then e_fauna\mode=3 : e_fauna\timer=150 : Animate ob_h,1,1,0,1
						EndIf
					;Default
					Default
						e_fauna\mode=Rand(1,4)
						Select	e_fauna\mode 
							Case 1 e_fauna\timer=60 : Animate ob_h,0
							Case 2 e_fauna\timer=60 : Animate ob_h,0
							Case 3 e_fauna\timer=75 : Animate ob_h,1,1,0,1
							Case 4 e_fauna\timer=Rnd(20,150) : Animate ob_h,0
							If ob_x<0 Then
								e_fauna\targetyaw=90
								e_fauna\mode=5 : Animate ob_h,0	
							ElseIf ob_x>15*msz
								e_fauna\targetyaw=-90
								e_fauna\mode=5 : Animate ob_h,0	
							ElseIf ob_z<0 Then
								e_fauna\targetyaw=-179
								e_fauna\mode=5 : Animate ob_h,0	
							ElseIf ob_z>15*msz Then
								e_fauna\targetyaw=0
								e_fauna\mode=5 : Animate ob_h,0	
							EndIf
						End Select
				End Select
					
				If e_fauna\health>=0 Then PositionEntity ob_h, EntityX(ob_h), TerrainY(terrain, EntityX(ob_h),0,EntityZ(ob_h))+0.7, EntityZ(ob_h)		
				
			
			
					
			;2 ----------------------------------------- Krebs
			Case 2	
				;Wellen?
				If ob_y<1.5 And timer_waves=0 Then
					effect_wave(ob_x,ob_z,0.3)
				EndIf																	
				e_fauna\timer=ob_timer-1*speed
				Select ob_mode
					;Turn
					Case 1
						TurnEntity ob_h, 0,+1.5*speed,0
						If ob_timer<=0 Then e_fauna\mode=3 : e_fauna\timer=150: Animate ob_h,1,1,0,1
					;Turn
					Case 2
						TurnEntity ob_h, 0,-1.5*speed,0
						If ob_timer<=0 Then e_fauna\mode=3 : e_fauna\timer=150 : Animate ob_h,1,1,0,1
					;Move
					Case 3
						MoveEntity ob_h, 0,0,-0.1*speed
						e_fauna\steps=e_fauna\steps+1*speed
						If e_fauna\steps>5 Then
							e_fauna\steps=0
							If ob_y<1.5 Then
								effect_wave(ob_x,ob_z,0.3)
							EndIf
						EndIf
						If ob_timer<=0 Then e_fauna\mode=0
					;Idle
					Case 4	
						If ob_timer<=0 Then e_fauna\mode=0
					;Turn to Targetdir
					Case 5
						If ob_yaw > e_fauna\targetyaw Then
							TurnEntity ob_h, 0,-1.5*speed,0	
							If ob_yaw-e_fauna\targetyaw<3.2 Then e_fauna\mode=3 : e_fauna\timer=150 : Animate ob_h,1,1,0,1
						Else
							TurnEntity ob_h, 0,+1.5*speed,0
							If e_fauna\targetyaw-ob_yaw<3.2 Then e_fauna\mode=3 : e_fauna\timer=150 : Animate ob_h,1,1,0,1
						EndIf
					;Default
					Default
						e_fauna\mode=Rand(1,4)
						Select	e_fauna\mode 
							Case 1 e_fauna\timer=60 : Animate ob_h,0
							Case 2 e_fauna\timer=60 : Animate ob_h,0
							Case 3 e_fauna\timer=150 : Animate ob_h,1,1,0,1
							Case 4 e_fauna\timer=Rnd(20,150) : Animate ob_h,0
							If ob_x<0 Then
								e_fauna\targetyaw=90
								e_fauna\mode=5 : Animate ob_h,0	
							ElseIf ob_x>15*msz
								e_fauna\targetyaw=-90
								e_fauna\mode=5 : Animate ob_h,0	
							ElseIf ob_z<0 Then
								e_fauna\targetyaw=-179
								e_fauna\mode=5 : Animate ob_h,0	
							ElseIf ob_z>15*msz Then
								e_fauna\targetyaw=0
								e_fauna\mode=5 : Animate ob_h,0	
							EndIf
						End Select
				End Select
				If e_fauna\health>=0 Then PositionEntity ob_h, EntityX(ob_h), TerrainY(terrain, EntityX(ob_h),0,EntityZ(ob_h))+0.3, EntityZ(ob_h)
				
				
				
				
				;3 ----------------------------------------- Giftpflanze
				Case 3
					e_fauna\timer=ob_timer-1*speed
					If ob_timer<=0 Then 
						e_fauna\timer=6
						If ob_mode=0 Then
							e_fauna\age=e_fauna\age+10
							If e_fauna\age>=200 Then e_fauna\mode=1
						Else
							e_fauna\age=e_fauna\age-10
							If e_fauna\age<=0 Then e_fauna\mode=0
						EndIf
						effect_puff(ob_x+Rnd(-1,1), ob_y+0.5, ob_z+Rnd(-1,1),Rnd(0.2,0.4),e_fauna\age,255,0,Rnd(0.3,0.7))
					EndIf
				
				
				
				
				;4 ----------------------------------------- Schmetterling
				Case 4
					e_fauna\timer=ob_timer-1*speed
					If pl_hi>500 Then
						If ob_x>camera_x# Then x=ob_x-camera_x# Else x=camera_x#-ob_x
						If ob_z>camera_z# Then z=ob_z-camera_z# Else z=camera_z#-ob_z
						If x>10 And z>10 Then
							PointEntity ob_h, pivot
							RotateEntity ob_h, 0,EntityYaw(ob_h)+180,0
							MoveEntity ob_h, 0,0,-0.5*speed
						EndIf
					EndIf
					MoveEntity ob_h, 0,0,-0.3*speed
					Select ob_mode
						;Turn
						Case 1
							TurnEntity ob_h, 0,+3*speed,0
							If ob_timer<=0 Then e_fauna\mode=0
						;Turn
						Case 2
							TurnEntity ob_h, 0,-3*speed,0
							If ob_timer<=0 Then e_fauna\mode=0
						;Turn to middle
						Case 3
							RotateEntity ob_h, 0, 0, 0
							e_fauna\mode=4
							e_fauna\timer=100
						;Idle
						Case 4
							If ob_timer<=0 Then e_fauna\mode=0
						;Default
						Default
							e_fauna\mode=Rand(1,2)
							e_fauna\timer=Rnd(5,30)
							If TerrainY(terrain, EntityX(ob_h), 0, EntityZ(ob_h))<3 Then
								e_fauna\mode=3
							EndIf
					End Select
				PositionEntity ob_h, EntityX(ob_h), TerrainY(terrain, EntityX(ob_h),0,EntityZ(ob_h))+8+e_fauna\steps, EntityZ(ob_h)
				
				
				
				
				;5 ----------------------------------------- Löwe
				Case 5															
					e_fauna\timer=ob_timer-1*speed
					If e_fauna\attack=0
						If ob_x>camera_x# Then x=ob_x-camera_x# Else x=camera_x#-ob_x
						If ob_z>camera_z# Then z=ob_z-camera_z# Else z=camera_z#-ob_z
						If ob_y>camera_y# Then y=ob_y-camera_y# Else y=camera_y#-ob_y
						If x<=50 And z<=50 And y<=12 And TerrainY(terrain, ob_x,0,ob_z)>2 Then
							e_fauna\attack=1
							e_fauna\mode=4
							ob_mode=4
							Animate ob_h,1,1,0,1
							e_fauna\timer=100
							PlaySound sfx_lion_spot
						EndIf	
					EndIf
					Select ob_mode
						;Move
						Case 1
							e_fauna\attack=0
							MoveEntity ob_h, 0,0,-0.7*speed
							e_fauna\steps=e_fauna\steps+1*speed
							If e_fauna\steps>8 Then
								e_fauna\steps=0
							EndIf
							If ob_timer<=0 Then
								e_fauna\mode=0
							EndIf
							Select e_fauna\turnmode
								Case 1 TurnEntity ob_h, 0,+3*speed,0
								Case 2 TurnEntity ob_h, 0,-3*speed,0
							End Select
						;Idle
						Case 2
							Animate ob_h,0
							If e_fauna\attack=1 Then
								PointEntity ob_h, pivot
								RotateEntity ob_h, 0,EntityYaw(ob_h)+180,0
							EndIf
							If ob_timer<=0 Then
								e_fauna\mode=0
								If e_fauna\attack=1 Then
									e_fauna\mode=4
									Animate ob_h,1,1,0,1
									e_fauna\timer=3500
								EndIf
							EndIf
						;Turn to Targetdir
						Case 3
							If ob_yaw > e_fauna\targetyaw Then
								TurnEntity ob_h, 0,-8*speed,0	
								If ob_yaw-e_fauna\targetyaw<16.2 Then e_fauna\mode=1 : e_fauna\turnmode=0 : e_fauna\timer=150 : Animate ob_h,1,1,0,1
							Else
								TurnEntity ob_h, 0,+8*speed,0
								If e_fauna\targetyaw-ob_yaw<16.2 Then e_fauna\mode=1 : e_fauna\turnmode=0 : e_fauna\timer=150 : Animate ob_h,1,1,0,1
							EndIf
						;Attackmode
						Case 4
							e_fauna\timer=e_fauna\timer+2
							If ob_x>camera_x# Then x=ob_x-camera_x# Else x=camera_x#-ob_x
							If ob_z>camera_z# Then z=ob_z-camera_z# Else z=camera_z#-ob_z
							If ob_y>camera_y# Then y=ob_y-camera_y# Else y=camera_y#-ob_y
							If x<=12 And z<=12 Then
								If y<=12 Then
									PlaySound sfx_lion_attack
									e_fauna\mode=2
									e_fauna\timer=20
									hurt(Rnd(3,5))
								Else
									e_fauna\mode=1
									e_fauna\turnmode=Rand(1,2)
									e_fauna\timer=50
								EndIf
							Else
								PointEntity ob_h, pivot
								RotateEntity ob_h, 0,EntityYaw(ob_h)+180,0
								MoveEntity ob_h, 0,0,-1.0*speed
								If x>=60 And y>=60 Then
									e_fauna\mode=1
									e_fauna\turnmode=Rand(1,2)
									e_fauna\timer=30
								ElseIf TerrainY(terrain, ob_x,0,ob_z)<2 Then
									e_fauna\mode=1
									e_fauna\turnmode=Rand(1,2)
									e_fauna\timer=30
								EndIf
							EndIf
						;Default
						Default
							e_fauna\mode=Rand(1,2)
							Select	e_fauna\mode 
								Case 1 e_fauna\timer=Rand(50,150) : Animate ob_h,1,1,0,1 : e_fauna\turnmode=Rand(0,3)
								Case 2 e_fauna\timer=Rand(20,60)
								If ob_x<15*10 Then
									e_fauna\targetyaw=90
									e_fauna\mode=3 : Animate ob_h,0	
								ElseIf ob_x>15*(msz-10)
									e_fauna\targetyaw=-90
									e_fauna\mode=3 : Animate ob_h,0	
								ElseIf ob_z<15*10 Then
									e_fauna\targetyaw=-179
									e_fauna\mode=3 : Animate ob_h,0	
								ElseIf ob_z>15*(msz-10) Then
									e_fauna\targetyaw=0
									e_fauna\mode=3 : Animate ob_h,0	
								EndIf
							End Select
					End Select
					If e_fauna\health>=0 Then PositionEntity ob_h, EntityX(ob_h), TerrainY(terrain, EntityX(ob_h),0,EntityZ(ob_h)), EntityZ(ob_h)




				;6 ----------------------------------------- Kiffa-Opa
				Case 6
					e_fauna\timer=ob_timer-1*speed
					Select ob_mode
						;Move
						Case 1
							MoveEntity ob_h, 0,0,-0.2*speed
							e_fauna\steps=e_fauna\steps+1*speed
							If e_fauna\steps>8 Then
								e_fauna\steps=0
							EndIf
							If ob_timer<=0 Then e_fauna\mode=0
							Select e_fauna\turnmode
								Case 1 TurnEntity ob_h, 0,+3*speed,0
								Case 2 TurnEntity ob_h, 0,-3*speed,0
							End Select
						;Idle
						Case 2	
							If ob_timer<=0 Then e_fauna\mode=0
							Animate ob_h,0
						;Default
						Default
							e_fauna\mode=Rand(1,4)
							Select	e_fauna\mode 
								Case 1 e_fauna\timer=Rnd(20,70) : Animate ob_h,1,1,0,1 : e_fauna\turnmode=Rand(0,3)
								Case 2 e_fauna\timer=Rnd(20,60)
							End Select
					End Select
					If e_fauna\health>=0 Then PositionEntity ob_h, EntityX(ob_h), TerrainY(terrain, EntityX(ob_h),0,EntityZ(ob_h)), EntityZ(ob_h)
					If ob_x>camera_x# Then x=ob_x-camera_x# Else x=camera_x#-ob_x
					If ob_z>camera_z# Then z=ob_z-camera_z# Else z=camera_z#-ob_z
					If x<=20 And z<=20 Then
						pl_trade=1
					EndIf
				
					
				;8 ----------------------------------------- Kiwi
				Case 8
					rescue=0
					e_fauna\timer=ob_timer-1*speed
					Select ob_mode
						;Move
						Case 1
							MoveEntity ob_h, 0,0,-0.9*speed
							If ob_timer<=0 Then
								e_fauna\mode=0
								For building.building = Each building
									If building\typ = 12
										x=EntityX(building\h1)
										If ob_x>x Then x=ob_x-x Else x=x-ob_x
										If x<20 Then
											z=EntityZ(building\h1)
											If ob_z>z Then z=ob_z-z Else z=z-ob_z
											If z<20 Then
												msg("Kiwi gerettet!",1,1)
												rescue=1
												Exit
											EndIf
										EndIf
									EndIf
								Next
							EndIf
						;Idle
						Case 0
							If ob_x>camera_x# Then x=ob_x-camera_x# Else x=camera_x#-ob_x
							If ob_z>camera_z# Then z=ob_z-camera_z# Else z=camera_z#-ob_z
							If ob_y>camera_y# Then y=ob_y-camera_y# Else y=camera_y#-ob_y
							If y<=10 Then
								If x<=17 And z<=17 Then
									e_fauna\mode=1
									e_fauna\timer=15
									PointEntity ob_h, pivot
									RotateEntity ob_h, 0,EntityYaw(ob_h),0
									If Rand(3)=1 Then PlaySound sfx_kiwi
								Else
									If Rand(10)=1 Then e_fauna\turnmode=Rand(0,2)
										Select e_fauna\turnmode
											Case 1 TurnEntity ob_h, 0,+3*speed,0
											Case 2 TurnEntity ob_h, 0,-3*speed,0
										End Select
									If Rand(30)=1 Then
										e_fauna\mode=1
										e_fauna\timer=Rand(1,3)
									EndIf
								EndIf
							EndIf
					End Select
					If e_fauna\health>=0 Then
						If e_fauna\timer<0 Then
							PositionEntity ob_h, EntityX(ob_h), TerrainY(terrain, EntityX(ob_h),0,EntityZ(ob_h)), EntityZ(ob_h)
						ElseIf e_fauna\timer Mod 2 Then
							PositionEntity ob_h, EntityX(ob_h), TerrainY(terrain, EntityX(ob_h)+4,0,EntityZ(ob_h)), EntityZ(ob_h)
						Else
							PositionEntity ob_h, EntityX(ob_h), TerrainY(terrain, EntityX(ob_h),0,EntityZ(ob_h)), EntityZ(ob_h)
						EndIf
						If TerrainY(terrain, EntityX(ob_h),0,EntityZ(ob_h))<1 Then e_fauna\health=-1
					EndIf
									
					If rescue=1 Then
						FreeEntity ob_h
						Delete e_fauna
						gm_kiwis=gm_kiwis+1
						For i=0 To 50
							effect_splatter(ob_x,ob_y,ob_z,Rnd(0.3,2),Rnd(-2,2),Rnd(1,3),Rnd(-2,2),80,255,80,1)
						Next
					EndIf
				
				
				;9 ----------------------------------------- Raptor
				Case 9															
					e_fauna\timer=ob_timer-1
					If e_fauna\attack=0
						If ob_x>camera_x# Then x=ob_x-camera_x# Else x=camera_x#-ob_x
						If ob_z>camera_z# Then z=ob_z-camera_z# Else z=camera_z#-ob_z
						If ob_y>camera_y# Then y=ob_y-camera_y# Else y=camera_y#-ob_y
						If x<=75 And z<=75 And y<=12 And TerrainY(terrain, ob_x,0,ob_z)>2 Then
							e_fauna\attack=1
							e_fauna\mode=4
							ob_mode=4
							Animate ob_h,1,1,0,1
							e_fauna\timer=100
							PlaySound sfx_raptor_spot
						EndIf	
					EndIf
					Select ob_mode
						;Move
						Case 1
							e_fauna\attack=0
							MoveEntity ob_h, 0,0,-0.9*speed
							e_fauna\steps=e_fauna\steps+1*speed
							If e_fauna\steps>8 Then
								e_fauna\steps=0
							EndIf
							If ob_timer<=0 Then
								e_fauna\mode=0
							EndIf
							Select e_fauna\turnmode
								Case 1 TurnEntity ob_h, 0,+3*speed,0
								Case 2 TurnEntity ob_h, 0,-3*speed,0
							End Select
						;Idle
						Case 2
							Animate ob_h,0
							If e_fauna\attack=1 Then
								PointEntity ob_h, pivot
								RotateEntity ob_h, 0,EntityYaw(ob_h)+180,0
							EndIf
							If ob_timer<=0 Then
								e_fauna\mode=0
								If e_fauna\attack=1 Then
									e_fauna\mode=4
									Animate ob_h,1,1,0,1
									e_fauna\timer=3500
								EndIf
							EndIf
						;Turn to Targetdir
						Case 3
							If ob_yaw > e_fauna\targetyaw Then
								TurnEntity ob_h, 0,-8*speed,0	
								If ob_yaw-e_fauna\targetyaw<16.2 Then e_fauna\mode=1 : e_fauna\turnmode=0 : e_fauna\timer=150 : Animate ob_h,1,1,0,1
							Else
								TurnEntity ob_h, 0,+8*speed,0
								If e_fauna\targetyaw-ob_yaw<16.2 Then e_fauna\mode=1 : e_fauna\turnmode=0 : e_fauna\timer=150 : Animate ob_h,1,1,0,1
							EndIf
						;Attackmode
						Case 4
							e_fauna\timer=e_fauna\timer+2
							If ob_x>camera_x# Then x=ob_x-camera_x# Else x=camera_x#-ob_x
							If ob_z>camera_z# Then z=ob_z-camera_z# Else z=camera_z#-ob_z
							If ob_y>camera_y# Then y=ob_y-camera_y# Else y=camera_y#-ob_y
							If x<=12 And z<=12 Then
								If y<=12 Then
									e_fauna\mode=2
									e_fauna\timer=20
									hurt(Rnd(5,10))
									PlaySound sfx_raptor_attack
								Else
									e_fauna\mode=1
									e_fauna\turnmode=Rand(1,2)
									e_fauna\timer=50
								EndIf
							Else
								PointEntity ob_h, pivot
								RotateEntity ob_h, 0,EntityYaw(ob_h)+180,0
								MoveEntity ob_h, 0,0,-1.7*speed
								If x>=60 And y>=60 Then
									e_fauna\mode=1
									e_fauna\turnmode=Rand(1,2)
									e_fauna\timer=30
								ElseIf TerrainY(terrain, ob_x,0,ob_z)<2 Then
									e_fauna\mode=1
									e_fauna\turnmode=Rand(1,2)
									e_fauna\timer=30
								EndIf
							EndIf
						;Default
						Default
							e_fauna\mode=Rand(1,2)
							Select	e_fauna\mode 
								Case 1 e_fauna\timer=Rand(50,150) : Animate ob_h,1,1,0,1 : e_fauna\turnmode=Rand(0,3)
								Case 2 e_fauna\timer=Rand(20,60)
								If ob_x<15*10 Then
									e_fauna\targetyaw=90
									e_fauna\mode=3 : Animate ob_h,0	
								ElseIf ob_x>15*(msz-10)
									e_fauna\targetyaw=-90
									e_fauna\mode=3 : Animate ob_h,0	
								ElseIf ob_z<15*10 Then
									e_fauna\targetyaw=-179
									e_fauna\mode=3 : Animate ob_h,0	
								ElseIf ob_z>15*(msz-10) Then
									e_fauna\targetyaw=0
									e_fauna\mode=3 : Animate ob_h,0	
								EndIf
							End Select
					End Select
					If e_fauna\health>=0 Then PositionEntity ob_h, EntityX(ob_h), TerrainY(terrain, EntityX(ob_h),0,EntityZ(ob_h))+2.2, EntityZ(ob_h)
				
				;10 ----------------------------------------- Soldier
				Case 10
					If e_fauna\health>0 Then														
						e_fauna\timer=ob_timer-1*speed
						If e_fauna\timer<=0 Then
						 	e_fauna\timer=20
							If ob_x>camera_x# Then x=ob_x-camera_x# Else x=camera_x#-ob_x
							If ob_z>camera_z# Then z=ob_z-camera_z# Else z=camera_z#-ob_z
							If ob_y>camera_y# Then y=ob_y-camera_y# Else y=camera_y#-ob_y
							If Abs(DeltaYaw(ob_h,pivot))>110 And EntityVisible(ob_h,pivot) And EntityDistance(ob_h,pivot)<100 Then
								PlaySound sfx_pistol
								hurt(Rand(5,10))
								e_fauna\attack=1
								x=EntityX(ob_h)
								z=EntityZ(ob_h)
								x=x+(Cos(EntityYaw(ob_h)-90)*5)
								z=z+(Sin(EntityYaw(ob_h)-90)*5)
								effect_puff(x,EntityY(ob_h)+7,z,2,150,150,150,0.5,0.09)
							Else
								e_fauna\attack=0
							EndIf
						EndIf
						
						If e_fauna\attack=1 Then
							PointEntity ob_h, pivot
							RotateEntity ob_h, 0,EntityYaw(ob_h)+180,0
						EndIf
					EndIf
					
				;11 ------------------------------------------ Eingeborener
				Case 11
					e_fauna\timer=ob_timer-1*speed
					Select ob_mode
						;Move
						Case 1
							MoveEntity ob_h, 0,0,-0.4*speed
							e_fauna\steps=e_fauna\steps+1*speed
							If e_fauna\steps>8 Then
								e_fauna\steps=0
							EndIf
							If ob_timer<=0 Then e_fauna\mode=0
							Select e_fauna\turnmode
								Case 1 TurnEntity ob_h, 0,+3*speed,0
								Case 2 TurnEntity ob_h, 0,-3*speed,0
							End Select
						;Idle
						Case 2	
							If ob_timer<=0 Then e_fauna\mode=0
							Animate ob_h,0
						;Default
						Default
							e_fauna\mode=Rand(1,5)
							Select	e_fauna\mode 
								Case 1 e_fauna\timer=Rnd(10,40) : Animate ob_h,1,1,0,1 : e_fauna\turnmode=Rand(0,3)
								Case 2 e_fauna\timer=Rnd(20,80)
							End Select
					End Select
					If e_fauna\health>=0 Then PositionEntity ob_h, EntityX(ob_h), TerrainY(terrain, EntityX(ob_h),0,EntityZ(ob_h)), EntityZ(ob_h)
					If ob_x>camera_x# Then x=ob_x-camera_x# Else x=camera_x#-ob_x
					If ob_z>camera_z# Then z=ob_z-camera_z# Else z=camera_z#-ob_z
					If x<=20 And z<=20 Then
						pl_train=1
					EndIf
					
				;12 ----------------------------------------- Vogel
				Case 12
					If e_fauna\health>0 Then
						MoveEntity ob_h, 0,0,-2*speed
						TurnEntity ob_h, 0,1*speed,0
					EndIf
				
				;13 ------------------------------------------ Pirat!
				Case 13
					e_fauna\timer=ob_timer-1*speed
					Select ob_mode
						;Move
						Case 1
							MoveEntity ob_h, 0,0,-0.4*speed
							e_fauna\steps=e_fauna\steps+1*speed
							If e_fauna\steps>8 Then
								e_fauna\steps=0
							EndIf
							If ob_timer<=0 Then e_fauna\mode=0
							Select e_fauna\turnmode
								Case 1 TurnEntity ob_h, 0,+3*speed,0
								Case 2 TurnEntity ob_h, 0,-3*speed,0
							End Select
						;Idle
						Case 2	
							If ob_timer<=0 Then e_fauna\mode=0
							Animate ob_h,0
						;Default
						Default
							e_fauna\mode=Rand(1,5)
							Select	e_fauna\mode 
								Case 1 e_fauna\timer=Rnd(10,40) : Animate ob_h,1,1,0,1 : e_fauna\turnmode=Rand(0,3)
								Case 2 e_fauna\timer=Rnd(20,80)
							End Select
					End Select
					If e_fauna\health>=0 Then PositionEntity ob_h, EntityX(ob_h), TerrainY(terrain, EntityX(ob_h),0,EntityZ(ob_h)), EntityZ(ob_h)
					If ob_x>camera_x# Then x=ob_x-camera_x# Else x=camera_x#-ob_x
					If ob_z>camera_z# Then z=ob_z-camera_z# Else z=camera_z#-ob_z
					If x<=20 And z<=20 Then
						pl_pirate=1
					EndIf
					
					;14 ------------------------------------------ Prof
				Case 14
					e_fauna\timer=ob_timer-1*speed
					Select ob_mode
						;Move
						Case 1
							MoveEntity ob_h, 0,0,-0.4*speed
							e_fauna\steps=e_fauna\steps+1*speed
							If e_fauna\steps>8 Then
								e_fauna\steps=0
							EndIf
							If ob_timer<=0 Then e_fauna\mode=0
							Select e_fauna\turnmode
								Case 1 TurnEntity ob_h, 0,+3*speed,0
								Case 2 TurnEntity ob_h, 0,-3*speed,0
							End Select
						;Idle
						Case 2	
							If ob_timer<=0 Then e_fauna\mode=0
							Animate ob_h,0
						;Default
						Default
							e_fauna\mode=Rand(1,5)
							Select	e_fauna\mode 
								Case 1 e_fauna\timer=Rnd(10,40) : Animate ob_h,1,1,0,1 : e_fauna\turnmode=Rand(0,3)
								Case 2 e_fauna\timer=Rnd(20,80)
							End Select
					End Select
					If e_fauna\health>=0 Then PositionEntity ob_h, EntityX(ob_h), TerrainY(terrain, EntityX(ob_h),0,EntityZ(ob_h)), EntityZ(ob_h)
					If ob_x>camera_x# Then x=ob_x-camera_x# Else x=camera_x#-ob_x
					If ob_z>camera_z# Then z=ob_z-camera_z# Else z=camera_z#-ob_z
					If x<=20 And z<=20 Then
						pl_prof=1
					EndIf

					
			End Select
	EndIf
End Function