-- ZombieApproach behavior -- Created by the_grim local Behavior = CreateAIBehavior("ZombieApproach", { Alertness = 2, Constructor = function (self, entity) Log("Approaching!"); entity:SelectPipe(0, "zombie_approach"); end, Destructor = function(self, entity) end, OnGroupMemberDiedNearest = function ( self, entity, sender,data) AI.SetBehaviorVariable(entity.id, "Alerted", true); end, OnGroupMemberDied = function( self, entity, sender) AI.SetBehaviorVariable(entity.id, "Alerted", true); end, AnalyzeSituation = function (self, entity, sender, data) local range = 1.0; local distance = AI.GetAttentionTargetDistance(entity.id); if(distance > (range)) then AI.SetBehaviorVariable(entity.id, "IsAttackRange", false); elseif(distance < (range)) then AI.SetBehaviorVariable(entity.id, "IsAttackRange", true); end end, })