Jump to content


Photo

AI wander behaviour


  • Please log in to reply
2 replies to this topic

#1 jimiojoe

jimiojoe

    War Mungerer

  • Project Team
  • 491 posts
  • Projects:X-Mod, The Harry Potter Modification
  •  Advice

Posted 03 February 2008 - 02:57 PM

heyhoo

i have a bird unit that i'm having problems with
its a simple unit with decent vision that flies about =)

but i want it to move about on its own wandering about everywhere using the AnimalAiUpdate which does what i want it to
buttt
because they are flying units
when they get to the edge of maps....
they keep going
=( and are lost forever!

anybody know any ways around this


alsoooo
this is probably a silly problem but i enemies wont attack the unit =( can't see what im doing wrong there either

;------------------------------------------------------------------------------
; Dove
Object Dove_white_in_game		  
 ; *** ART Parameters ***

  Draw = W3DScriptedModelDraw ModuleTag_01
 	  OkToChangeModelColor = Yes
		RandomTexture = CUBird02.TGA 0 CUBird01.tga
		RandomTexture = CUOwl1.tga 0 CUBird01.tga
		RandomTexture = CUOwl2.tga 0 CUBird01.tga
		RandomTexture = CUOwl3.tga 0 CUBird01.tga

   DefaultModelConditionState
	  Model			   = CUBird_flya
	End
	IdleAnimationState
	  Animation = Idle
		AnimationName	   = CUBird_flya.CUBird_flya
		AnimationMode	   = ONCE
	  End
	End
	AnimationState		= MOVING
	  Animation = Moving
		AnimationName	   = CUBird_flya.CUBird_flya
		AnimationMode	   = LOOP
	  End
	  Flags			   = RANDOMSTART
	End

  End
 

Scale = 1.2

 ; ***DESIGN parameters ***
  Side = Hogwarts
	IsTrainable		= Yes
	EditorSorting	= UNIT
	ThreatLevel		= 1.0
	ThingClass		= HORDE_UNIT
	CommandPoints	= 12;;10

	BuildCost		= 0
	BuildTime		= 0
  TransportSlotCount = 1
  ArmorSet
	Conditions	  = None
	Armor		   = NoArmor
	DamageFX		= None
  End
  VisionRange = 500
  ShroudClearingRange = 500
  DisplayName = OBJECT:Prop
 ;CrushableLevel = 0 ;What am I?:		0 = for infantry, 1 = for trees, 2 = general vehicles
 
 ; *** AUDIO Parameters ***;
  VoiceSelect = NoSound
  VoiceMove = NoSound
  VoiceAttack = NoSound
  VoiceFear = NoSound
  VoiceGuard = NoSound
;  SoundDie = NoSound
;  SoundDieFire = NoSound
  SoundStealthOn = NoSound
  SoundStealthOff = NoSound
  
  UnitSpecificSounds
	VoiceGarrison		 = NoSound
	VoiceEnter			= NoSound
	VoiceEnterHostile	 = NoSound
	VoiceGetHealed		= NoSound
  End

 ; *** ENGINEERING Parameters ***
  RadarPriority = UNIT
  KindOf = PRELOAD SELECTABLE CAN_CAST_REFLECTIONS PATH_THROUGH_EACH_OTHER SCORE; PRELOAD IGNORED_IN_GUI INFANTRY PATH_THROUGH_EACH_OTHER NOT_AUTOACQUIRABLE NO_BASE_CAPTURE INERT;NO_COLLIDE
 
	Body = ActiveBody ModuleTag_02
		CheerRadius 	  = EMOTION_CHEER_RADIUS
		MaxHealth		 = 30;BALANCE Gwaihir Health
;		MaxHealthDamaged  = 500
;		RecoveryTime	  = 5000

		HealingBuffFx = None
		DodgePercent			  = 20;;
	End
 
	Behavior = AnimalAIUpdate ModuleTagWanderAround
		FleeRange = 50		; how close enemies have to be before we panic
		FleeDistance = 400	 ; how far the animal will run once spooked
		WanderPercentage = 95;percentage of the time we should move
		MaxWanderDistance = 1000 ;maximum distance to move at once
		MaxWanderRadius = 4000 ; how far to wander on our own
		UpdateTimer = 1000	; temp disable		10	; how often do we want to check for enemies
	End

  LocomotorSet
	Locomotor = CrowLocomotor
	Condition = SET_NORMAL 
	Speed	 = 97
  End
 
  Behavior = PhysicsBehavior ModuleTag_04
  End
 
;	Behavior = GiantBirdAIUpdate ModuleTag_GiantBirdAI
;		AutoAcquireEnemiesWhenIdle	=	Yes ATTACK_BUILDINGS
;
;		MoodAttackCheckRate			=	500
;		AILuaEventsList				=	GwaihirFunctions	
;		
;		FollowThroughDistance		=	160
;		FollowThroughCheckStep		=	50
;		FollowThroughGradient		=	1.0
;		
;		GrabTossTimeTrigger			=	3.0
;		GrabTossHeightTrigger		=   80.0
;		TossFX				= FX_DiebyFalling
;		SpecialContactPoints		= Swoop
;		
;		AttackPriority = AttackPriority_Eagle
;	End
 
  Behavior = SquishCollide ModuleTag_06
   ;nothing
  End


 
  Geometry = CYLINDER
  GeometryMajorRadius = 0.8
  GeometryHeight = 0.8
  GeometryIsSmall = Yes
  Shadow = SHADOW_DECAL
  ShadowSizeX = 10
  ShadowSizeY = 10
  ShadowTexture = ShadowI

End

Much thanks for any help =)
Jimiojoe
A light from the shadow shall spring.

#2 Sûlherokhh

Sûlherokhh

    Sagacious Engineer

  • Project Team
  • 3,754 posts
  • Location:Central Germany
  • Projects:S.E.E., Sage A.I., Code Advisor
  •  'Axe'er of the Gordic Knot

Posted 03 February 2008 - 04:01 PM

You could make it a neutral creep, bound to an invisible and untouchable object placed in the middle of the map (all maps). Give the object a spawn behavior like the creep lairs and give the bird a SlavedUpdate, just like creep creatures, with a radius just inside the map boundaries.

Behavior for untouchable object:
Behavior = SpawnBehavior ModuleTag_Spawn
  TriggeredBy = Upgrade_Whateever;use a player upgrade and make the player acquire it, if the hero gets to a certain level.
  SpawnNumber = 1;or more, depending on the number of birds you want to have
  InitialBurst = 0;no bird from the start.
  SpawnTemplateName = NeutralBird;insert your bird object name here
  SpawnReplaceDelay = 60000;gets to be replaced after 1 minute
  CanReclaimOrphans = Yes
End

Behavior for bird:
Behavior = SlavedUpdate ModuleTag_Slave
  GuardMaxRange = 5000;depnding on map size of course
  GuardWanderRange = 5000;see above
  UseSlaverAsControlForEvaObjectSightedEvents = Yes;or no, depending on who is supposed to trigger an EVA event
End

Make sure the spawn is untouchable by adding special traits to the KINDOF list, like UNATTACKABLE, etc. Check out other prop objects for that.

Also, you should remove the AnimalAIUpdate if you use the SlavedUpdate, or there might be a conflict. Besides, the bird doesn't really need to flee from anyone. If you want anyone to attack it, give it ' ThreatLevel = 1.0'.

Edited by Sûlherokhh, 03 February 2008 - 04:18 PM.

bannerreal01mittelit3.jpg
Axed Head and A.I. Coder for S.E.E. and ... stuff

".. coding is basically boring. What's fun is finding out how things work, take them apart and then put them together in ways that were not intended nor even conceived."


#3 jimiojoe

jimiojoe

    War Mungerer

  • Project Team
  • 491 posts
  • Projects:X-Mod, The Harry Potter Modification
  •  Advice

Posted 03 February 2008 - 05:19 PM

ahhh yess
that be a good idea
butt it was planned to be a buildable unit =(

(and i have threatlevel = 1.0 and its still not being attacked )

thanks for idea though =D
Jimiojoe
A light from the shadow shall spring.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users