xxx73 Posted October 4, 2020 Share Posted October 4, 2020 Hi I don't like passive animals walking around like the boar, it destroys the fun of hunting for me. So I have tried to change it to act like stag/rabbit/chicken when not attack, but still attack when being attacked, but that did not manage to do so.I see that there is three types of behavior of animals:1. When see player but not attacked = run away, when attacked = keep running away (stag, chicken, rabbit) 2. When see player but not attacked = not afraid of anything, when attacked = attack back (Boar) 3. When see player but not attacked = attacking, when attacked = attacking back (Bear, zombie dog, wolf, coyote) I want the 4th option for boar: 4. When see player but not attacked = run away, when attacked = attack back Is the 4 option possible, and if it is, how do I do it? Link to comment Share on other sites More sharing options...
xxx73 Posted October 7, 2020 Author Share Posted October 7, 2020 After playing around with animal template and tasks I ended up with this for the Boar. Now it run away if it sees me as I wanted, and if I attack at medium/close range it will attack back. I have really no idea what im doing here, just testing to i get a result I could be ok with. This is boar: <entity_class name="animalBoar" extends="animalTemplateTimid1"> <property name="Tags" value="entity,animal,hostile,boar,perkAT02,perkAT03"/> <property name="MapIcon" value="ui_game_symbol_tracking_pig"/> <property name="TrackerIcon" value="ui_game_symbol_tracking_pig"/> <property name="IsEnemyEntity" value="false"/><!-- override hostile template setting so he can spawn in safe zones --> <property name="AvatarController" value="AvatarAnimalController"/> <property name="ModelType" value="Standard"/> <property name="HasRagdoll" value="true"/> <property name="PhysicsBody" value="boar"/> <property name="SizeScale" value="1.0"/> <property name="Mass" value="200"/> <property name="Mesh" value="Animals/Boar/AnimalBoarStandardRagdoll"/> <property name="HasDeathAnim" value="true"/> <property name="RootMotion" value="true"/> <property name="RagdollOnDeathChance" value=".5"/> <property name="SoundRandom" value="Animals/Boar/boarroam"/> <property name="SoundAlert" value="Animals/Boar/boaralert"/> <property name="SoundHurt" value="Animals/Boar/boarpain"/> <property name="SoundDeath" value="Animals/Boar/boardeath"/> <property name="SoundAttack" value="Animals/Boar/boarattack"/> <property name="SoundSense" value="Animals/Boar/boarsense"/> <property name="SoundGiveUp" value="Animals/Boar/boargiveup"/> <!-- Gameplay --> <property name="PainResistPerHit" value=".75"/> <property name="MoveSpeed" value="0.5"/> <property name="MoveSpeedAggro" value="1.2, 1.4"/> <property name="MoveSpeedPanic" value="1.2"/> <property name="HandItem" value="meleeHandAnimalWolf"/> <drop event="Harvest" name="foodRawMeat" count="0" tool_category="Butcher"/> <drop event="Harvest" name="foodRawMeat" tag="butcherHarvest" count="8"/> <!-- animalBoar --> <drop event="Harvest" name="foodRottingFlesh" tag="butcherHarvest" count="2"/> <drop event="Harvest" name="foodRottingFlesh" tag="butcherHarvest" count="5"/> <drop event="Harvest" name="resourceLeather" tag="butcherHarvest" count="10"/> <drop event="Harvest" name="resourceAnimalFat" count="3" tag="butcherHarvest"/> <drop event="Harvest" name="resourceBone" tag="butcherHarvest" count="3"/> <drop event="Harvest" name="resourceBone" tag="allToolsHarvest" count="1"/> <effect_group name="Base Effects"> <passive_effect name="HealthMax" operation="base_set" value="250"/> <passive_effect name="HealthMax" operation="perc_add" value="0"/> <!-- Animal HP scale --> <passive_effect name="BuffResistance" operation="base_set" value="5" tags="buffFatiguedTrigger,buffArmSprainedCHTrigger,buffLegSprainedCHTrigger,buffLaceration,buffInfectionCatch,buffAbrasionCatch,buffInjuryStunned01CHTrigger,buffInjuryBleedingTwo"/> </effect_group> <property name="NavObject" value="animaltracking_boar,clear_sleeper" /> </entity_class> This is the template I use on the boar: <entity_class name="animalTemplateTimid1"> <property name="Tags" value="entity,animal"/> <property name="HideInSpawnMenu" value="true"/> <property name="Mesh" value="Animals/Stag/STAG"/> <property name="ModelType" value="Standard"/> <property name="Prefab" value="NPC"/> <property name="Class" value="EntityAnimalStag"/> <property name="Parent" value="Animals"/> <property name="IsAnimalEntity" value="true"/> <property name="IsEnemyEntity" value="false"/> <!-- Set this if you want this entity to be spawned when user chooses 'enemy entities off' --> <property name="Faction" value="animals"/> <!-- <property name="MapIcon" value="ui_game_symbol_enemy_dot" /> --> <property name="CompassIcon" value="ui_game_symbol_enemy_dot" /> <property name="CompassUpIcon" value="ui_game_symbol_enemy_dot_up" /> <property name="CompassDownIcon" value="ui_game_symbol_enemy_dot_down" /> <property name="TrackerIcon" value="ui_game_symbol_animal_tracker"/> <property name="AvatarController" value="GameObjectAnimalAnimation"/> <property name="RotateToGround" value="true"/> <property name="PhysicsBody" value="Stag"/> <property name="Mass" value="40"/> <property name="Weight" value="70"/> <property name="LookAtAngle" value="50"/> <property name="SurfaceCategory" value="organic"/> <property name="ParticleOnDeath" value="blood_death"/> <property name="SoundHurt" value="Animals/stagpain"/> <property name="SoundDeath" value="Animals/stagdeath"/> <property name="AIPathCostScale" value="100, 100"/> <property name="AITask-1" value="BreakBlock"/> <property name="AITask-2" value="ApproachAndAttackTarget" data="class=EntityZombie,0,EntityPlayer,0,EntitySurvivor,0,EntityBandit,0"/> <property name="AITask-3" value="RunawayFromEntity" data="class=EntityPlayer,EntityZombie,EntityEnemyAnimal"/> <property name="AITask-4" value="RunawayWhenHurt" data="runChance=.3;healthPer=.3;healthPerMax=0.60"/> <property name="AITask-5" value="Look"/> <property name="AITask-6" value="Wander"/> <property name="AITask-7" value=""/> <property name="AITarget-1" value="SetAsTargetIfHurt"/> <property name="AITarget-2" value="BlockIf" data="condition=alert e 0"/> <property name="AITarget-3" value="BlockingTargetTask"/> <property name="AITarget-4" value="SetNearestEntityAsTarget" data="class=EntityPlayer,20,15,EntityNPC,15,10"/> <property name="AITarget-5" value=""/> <!-- Stealth settings --> <property name="MaxViewAngle" value="210"/> <property name="SightRange" value="30"/> <!-- distance in m --> <property name="SightLightThreshold" value="-2,150"/> <property name="SleeperWakeupSightDetectionMin" value="-40,5"/> <!-- Indiv.Random. sight capability - "I see you" light value at point blank --> <property name="SleeperWakeupSightDetectionMax" value="340,480"/> <!-- Indiv.Random. "I see you" light value at "SightRange" --> <property name="SleeperSenseSightDetectionMin" value="-10,0"/> <!-- same for groaning, not waking --> <property name="SleeperSenseSightDetectionMax" value="200,300"/> <property name="SleeperNoiseSenseThreshold" value="3,8"/> <!-- Indiv.Random. hearing capability - "I hear something" noise value --> <property name="SleeperNoiseWakeThreshold" value="9,12"/> <property name="SleeperSmellSenseThreshold" value="20,50"/> <!-- Indiv.Random. smell capability - "I smell something" player smell value --> <property name="SoundSleeperSenseChance" value=".5"/> <!-- the chance to play "SoundSleeperSense" when "SleeperSmellSenseThreshold" is triggered --> <!-- Gameplay --> <property name="PainResistPerHit" value=".6"/> <property name="MaxTurnSpeed" value="420"/> <property name="MoveSpeed" value="0.7"/> <property name="MoveSpeedPanic" value="1.6"/> <property name="SwimSpeed" value="1.2"/> <property name="SwimStrokeRate" value="1.6,1.7"/> <property name="CanClimbLadders" value="false"/> <property name="ExperienceGain" value="245"/> <!-- <property name="CorpseBlock" value="goreBlockAnimal"/><property name="CorpseBlockChance" value="0"/> --> <property name="TimeStayAfterDeath" value="300"/> <property name="DeadBodyHitPoints" value="350"/> <property name="NavObject" value="animaltracking_timid" /> <effect_group name="Base Effects"> <passive_effect name="HealthMax" operation="base_set" value="50"/> <passive_effect name="HealthMax" operation="perc_add" value="0"/> <!-- Animal HP scale --> <passive_effect name="BuffResistance" operation="base_set" value="5" tags="buffFatiguedTrigger,buffArmSprainedCHTrigger,buffLegSprainedCHTrigger,buffLaceration,buffInfectionCatch,buffAbrasionCatch,buffInjuryStunned01CHTrigger,buffInjuryBleedingTwo"/> </effect_group> </entity_class> if anyone have any improvements/suggestions please comment, but for now Im ok with the result. Link to comment Share on other sites More sharing options...
convergent Posted October 16, 2020 Share Posted October 16, 2020 the AITask part is what is relevant- you can just copy that part from an animal you want to make it behave like. Its a hierarchy so if task 1 does not apply, try task 2, etc. Link to comment Share on other sites More sharing options...
xxx73 Posted October 23, 2020 Author Share Posted October 23, 2020 Ok thanks for the information. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.