
ZombieIdle
By: a guest on
Feb 29th, 2012 | syntax:
None | size: 0.98 KB | hits: 411 | expires: Never
-- 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,
})