This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 29th, 2012  |  syntax: None  |  size: 0.92 KB  |  views: 324  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. -- ZombieApproach behavior
  2. -- Created by the_grim
  3.  
  4. local Behavior = CreateAIBehavior("ZombieApproach",
  5. {
  6.         Alertness = 2,
  7.  
  8.         Constructor = function (self, entity)
  9.                 Log("Approaching!");
  10.                 entity:SelectPipe(0, "zombie_approach");       
  11.         end,
  12.        
  13.         Destructor = function(self, entity)
  14.         end,
  15.        
  16.         OnGroupMemberDiedNearest = function ( self, entity, sender,data)
  17.         AI.SetBehaviorVariable(entity.id, "Alerted", true);
  18.         end,
  19.  
  20.         OnGroupMemberDied = function( self, entity, sender)
  21.         AI.SetBehaviorVariable(entity.id, "Alerted", true);            
  22.         end,
  23.  
  24.         AnalyzeSituation = function (self, entity, sender, data)
  25.         local range = 1.0;
  26.         local distance = AI.GetAttentionTargetDistance(entity.id);
  27.         if(distance > (range)) then
  28.             AI.SetBehaviorVariable(entity.id, "IsAttackRange", false);
  29.         elseif(distance < (range)) then
  30.             AI.SetBehaviorVariable(entity.id, "IsAttackRange", true);
  31.         end
  32.        
  33.         end,
  34. })
clone this paste RAW Paste Data