-- ZombieIdle behavior
-- Created by the_grim
local Behavior = CreateAIBehavior("ZombieIdle",
{
Alertness = 0,
Constructor = function (self, entity)
Log("Idling...");
AI.SetBehaviorVariable(entity.id, "AwareOfPlayer", false);
entity:SelectPipe(0,"zombie_idle");
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,
})