‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_zm_behavior.gsc
Go to the documentation of this file.
1 #using scripts\shared\clientfield_shared;
2 #using scripts\shared\system_shared;
3 #using scripts\shared\util_shared;
4 #using scripts\shared\flag_shared;
5 #using scripts\shared\math_shared;
6 #using scripts\shared\ai_shared;
7 #using scripts\shared\ai\systems\animation_state_machine_utility;
8 #using scripts\shared\ai\systems\animation_state_machine_notetracks;
9 #using scripts\shared\ai\systems\animation_state_machine_mocomp;
10 #using scripts\shared\ai\archetype_utility;
11 #using scripts\shared\ai\archetype_locomotion_utility;
12 #using scripts\shared\ai\systems\behavior_tree_utility;
13 #using scripts\shared\ai\systems\blackboard;
14 #using scripts\shared\ai\zombie;
15 #using scripts\shared\ai\zombie_utility;
16 
17 #using scripts\zm\_zm_attackables;
18 #using scripts\zm\_zm_behavior_utility;
19 #using scripts\zm\_zm_spawner;
20 #using scripts\zm\_zm_utility;
21 
22 #insert scripts\shared\shared.gsh;
23 #insert scripts\shared\ai\zombie.gsh;
24 #insert scripts\shared\ai\systems\animation_state_machine.gsh;
25 #insert scripts\shared\ai\systems\behavior.gsh;
26 #insert scripts\shared\ai\systems\behavior_tree.gsh;
27 #insert scripts\shared\ai\systems\blackboard.gsh;
28 #insert scripts\shared\ai\utility.gsh;
29 #insert scripts\shared\archetype_shared\archetype_shared.gsh;
30 
31 #insert scripts\zm\_zm_behavior.gsh;
32 
33 
34 #namespace zm_behavior;
35 
36 #define BHB_BURST "bhb_burst"
37 
38 function autoexec ‪init()
39 {
40  // INIT BEHAVIORS
42 
43  // minimum distance from the enemy for deviation to occur
44  level.zigzag_activation_distance = ‪ZIGZAG_ACTIVATION_DISTANCE;
45 
46  // how far along the path the deviation will occur
47  level.zigzag_distance_min = ‪ZIGZAG_DISTANCE_MIN;
48  level.zigzag_distance_max = ‪ZIGZAG_DISTANCE_MAX;
49 
50  // how far zombie can deviate from the path
51  level.inner_zigzag_radius = ‪INNER_ZIGZAG_RADIUS;
52  level.outer_zigzag_radius = ‪OUTER_ZIGZAG_RADIUS;
53 }
54 
55 function private ‪InitZmBehaviorsAndASM()
56 {
57  ‪BT_REGISTER_API( "zombieFindFleshService", &‪zombieFindFlesh);
58  ‪BT_REGISTER_API( "zombieEnteredPlayableService", &‪zombieEnteredPlayable);
59 
60  // functionName, functionPtr, functionParamCount // functionParam names (For documentation purposes)
61 
62  // ------- BEHAVIOR CONDITIONS -----------//
63  ‪BT_REGISTER_API( "zombieShouldMove", &‪shouldMoveCondition );
64  ‪BT_REGISTER_API( "zombieShouldTear", &‪zombieShouldTearCondition );
65  ‪BT_REGISTER_API( "zombieShouldAttackThroughBoards", &‪zombieShouldAttackThroughBoardsCondition );
66  ‪BT_REGISTER_API( "zombieShouldTaunt", &‪zombieShouldTauntCondition );
67  ‪BT_REGISTER_API( "zombieGotToEntrance", &‪zombieGotToEntranceCondition );
68  ‪BT_REGISTER_API( "zombieGotToAttackSpot", &‪zombieGotToAttackSpotCondition );
69  ‪BT_REGISTER_API( "zombieHasAttackSpotAlready", &‪zombieHasAttackSpotAlreadyCondition );
70  ‪BT_REGISTER_API( "zombieShouldEnterPlayable", &‪zombieShouldEnterPlayableCondition );
71  ‪BT_REGISTER_API( "isChunkValid", &‪isChunkValidCondition );
72 
73  ‪BT_REGISTER_API( "inPlayableArea", &‪inPlayableArea );
74  ‪BT_REGISTER_API( "shouldSkipTeardown", &‪shouldSkipTeardown );
75  ‪BT_REGISTER_API( "zombieIsThinkDone", &‪zombieIsThinkDone );
76  ‪BT_REGISTER_API( "zombieIsAtGoal", &‪zombieIsAtGoal );
77  ‪BT_REGISTER_API( "zombieIsAtEntrance", &‪zombieIsAtEntrance );
78  ‪BT_REGISTER_API( "zombieShouldMoveAway", &‪zombieShouldMoveAwayCondition);
79  ‪BT_REGISTER_API( "wasKilledByTesla", &‪wasKilledByTeslaCondition);
80  ‪BT_REGISTER_API( "zombieShouldStun", &‪zombieShouldStun );
81  ‪BT_REGISTER_API( "zombieIsBeingGrappled", &‪zombieIsBeingGrappled );
82  ‪BT_REGISTER_API( "zombieShouldKnockdown", &‪zombieShouldKnockdown );
83  ‪BT_REGISTER_API( "zombieIsPushed", &‪zombieIsPushed );
84  ‪BT_REGISTER_API( "zombieKilledWhileGettingPulled", &‪zombieKilledWhileGettingPulled );
85  ‪BT_REGISTER_API( "zombieKilledByBlackHoleBombCondition", &‪zombieKilledByBlackHoleBombCondition );
86 
87  // ------- BEHAVIOR UTILITY -----------//
88  ‪BT_REGISTER_API( "disablePowerups", &‪disablePowerups);
89  ‪BT_REGISTER_API( "enablePowerups", &‪enablePowerups);
90 
91  // ------- ZOMBIE LOCOMOTION -----------//
94  ‪BT_REGISTER_ACTION( "zombieIdleAction", undefined, undefined, undefined );
95  ‪BT_REGISTER_ACTION( "zombieMoveAway", &‪zombieMoveAway, undefined, undefined );
97 
98  // ------- ZOMBIE TEAR DOWN -----------//
102  // ------- ZOMBIE MELEE BEHIND BOARDS -----------//
104  // ------- ZOMBIE TAUNT -----------//
105  ‪BT_REGISTER_ACTION( "zombieTauntAction", &‪zombieTauntAction, undefined, &‪zombieTauntActionTerminate );
106  // ------- ZOMBIE BOARD MANTLE -----------//
107  ‪BT_REGISTER_ACTION( "zombieMantleAction", &‪zombieMantleAction, undefined, &‪zombieMantleActionTerminate );
108  // ------- ZOMBIE ELECTRIC STUN -----------//
109  ‪BT_REGISTER_API( "zombieStunActionStart", &‪zombieStunActionStart );
110  ‪BT_REGISTER_API( "zombieStunActionEnd", &‪zombieStunActionEnd );
111 
112  // ------- ZOMBIE GRAPPLE -----------//
113  ‪BT_REGISTER_API( "zombieGrappleActionStart", &‪zombieGrappleActionStart );
114 
115  // ------- ZOMBIE KNOCKDOWN -----------//
116  ‪BT_REGISTER_API( "zombieKnockdownActionStart", &‪zombieKnockdownActionStart );
117  ‪BT_REGISTER_API( "zombieGetupActionTerminate", &‪zombieGetupActionTerminate);
118 
119  // ------- ZOMBIE PUSHED -----------//
120  ‪BT_REGISTER_API( "zombiePushedActionStart", &‪zombiePushedActionStart);
121  ‪BT_REGISTER_API( "zombiePushedActionTerminate", &‪zombiePushedActionTerminate);
122 
123  // ------- ZOMBIE BLACK HOLE BOMB -----------//
125  ‪BT_REGISTER_ACTION( "zombieBlackHoleBombDeathAction", &‪zombieKilledByBlackHoleBombStart, undefined, &‪zombieKilledByBlackHoleBombEnd );
126 
127  // ------- ZOMBIE SERVICES -----------//
128  ‪BT_REGISTER_API( "getChunkService", &‪getChunkService );
129  ‪BT_REGISTER_API( "updateChunkService", &‪updateChunkService );
130  ‪BT_REGISTER_API( "updateAttackSpotService", &‪updateAttackSpotService );
131  ‪BT_REGISTER_API( "findNodesService", &‪findNodesService );
132 
133  ‪BT_REGISTER_API( "zombieAttackableObjectService", &‪zombieAttackableObjectService );
134 
135  // ------- ZOMBIE MOCOMP -----------//
136  ‪ASM_REGISTER_MOCOMP( "mocomp_board_tear@zombie", &‪boardTearMocompStart, &‪boardTearMocompUpdate, undefined );
139 
140  // ------- ZOMBIE NOTETRACKS -----------//
144 
145  SetDvar( "scr_zm_use_code_enemy_selection", 1 );
146 }
147 
148 // ------- BEHAVIOR CONDITIONS -----------//
149 function ‪zombieFindFlesh( behaviorTreeEntity )
150 {
151  if ( isdefined( behaviorTreeEntity.enablePushTime ) )
152  {
153  if ( GetTime() >= behaviorTreeEntity.enablePushTime )
154  {
155  behaviorTreeEntity PushActors( true );
156  behaviorTreeEntity.enablePushTime = undefined;
157  }
158  }
159 
160  if( GetDvarInt( "scr_zm_use_code_enemy_selection", 0 ) )
161  {
162  ‪zombieFindFleshCode( behaviorTreeEntity );
163  return;
164  }
165 
166  if( level.intermission )
167  {
168  return;
169  }
170 
171  if ( behaviorTreeEntity GetPathMode() == "dont move" )
172  {
173  return;
174  }
175 
176  behaviorTreeEntity.ignoreme = false; // don't let attack dogs give chase until the zombie is in the playable area
177 
178  behaviorTreeEntity.ignore_player = [];
179 
180  behaviorTreeEntity.goalradius = ‪ZM_FIND_FLESH_RADIUS;
181 
182  if ( ‪IS_TRUE( behaviorTreeEntity.ignore_find_flesh ) )
183  {
184  return;
185  }
186 
187  if ( behaviorTreeEntity.team == "allies" )
188  {
189  behaviorTreeEntity ‪findZombieEnemy();
190  return;
191  }
192 
193  if ( ‪zm_behavior::zombieShouldMoveAwayCondition( behaviorTreeEntity ) )
194  {
195  return;
196  }
197 
198  zombie_poi = behaviorTreeEntity ‪zm_utility::get_zombie_point_of_interest( behaviorTreeEntity.origin );
199  behaviorTreeEntity.zombie_poi = zombie_poi;
200 
201  players = GetPlayers();
202 
203  // If playing single player, never ignore the player
204  if( !isdefined(behaviorTreeEntity.ignore_player) || (players.size == 1) )
205  {
206  behaviorTreeEntity.ignore_player = [];
207  }
208  else if(!isDefined(level._should_skip_ignore_player_logic) || ![[level._should_skip_ignore_player_logic]]() )
209  {
210  i=0;
211  while (i < behaviorTreeEntity.ignore_player.size)
212  {
213  if( IsDefined( behaviorTreeEntity.ignore_player[i] ) && IsDefined( behaviorTreeEntity.ignore_player[i].ignore_counter ) && behaviorTreeEntity.ignore_player[i].ignore_counter > 3 )
214  {
215  behaviorTreeEntity.ignore_player[i].ignore_counter = 0;
216  behaviorTreeEntity.ignore_player = ArrayRemoveValue( behaviorTreeEntity.ignore_player, behaviorTreeEntity.ignore_player[i] );
217  if (!IsDefined(behaviorTreeEntity.ignore_player))
218  behaviorTreeEntity.ignore_player = [];
219  i=0;
220  continue;
221  }
222  i++;
223  }
224  }
225 
227 
228  player = ‪zm_utility::get_closest_valid_player( behaviorTreeEntity.origin, behaviorTreeEntity.ignore_player );
229 
230  designated_target = false;
231  if ( IsDefined( player ) && ‪IS_TRUE( player.b_is_designated_target ) )
232  {
233  designated_target = true;
234  }
235 
236  if( !isDefined( player ) && !isDefined( zombie_poi ) && !isDefined( behaviorTreeEntity.attackable ) )
237  {
238  //behaviorTreeEntity zm_spawner::zombie_history( "find flesh -> can't find player, continue" );
239  if( IsDefined( behaviorTreeEntity.ignore_player ) )
240  {
241  if(isDefined(level._should_skip_ignore_player_logic) && [[level._should_skip_ignore_player_logic]]() )
242  {
243  return;
244  }
245  behaviorTreeEntity.ignore_player = [];
246  }
247 
248  /#
249  if( ‪IS_TRUE( behaviortreeentity.isPuppet ) )
250  {
251  return;
252  }
253  #/
254 
255  if( isdefined( level.no_target_override ) )
256  {
257  [[ level.no_target_override ]]( behaviorTreeEntity );
258  }
259  else
260  {
261  behaviorTreeEntity SetGoal( behaviorTreeEntity.origin );
262  }
263 
264  return;
265  }
266 
267  //PI_CHANGE - 7/2/2009 JV Reenabling change 274916 (from DLC3)
268  //behaviorTreeEntity.ignore_player = undefined;
269  if ( !isDefined( level.check_for_alternate_poi ) || ![[level.check_for_alternate_poi]]() )
270  {
271  behaviorTreeEntity.enemyoverride = zombie_poi;
272 
273  behaviorTreeEntity.favoriteenemy = player;
274  }
275 
276  if( isdefined( behaviorTreeEntity.v_zombie_custom_goal_pos ) )
277  {
278  goalPos = behaviorTreeEntity.v_zombie_custom_goal_pos;
279 
280  if ( isdefined( behaviorTreeEntity.n_zombie_custom_goal_radius ) )
281  {
282  behaviorTreeEntity.goalradius = behaviorTreeEntity.n_zombie_custom_goal_radius;
283  }
284 
285  behaviorTreeEntity SetGoal( goalPos );
286  }
287  else if ( isdefined( behaviorTreeEntity.enemyoverride ) && isdefined( behaviorTreeEntity.enemyoverride[1] ) )
288  {
289  behaviorTreeEntity.has_exit_point = undefined;
290 
291  goalPos = behaviorTreeEntity.enemyoverride[0];
292 
293  // if behaviorTreeEntity.enemyoverride is populated by level script explicitely, as compared to something like cymbal monkey
294  // then zombie_poi will be undefined, and we should use position query to find a good point.
295  if( !IsDefined(zombie_poi) )
296  {
297  AIProfile_BeginEntry( "zombiefindflesh-enemyoverride" );
298  queryResult = PositionQuery_Source_Navigation( goalPos, 0, 48, 36, 4 );
299  AIProfile_EndEntry();
300 
301  foreach( point in queryResult.data )
302  {
303  goalPos = point.origin;
304  break;
305  }
306  }
307 
308  behaviorTreeEntity SetGoal( goalPos );
309 
310  }
311  else if ( isdefined( behaviorTreeEntity.attackable ) && !designated_target )
312  {
313  if ( isdefined( behaviorTreeEntity.attackable_slot ) )
314  {
315  if ( isdefined( behaviorTreeEntity.attackable_goal_radius ) )
316  {
317  behaviorTreeEntity.goalradius = behaviorTreeEntity.attackable_goal_radius;
318  }
319 
320  nav_mesh = GetClosestPointOnNavMesh( behaviorTreeEntity.attackable_slot.origin, 64 );
321  if ( isdefined( nav_mesh ) )
322  {
323  behaviorTreeEntity SetGoal( nav_mesh );
324  }
325  else
326  {
327  behaviorTreeEntity SetGoal( behaviorTreeEntity.attackable_slot.origin );
328  }
329  }
330  }
331  else if ( IsDefined( behaviorTreeEntity.favoriteenemy ) )
332  {
333  behaviorTreeEntity.has_exit_point = undefined;
334 
335  behaviorTreeEntity.ignoreall = false;
336 
337  if ( IsDefined( level.enemy_location_override_func ) )
338  {
339  goalPos = [[ level.enemy_location_override_func ]]( behaviorTreeEntity, behaviorTreeEntity.favoriteenemy );
340 
341  if ( IsDefined( goalPos ) )
342  {
343  behaviorTreeEntity SetGoal( goalPos );
344  }
345  else
346  {
347  behaviorTreeEntity ‪zombieUpdateGoal();
348  }
349  }
350  else if( ‪IS_TRUE(behaviorTreeEntity.is_rat_test) )
351  {
352  }
353  else if ( ‪zm_behavior::zombieShouldMoveAwayCondition( behaviorTreeEntity ) )
354  {
355  }
356  else if ( IsDefined( behaviorTreeEntity.favoriteenemy.last_valid_position ) )
357  {
358  behaviorTreeEntity ‪zombieUpdateGoal();
359  }
360  else
361  {
362  //AssertMsg( "no last_valid_position" );
363  }
364  }
365 
366  //PI_CHANGE_BEGIN - 7/2/2009 JV Reenabling change 274916 (from DLC3)
367  if( players.size > 1 )
368  {
369  for(i = 0; i < behaviorTreeEntity.ignore_player.size; i++)
370  {
371  if( IsDefined( behaviorTreeEntity.ignore_player[i] ) )
372  {
373  if( !IsDefined( behaviorTreeEntity.ignore_player[i].ignore_counter ) )
374  behaviorTreeEntity.ignore_player[i].ignore_counter = 0;
375  else
376  behaviorTreeEntity.ignore_player[i].ignore_counter += 1;
377  }
378  }
379  }
380  //PI_CHANGE_END
381 }
382 
383 //modified zombieFindFlesh. Calls update_valid_players to decide who should be ignored. Considers enemy and not favoriteenemy.
384 
385 function ‪zombieFindFleshCode( behaviorTreeEntity )
386 {
387  AIProfile_BeginEntry( "zombieFindFleshCode" );
388 
389  if( level.intermission )
390  {
391  AIProfile_EndEntry();
392  return;
393  }
394 
395  behaviorTreeEntity.ignore_player = [];
396 
397  behaviorTreeEntity.goalradius = ‪ZM_FIND_FLESH_RADIUS;
398 
399  if ( behaviorTreeEntity.team == "allies" )
400  {
401  behaviorTreeEntity ‪findZombieEnemy();
402 
403  AIProfile_EndEntry();
404  return;
405  }
406 
407  if ( level.wait_and_revive )
408  {
409  AIProfile_EndEntry();
410  return;
411  }
412 
413  if ( level.zombie_poi_array.size > 0 )
414  {
415  zombie_poi = behaviorTreeEntity ‪zm_utility::get_zombie_point_of_interest( behaviorTreeEntity.origin );
416  }
417 
419 
420  ‪zm_utility::update_valid_players( behaviorTreeEntity.origin, behaviorTreeEntity.ignore_player );
421 
422  if( !isDefined( behaviorTreeEntity.enemy ) && !isDefined( zombie_poi ) )
423  {
424  /#
425  if( ‪IS_TRUE( behaviortreeentity.isPuppet ) )
426  {
427  AIProfile_EndEntry();
428  return;
429  }
430  #/
431 
432  if( isdefined( level.no_target_override ) )
433  {
434  [[ level.no_target_override ]]( behaviorTreeEntity );
435  }
436  else
437  {
438  behaviorTreeEntity SetGoal( behaviorTreeEntity.origin );
439  }
440 
441  AIProfile_EndEntry();
442  return;
443  }
444 
445  behaviorTreeEntity.enemyoverride = zombie_poi;
446 
447  if ( IsDefined( behaviorTreeEntity.enemyoverride ) && IsDefined( behaviorTreeEntity.enemyoverride[1] ) )
448  {
449  behaviorTreeEntity.has_exit_point = undefined;
450 
451  goalPos = behaviorTreeEntity.enemyoverride[0];
452  queryResult = PositionQuery_Source_Navigation( goalPos, 0, 48, 36, 4 );
453  foreach( point in queryResult.data )
454  {
455  goalPos = point.origin;
456  break;
457  }
458  behaviorTreeEntity SetGoal( goalPos );
459  }
460  else if ( IsDefined( behaviorTreeEntity.enemy ) )
461  {
462  behaviorTreeEntity.has_exit_point = undefined;
463 
464  /#
465  if ( ‪IS_TRUE( behaviorTreeEntity.is_rat_test ) )
466  {
467  AIProfile_EndEntry();
468  return;
469  }
470  #/
471 
472  if ( IsDefined( level.enemy_location_override_func ) )
473  {
474  goalPos = [[ level.enemy_location_override_func ]]( behaviorTreeEntity, behaviorTreeEntity.enemy );
475 
476  if ( IsDefined( goalPos ) )
477  {
478  behaviorTreeEntity SetGoal( goalPos );
479  }
480  else
481  {
482  behaviorTreeEntity ‪zombieUpdateGoalCode();
483  }
484  }
485  else if ( IsDefined( behaviorTreeEntity.enemy.last_valid_position ) )
486  {
487  behaviorTreeEntity ‪zombieUpdateGoalCode();
488  }
489  else
490  {
491  //AssertMsg( "no last_valid_position" );
492  }
493  }
494 
495  AIProfile_EndEntry();
496 }
497 
499 {
500  AIProfile_BeginEntry( "zombieUpdateGoal" );
501 
502  shouldRepath = false;
503 
504  if ( !shouldRepath && IsDefined( self.favoriteenemy ) )
505  {
506  if ( !IsDefined( self.nextGoalUpdate ) || self.nextGoalUpdate <= GetTime() )
507  {
508  // It's been a while, repath!
509  shouldRepath = true;
510  }
511  else if ( DistanceSquared( self.origin, self.favoriteenemy.origin ) <= ‪SQR( level.zigzag_activation_distance ) )
512  {
513  // Repath if close to the enemy.
514  shouldRepath = true;
515  }
516  else if ( IsDefined( self.pathGoalPos ) )
517  {
518  // Repath if close to the current goal position.
519  distanceToGoalSqr = DistanceSquared( self.origin, self.pathGoalPos );
520 
521  shouldRepath = distanceToGoalSqr < ‪SQR( 72 );
522  }
523  }
524 
525  if ( ‪IS_TRUE( level.validate_on_navmesh ) )
526  {
527  if ( !IsPointOnNavMesh( self.origin, self ) )
528  {
529  shouldRepath = false;
530  }
531  }
532 
533  if ( ‪IS_TRUE( self.keep_moving ) )
534  {
535  if ( GetTime() > self.keep_moving_time )
536  {
537  self.keep_moving = false;
538  }
539  }
540  if ( shouldRepath )
541  {
542  goalPos = self.favoriteenemy.origin;
543  if ( IsDefined( self.favoriteenemy.last_valid_position ) )
544  {
545  goalPos = self.favoriteenemy.last_valid_position;
546  }
547  self SetGoal( goalPos );
548 
549  should_zigzag = true;
550  if ( IsDefined( level.should_zigzag ) )
551  {
552  should_zigzag = self [[ level.should_zigzag ]]();
553  }
554 
555  // Randomized zig-zag path following if 20+ feet away from the enemy.
556  if( ‪IS_TRUE(level.do_randomized_zigzag_path) && should_zigzag )
557  {
558  if ( DistanceSquared( self.origin, goalPos ) > ‪SQR( level.zigzag_activation_distance ) )
559  {
560  self.keep_moving = true;
561  self.keep_moving_time = GetTime() + 250;
562  path = self CalcApproximatePathToPosition( goalPos,false );
563 
564  /#
565  if ( GetDvarInt( "ai_debugZigZag" ) )
566  {
567  for ( index = 1; index < path.size; index++ )
568  {
569  RecordLine( path[index - 1], path[index], ‪ORANGE, "Animscript", self );
570  }
571  }
572  #/
573 
574  deviationDistance = RandomIntRange( level.zigzag_distance_min, level.zigzag_distance_max ); // 20 to 40 feet
575 
576  if( IsDefined( self.zigzag_distance_min ) && IsDefined( self.zigzag_distance_max ) )
577  {
578  deviationDistance = RandomIntRange( self.zigzag_distance_min, self.zigzag_distance_max ); // 20 to 40 feet
579  }
580 
581  segmentLength = 0;
582 
583  // Walks the current path to find the point where the AI should deviate from their normal path.
584  for ( index = 1; index < path.size; index++ )
585  {
586  currentSegLength = Distance( path[index - 1], path[index] );
587 
588  if ( ( segmentLength + currentSegLength ) > deviationDistance )
589  {
590  remainingLength = deviationDistance - segmentLength;
591 
592  seedPosition = path[index - 1] + ( VectorNormalize( path[index] - path[index - 1] ) * remainingLength );
593 
594  /# RecordCircle( seedPosition, 2, ‪ORANGE, "Animscript", self ); #/
595 
596  innerZigZagRadius = level.inner_zigzag_radius;
597  outerZigZagRadius = level.outer_zigzag_radius;
598 
599  // Find a point offset from the deviation point along the path.
600  queryResult = PositionQuery_Source_Navigation(
601  seedPosition,
602  innerZigZagRadius,
603  outerZigZagRadius,
604  0.5 * ‪ZM_ZOMBIE_HEIGHT,
605  16,
606  self,
607  16 );
608 
609  PositionQuery_Filter_InClaimedLocation( queryResult, self );
610 
611  if ( queryResult.data.size > 0 )
612  {
613  point = queryResult.data[ RandomInt( queryResult.data.size ) ];
614 
615  // Use the deviated point as the path instead.
616  self SetGoal( point.origin );
617  }
618 
619  break;
620  }
621 
622  segmentLength += currentSegLength;
623  }
624  }
625  }
626 
627  // Force repathing after a certain amount of time to smooth out movement.
628  self.nextGoalUpdate = GetTime() + RandomIntRange(500, 1000);
629  }
630  AIProfile_EndEntry();
631 }
632 
633 //modified version of zombieUpdateGoal that considers self.enemy and not self.favoriteenemy
635 {
636  AIProfile_BeginEntry( "zombieUpdateGoalCode" );
637 
638  shouldRepath = false;
639 
640  if ( !shouldRepath && IsDefined( self.enemy ) )
641  {
642  if ( !IsDefined( self.nextGoalUpdate ) || self.nextGoalUpdate <= GetTime() )
643  {
644  // It's been a while, repath!
645  shouldRepath = true;
646  }
647  else if ( DistanceSquared( self.origin, self.enemy.origin ) <= ‪SQR( 200 ) )
648  {
649  // Repath if close to the enemy.
650  shouldRepath = true;
651  }
652  else if ( IsDefined( self.pathGoalPos ) )
653  {
654  // Repath if close to the current goal position.
655  distanceToGoalSqr = DistanceSquared( self.origin, self.pathGoalPos );
656 
657  shouldRepath = distanceToGoalSqr < ‪SQR( 72 );
658  }
659  }
660 
661  if ( ‪IS_TRUE( self.keep_moving ) )
662  {
663  if ( GetTime() > self.keep_moving_time )
664  {
665  self.keep_moving = false;
666  }
667  }
668  if ( shouldRepath )
669  {
670  goalPos = self.enemy.origin;
671  if ( IsDefined( self.enemy.last_valid_position ) )
672  {
673  goalPos = self.enemy.last_valid_position;
674  }
675 
676  // Randomized zig-zag path following if 20+ feet away from the enemy.
677  if( ‪IS_TRUE(level.do_randomized_zigzag_path) )
678  {
679  if ( DistanceSquared( self.origin, goalPos ) > ‪SQR( 240 ) )
680  {
681  self.keep_moving = true;
682  self.keep_moving_time = GetTime() + 250;
683 
684  path = self CalcApproximatePathToPosition( goalPos,false );
685 
686  /#
687  if ( GetDvarInt( "ai_debugZigZag" ) )
688  {
689  for ( index = 1; index < path.size; index++ )
690  {
691  RecordLine( path[index - 1], path[index], ‪ORANGE, "Animscript", self );
692  }
693  }
694  #/
695 
696  deviationDistance = RandomIntRange( 240, 480 ); // 20 to 40 feet
697 
698  segmentLength = 0;
699 
700  // Walks the current path to find the point where the AI should deviate from their normal path.
701  for ( index = 1; index < path.size; index++ )
702  {
703  currentSegLength = Distance( path[index - 1], path[index] );
704 
705  if ( ( segmentLength + currentSegLength ) > deviationDistance )
706  {
707  remainingLength = deviationDistance - segmentLength;
708 
709  seedPosition = path[index - 1] + ( VectorNormalize( path[index] - path[index - 1] ) * remainingLength );
710 
711  /# RecordCircle( seedPosition, 2, ‪ORANGE, "Animscript", self ); #/
712 
713  innerZigZagRadius = level.inner_zigzag_radius;
714  outerZigZagRadius = level.outer_zigzag_radius;
715 
716  // Find a point offset from the deviation point along the path.
717  queryResult = PositionQuery_Source_Navigation(
718  seedPosition,
719  innerZigZagRadius,
720  outerZigZagRadius,
721  0.5 * ‪ZM_ZOMBIE_HEIGHT,
722  16,
723  self,
724  16 );
725 
726  PositionQuery_Filter_InClaimedLocation( queryResult, self );
727 
728  if ( queryResult.data.size > 0 )
729  {
730  point = queryResult.data[ RandomInt( queryResult.data.size ) ];
731 
732  if ( TracePassedOnNavMesh( seedPosition, point.origin, 16 ) )
733  {
734  // Use the deviated point as the path instead.
735  goalPos = point.origin;
736  }
737  }
738 
739  break;
740  }
741 
742  segmentLength += currentSegLength;
743  }
744  }
745  }
746 
747  self SetGoal( goalPos );
748 
749  self.nextGoalUpdate = GetTime() + RandomIntRange(500, 1000);
750  }
751  AIProfile_EndEntry();
752 }
753 
754 function ‪zombieEnteredPlayable( behaviorTreeEntity )
755 {
756  if ( !IsDefined( level.playable_areas ) )
757  {
758  level.playable_areas = GetEntArray("player_volume", "script_noteworthy" );
759  }
760 
761  foreach(area in level.playable_areas)
762  {
763  if(behaviorTreeEntity IsTouching(area))
764  {
766  return true;
767  }
768  }
769 
770  return false;
771 }
772 
773 function ‪shouldMoveCondition( behaviorTreeEntity )
774 {
775  if ( behaviorTreeEntity HasPath() )
776  {
777  return true;
778  }
779 
780  if ( ‪IS_TRUE( behaviorTreeEntity.keep_moving ) )
781  {
782  return true;
783  }
784 
785  return false;
786 }
787 
788 function ‪zombieShouldMoveAwayCondition( behaviorTreeEntity )
789 {
790  return level.wait_and_revive;
791 }
792 
793 function ‪wasKilledByTeslaCondition( behaviorTreeEntity )
794 {
795  if ( ‪IS_TRUE( behaviorTreeEntity.tesla_death ) )
796  {
797  return true;
798  }
799 
800  return false;
801 }
802 
803 function ‪disablePowerups( behaviorTreeEntity )
804 {
805  behaviorTreeEntity.no_powerups = true;
806 }
807 
808 function ‪enablePowerups( behaviorTreeEntity )
809 {
810  behaviorTreeEntity.no_powerups = false;
811 }
812 
813 function ‪zombieMoveAway( behaviorTreeEntity, asmStateName)
814 {
815  player = util::GetHostPlayer();
816  queryResult = level.move_away_points;
817 
818  ‪AnimationStateNetworkUtility::RequestState( behaviorTreeEntity, asmStateName );
819 
820  if ( !IsDefined( queryResult ) )
821  {
822  return ‪BHTN_RUNNING;
823  }
824 
825  for(i = 0; i < queryResult.data.size; i++)
826  {
827  if ( !‪zm_utility::check_point_in_playable_area( queryResult.data[i].origin ) )
828  {
829  continue;
830  }
831 
832  isBehind = vectordot( player.origin - behaviorTreeEntity.origin, queryResult.data[i].origin - behaviorTreeEntity.origin );
833  if(isBehind < 0 )
834  {
835  behaviorTreeEntity SetGoal( queryResult.data[i].origin );
836  ArrayRemoveIndex(level.move_away_points.data, i, false);
837  i--;
838  return ‪BHTN_RUNNING;
839  }
840  }
841 
842  for(i = 0; i < queryResult.data.size; i++)
843  {
844  if ( !‪zm_utility::check_point_in_playable_area( queryResult.data[i].origin ) )
845  {
846  continue;
847  }
848 
849  dist_zombie = DistanceSquared( queryResult.data[i].origin, behaviorTreeEntity.origin );
850  dist_player = DistanceSquared( queryResult.data[i].origin, player.origin );
851 
852  if ( dist_zombie < dist_player )
853  {
854  behaviorTreeEntity SetGoal( queryResult.data[i].origin );
855  ArrayRemoveIndex(level.move_away_points.data, i, false);
856  i--;
857  return ‪BHTN_RUNNING;
858  }
859  }
860  return ‪BHTN_RUNNING;
861 }
862 
863 function ‪zombieIsBeingGrappled( behaviorTreeEntity )
864 {
865  if( ‪IS_TRUE( behaviorTreeEntity.grapple_is_fatal ) )
866  {
867  return true;
868  }
869  return false;
870 }
871 
872 function ‪zombieShouldKnockdown( behaviorTreeEntity )
873 {
874  if ( ‪IS_TRUE( behaviorTreeEntity.knockdown ) )
875  {
876  return true;
877  }
878 
879  return false;
880 }
881 
882 function ‪zombieIsPushed( behaviorTreeEntity )
883 {
884  if ( ‪IS_TRUE( behaviorTreeEntity.pushed ) )
885  {
886  return true;
887  }
888 
889  return false;
890 }
891 
892 function ‪zombieGrappleActionStart( behaviorTreeEntity )
893 {
894  ‪Blackboard::SetBlackBoardAttribute( behaviorTreeEntity, ‪GRAPPLE_DIRECTION, self.grapple_direction );
895 }
896 
897 function private ‪zombieKnockdownActionStart( behaviorTreeEntity )
898 {
899  ‪Blackboard::SetBlackBoardAttribute( behaviorTreeEntity, ‪KNOCKDOWN_DIRECTION, behaviorTreeEntity.knockdown_direction );
900  ‪Blackboard::SetBlackBoardAttribute( behaviorTreeEntity, ‪KNOCKDOWN_TYPE, behaviorTreeEntity.knockdown_type );
901  ‪Blackboard::SetBlackBoardAttribute( behaviorTreeEntity, ‪GETUP_DIRECTION, behaviorTreeEntity.getup_direction );
902 }
903 
904 function private ‪zombieGetupActionTerminate( behaviorTreeEntity )
905 {
906  behaviorTreeEntity.knockdown = false;
907 }
908 
909 function private ‪zombiePushedActionStart( behaviorTreeEntity )
910 {
911  ‪Blackboard::SetBlackBoardAttribute( behaviorTreeEntity, ‪PUSH_DIRECTION, behaviorTreeEntity.push_direction );
912 }
913 
914 function private ‪zombiePushedActionTerminate( behaviorTreeEntity )
915 {
916  behaviorTreeEntity.pushed = false;
917 }
918 
919 function ‪zombieShouldStun( behaviorTreeEntity )
920 {
921  if( ‪IS_TRUE( behaviorTreeEntity.zombie_tesla_hit ) && !‪IS_TRUE( behaviorTreeEntity.tesla_death ) )
922  {
923  return true;
924  }
925  return false;
926 }
927 
928 function ‪zombieStunActionStart( behaviorTreeEntity )
929 {
930 
931 }
932 
933 function ‪zombieStunActionEnd( behaviorTreeEntity )
934 {
935  behaviorTreeEntity.zombie_tesla_hit = false;
936 }
937 
938 function ‪zombieTraverseAction( behaviorTreeEntity, asmStateName )
939 {
940  ‪AiUtility::traverseActionStart( behaviorTreeEntity, asmStateName );
941 
942  behaviorTreeEntity.old_powerups = behaviorTreeEntity.no_powerups;
943 
944  ‪disablePowerups( behaviorTreeEntity );
945 
946  return ‪BHTN_RUNNING;
947 }
948 
949 function ‪zombieTraverseActionTerminate( behaviorTreeEntity, asmStateName )
950 {
951  if ( behaviorTreeEntity ASMGetStatus() == ‪ASM_STATE_COMPLETE )
952  {
953  behaviorTreeEntity.no_powerups = behaviorTreeEntity.old_powerups;
954 
955  if ( !‪IS_TRUE( behaviorTreeEntity.missingLegs ) )
956  {
957  behaviorTreeEntity PushActors( false );
958  behaviorTreeEntity.enablePushTime = GetTime() + ‪ZM_TURN_OFF_PUSH_TIME;
959  }
960  }
961 
962  return ‪BHTN_SUCCESS;
963 }
964 
965 function ‪zombieGotToEntranceCondition( behaviorTreeEntity )
966 {
967  if( ‪IS_TRUE( behaviorTreeEntity.got_to_entrance ) )
968  {
969  return true;
970  }
971 
972  return false;
973 }
974 
975 function ‪zombieGotToAttackSpotCondition( behaviorTreeEntity )
976 {
977  if( ‪IS_TRUE( behaviorTreeEntity.at_entrance_tear_spot ) )
978  {
979  return true;
980  }
981 
982  return false;
983 }
984 
985 function ‪zombieHasAttackSpotAlreadyCondition( behaviorTreeEntity )
986 {
987  //if( IsDefined( behaviorTreeEntity.script_parameters ) && behaviorTreeEntity.script_parameters == "ignore_attack_spot" )
988  //{
989  // return true;
990  //}
991 
992  if( IsDefined( behaviorTreeEntity.attacking_spot_index ) && behaviorTreeEntity.attacking_spot_index >= 0 )
993  {
994  return true;
995  }
996 
997  return false;
998 }
999 
1000 function ‪zombieShouldTearCondition( behaviorTreeEntity )
1001 {
1002  if( IsDefined( behaviorTreeEntity.first_node ) && IsDefined( behaviorTreeEntity.first_node.barrier_chunks ) )
1003  {
1004  if( !‪zm_utility::all_chunks_destroyed( behaviorTreeEntity.first_node, behaviorTreeEntity.first_node.barrier_chunks ) )
1005  {
1006  return true;
1007  }
1008  }
1009 
1010  return false;
1011 }
1012 
1013 function ‪zombieShouldAttackThroughBoardsCondition( behaviorTreeEntity )
1014 {
1015  if ( ‪IS_TRUE( behaviorTreeEntity.missingLegs ) )
1016  return false;
1017 
1018  if( isdefined( behaviorTreeEntity.first_node.zbarrier ) )
1019  {
1020  if( !behaviorTreeEntity.first_node.zbarrier ZBarrierSupportsZombieReachThroughAttacks() )
1021  {
1022  // can only try if all chunks are down
1023  chunks = undefined;
1024  if ( isdefined( behaviorTreeEntity.first_node ) )
1025  {
1026  chunks = ‪zm_utility::get_non_destroyed_chunks( behaviorTreeEntity.first_node, behaviorTreeEntity.first_node.barrier_chunks );
1027  }
1028 
1029  if ( isdefined( chunks ) && chunks.size > 0 )
1030  {
1031  return false;
1032  }
1033  }
1034  }
1035 
1036  if(GetDvarString( "zombie_reachin_freq") == "")
1037  {
1038  SetDvar("zombie_reachin_freq","50");
1039  }
1040  freq = GetDvarInt( "zombie_reachin_freq");
1041 
1042  players = GetPlayers();
1043  attack = false;
1044 
1045  behaviorTreeEntity.player_targets = [];
1046  for(i=0;i<players.size;i++)
1047  {
1048  if ( isAlive( players[i] ) && !isDefined( players[i].revivetrigger ) && distance2d( behaviorTreeEntity.origin, players[i].origin ) <= 109.8 && !‪IS_TRUE( players[i].zombie_vars[ "zombie_powerup_zombie_blood_on" ] ) &&
1049  !‪IS_TRUE( players[i].ignoreme ) )
1050  {
1051  behaviorTreeEntity.player_targets[behaviorTreeEntity.player_targets.size] = players[i];
1052  attack = true;
1053  }
1054  }
1055 
1056  if ( !attack || freq < randomint(100) )
1057  {
1058  return false;
1059  }
1060 
1061  return true;
1062 }
1063 
1064 function ‪zombieShouldTauntCondition( behaviorTreeEntity )
1065 {
1066  if( ‪IS_TRUE( behaviorTreeEntity.missingLegs) )
1067  return false;
1068 
1069  if( !IsDefined(behaviorTreeEntity.first_node.zbarrier) )
1070  {
1071  return false;
1072  }
1073 
1074  if( !behaviorTreeEntity.first_node.zbarrier ZBarrierSupportsZombieTaunts() )
1075  {
1076  return false;
1077  }
1078 
1079  if(GetDvarString( "zombie_taunt_freq") == "")
1080  {
1081  SetDvar("zombie_taunt_freq","5");
1082  }
1083  freq = GetDvarInt( "zombie_taunt_freq");
1084 
1085  if( freq >= randomint(100) )
1086  {
1087  return true;
1088  }
1089  return false;
1090 }
1091 
1092 function ‪zombieShouldEnterPlayableCondition( behaviorTreeEntity )
1093 {
1094  if( IsDefined( behaviorTreeEntity.first_node ) && IsDefined( behaviorTreeEntity.first_node.barrier_chunks ) )
1095  {
1096  if( ‪zm_utility::all_chunks_destroyed( behaviorTreeEntity.first_node, behaviorTreeEntity.first_node.barrier_chunks ) )
1097  {
1098  if( ‪IS_TRUE( behaviorTreeEntity.at_entrance_tear_spot ) && !‪IS_TRUE( behaviorTreeEntity.completed_emerging_into_playable_area ) )
1099  {
1100  return true;
1101  }
1102  }
1103  }
1104 
1105  return false;
1106 }
1107 
1108 function ‪isChunkValidCondition( behaviorTreeEntity )
1109 {
1110  if( IsDefined( behaviorTreeEntity.chunk ) )
1111  {
1112  return true;
1113  }
1114 
1115  return false;
1116 }
1117 
1118 function ‪inPlayableArea( behaviorTreeEntity )
1119 {
1120  if ( ‪IS_TRUE( behaviorTreeEntity.completed_emerging_into_playable_area ) )
1121  {
1122  return true;
1123  }
1124 
1125  return false;
1126 }
1127 
1128 function ‪shouldSkipTeardown( behaviorTreeEntity )
1129 {
1130  if ( behaviorTreeEntity ‪zm_spawner::should_skip_teardown( behaviorTreeEntity.find_flesh_struct_string ) )
1131  {
1132  return true;
1133  }
1134 
1135  return false;
1136 }
1137 
1138 function ‪zombieIsThinkDone( behaviorTreeEntity )
1139 {
1140  /#
1141  if( ‪IS_TRUE( behaviorTreeEntity.is_rat_test ) )
1142  return false;
1143  #/
1144 
1145 
1146  if ( ‪IS_TRUE( behaviorTreeEntity.zombie_think_done ) )
1147  {
1148  return true;
1149  }
1150 
1151  return false;
1152 }
1153 
1154 function ‪zombieIsAtGoal( behaviorTreeEntity )
1155 {
1156  isAtScriptGoal = behaviorTreeEntity IsAtGoal();
1157 
1158  return isAtScriptGoal;
1159 }
1160 
1161 function ‪zombieIsAtEntrance( behaviorTreeEntity )
1162 {
1163  isAtScriptGoal = behaviorTreeEntity IsAtGoal();
1164  isAtEntrance = IsDefined( behaviorTreeEntity.first_node ) && isAtScriptGoal;
1165 
1166  return isAtEntrance;
1167 }
1168 
1169 // ------- ZOMBIE SERVICES -----------//
1170 function ‪getChunkService( behaviorTreeEntity )
1171 {
1172  behaviorTreeEntity.chunk = ‪zm_utility::get_closest_non_destroyed_chunk( behaviorTreeEntity.origin, behaviorTreeEntity.first_node, behaviorTreeEntity.first_node.barrier_chunks );
1173  if( IsDefined( behaviorTreeEntity.chunk ) )
1174  {
1175  behaviorTreeEntity.first_node.zbarrier SetZBarrierPieceState(behaviorTreeEntity.chunk, "targetted_by_zombie");
1176  behaviorTreeEntity.first_node thread ‪zm_spawner::check_zbarrier_piece_for_zombie_death( behaviorTreeEntity.chunk, behaviorTreeEntity.first_node.zbarrier, behaviorTreeEntity );
1177  }
1178 }
1179 
1180 function ‪updateChunkService( behaviorTreeEntity )
1181 {
1182  while( 0 < behaviorTreeEntity.first_node.zbarrier.chunk_health[behaviorTreeEntity.chunk] )
1183  {
1184  behaviorTreeEntity.first_node.zbarrier.chunk_health[behaviorTreeEntity.chunk]--;
1185  }
1186  behaviorTreeEntity.lastchunk_destroy_time = GetTime();
1187 }
1188 
1189 function ‪updateAttackSpotService( behaviorTreeEntity )
1190 {
1191  if ( ‪IS_TRUE( behaviorTreeEntity.marked_for_death ) || behaviorTreeEntity.health < 0 )
1192  {
1193  return false;
1194  }
1195 
1196  if( !IsDefined( behaviorTreeEntity.attacking_spot ) )
1197  {
1198  if ( !behaviorTreeEntity ‪zm_spawner::get_attack_spot( behaviorTreeEntity.first_node ) )
1199  {
1200  //if( IsDefined( behaviorTreeEntity.script_parameters ) && behaviorTreeEntity.script_parameters == "ignore_attack_spot" )
1201  //{
1202  // behaviorTreeEntity.goalradius = ZM_ATTACKING_SPOT_DIST;
1203  // behaviorTreeEntity SetGoal( behaviorTreeEntity.first_node );
1204  // return true;
1205  //}
1206 
1207  return false;
1208  }
1209  }
1210 
1211  if( IsDefined( behaviorTreeEntity.attacking_spot ) )
1212  {
1213  behaviorTreeEntity.goalradius = ‪ZM_ATTACKING_SPOT_DIST;
1214  behaviorTreeEntity SetGoal( behaviorTreeEntity.attacking_spot );
1215 
1216  if ( behaviorTreeEntity IsAtGoal() )
1217  {
1218  behaviorTreeEntity.at_entrance_tear_spot = true;
1219  }
1220 
1221  return true;
1222  }
1223 
1224  return false;
1225 }
1226 
1227 function ‪findNodesService( behaviorTreeEntity )
1228 {
1229  node = undefined;
1230 
1231  behaviorTreeEntity.entrance_nodes = [];
1232 
1233  if( IsDefined( behaviorTreeEntity.find_flesh_struct_string ) )
1234  {
1235  if ( behaviorTreeEntity.find_flesh_struct_string == "find_flesh" )
1236  {
1237  return false;
1238  }
1239 
1240  for( i=0; i<level.exterior_goals.size; i++ )
1241  {
1242  if( IsDefined(level.exterior_goals[i].script_string) && level.exterior_goals[i].script_string == behaviorTreeEntity.find_flesh_struct_string )
1243  {
1244  node = level.exterior_goals[i];
1245  break;
1246  }
1247  }
1248 
1249  behaviorTreeEntity.entrance_nodes[behaviorTreeEntity.entrance_nodes.size] = node;
1250 
1251  assert( IsDefined( node ), "Did not find an entrance node with .script_string:" + behaviorTreeEntity.find_flesh_struct_string+ "!!! [Fix this!]" );
1252 
1253  behaviorTreeEntity.first_node = node;
1254  //behaviorTreeEntity.pushable = false; //turn off pushable
1255  behaviorTreeEntity.goalradius = ‪ZM_ENTRANCE_DIST;
1256  behaviorTreeEntity SetGoal( node.origin );
1257 
1258  // zombie spawned within the entrance
1259  if ( ‪zombieIsAtEntrance( behaviorTreeEntity ) )
1260  {
1261  behaviorTreeEntity.got_to_entrance = true;
1262  }
1263 
1264  return true;
1265  }
1266 }
1267 
1268 function ‪zombieAttackableObjectService( behaviorTreeEntity )
1269 {
1270  if ( !behaviorTreeEntity ‪ai::has_behavior_attribute( "use_attackable" ) || !behaviorTreeEntity ‪ai::get_behavior_attribute( "use_attackable" ) )
1271  {
1272  behaviorTreeEntity.attackable = undefined;
1273  return false;
1274  }
1275 
1276  if ( ‪IS_TRUE( behaviorTreeEntity.missingLegs ) )
1277  {
1278  behaviorTreeEntity.attackable = undefined;
1279  return false;
1280  }
1281 
1282  if ( ‪IS_TRUE( behaviorTreeEntity.aat_turned ) )
1283  {
1284  behaviorTreeEntity.attackable = undefined;
1285  return false;
1286  }
1287 
1288  if ( !IsDefined( behaviorTreeEntity.attackable ) )
1289  {
1290  behaviorTreeEntity.attackable = ‪zm_attackables::get_attackable();
1291  }
1292  else
1293  {
1294  if ( !‪IS_TRUE( behaviorTreeEntity.attackable.is_active ) )
1295  {
1296  behaviorTreeEntity.attackable = undefined;
1297  }
1298  }
1299 }
1300 
1301 function ‪zombieMoveToEntranceAction( behaviorTreeEntity, asmStateName )
1302 {
1303  behaviorTreeEntity.got_to_entrance = false;
1304  ‪AnimationStateNetworkUtility::RequestState( behaviorTreeEntity, asmStateName );
1305 
1306  return ‪BHTN_RUNNING;
1307 }
1308 
1309 function ‪zombieMoveToEntranceActionTerminate( behaviorTreeEntity, asmStateName )
1310 {
1311  if ( ‪zombieIsAtEntrance( behaviorTreeEntity ) )
1312  {
1313  behaviorTreeEntity.got_to_entrance = true;
1314  }
1315 
1316  return ‪BHTN_SUCCESS;
1317 }
1318 
1319 function ‪zombieMoveToAttackSpotAction( behaviorTreeEntity, asmStateName )
1320 {
1321  behaviorTreeEntity.at_entrance_tear_spot = false;
1322  ‪AnimationStateNetworkUtility::RequestState( behaviorTreeEntity, asmStateName );
1323 
1324  return ‪BHTN_RUNNING;
1325 }
1326 
1327 function ‪zombieMoveToAttackSpotActionTerminate( behaviorTreeEntity, asmStateName )
1328 {
1329  behaviorTreeEntity.at_entrance_tear_spot = true;
1330 
1331  return ‪BHTN_SUCCESS;
1332 }
1333 
1334 // ------- ZOMBIE TEAR DOWN -----------//
1335 function ‪zombieHoldBoardAction( behaviorTreeEntity, asmStateName )
1336 {
1337  behaviortreeentity.keepClaimedNode = true;
1338  ‪Blackboard::SetBlackBoardAttribute( behaviorTreeEntity, ‪WHICH_BOARD_PULL_TYPE, int( behaviorTreeEntity.chunk ) );
1339  ‪Blackboard::SetBlackBoardAttribute( behaviorTreeEntity, ‪BOARD_ATTACK_SPOT, float( behaviorTreeEntity.attacking_spot_index ) );
1340 
1341  boardActionAST = behaviorTreeEntity ASTSearch( IString( asmStateName ) );
1342  boardActionAnimation = ‪AnimationStateNetworkUtility::SearchAnimationMap( behaviorTreeEntity, boardActionAST[ ‪ASM_ALIAS_ATTRIBUTE ] );
1343  //behaviorTreeEntity AnimScripted( "grab_anim", behaviorTreeEntity.first_node.zbarrier.origin, behaviorTreeEntity.first_node.zbarrier.angles, boardActionAnimation );
1344 
1345  //origin = GetStartOrigin( behaviorTreeEntity.first_node.zbarrier.origin, behaviorTreeEntity.first_node.zbarrier.angles, boardActionAnimation );
1346  //angles = GetStartAngles( behaviorTreeEntity.first_node.zbarrier.origin, behaviorTreeEntity.first_node.zbarrier.angles, boardActionAnimation );
1347  //
1348  //behaviorTreeEntity ForceTeleport( origin, angles, true );
1349 
1350  ‪AnimationStateNetworkUtility::RequestState( behaviorTreeEntity, asmStateName );
1351 
1352  return ‪BHTN_RUNNING;
1353 }
1354 
1355 function ‪zombieHoldBoardActionTerminate( behaviorTreeEntity, asmStateName )
1356 {
1357  behaviortreeentity.keepClaimedNode = false;
1358  return ‪BHTN_SUCCESS;
1359 }
1360 
1361 function ‪zombieGrabBoardAction( behaviorTreeEntity, asmStateName )
1362 {
1363  behaviortreeentity.keepClaimedNode = true;
1364 
1365  ‪Blackboard::SetBlackBoardAttribute( behaviorTreeEntity, ‪WHICH_BOARD_PULL_TYPE, int( behaviorTreeEntity.chunk ) );
1366  ‪Blackboard::SetBlackBoardAttribute( behaviorTreeEntity, ‪BOARD_ATTACK_SPOT, float( behaviorTreeEntity.attacking_spot_index ) );
1367 
1368  boardActionAST = behaviorTreeEntity ASTSearch( IString( asmStateName ) );
1369  boardActionAnimation = ‪AnimationStateNetworkUtility::SearchAnimationMap( behaviorTreeEntity, boardActionAST[ ‪ASM_ALIAS_ATTRIBUTE ] );
1370  //behaviorTreeEntity AnimScripted( "grab_anim", behaviorTreeEntity.first_node.zbarrier.origin, behaviorTreeEntity.first_node.zbarrier.angles, boardActionAnimation );
1371 
1372  //origin = GetStartOrigin( behaviorTreeEntity.first_node.zbarrier.origin, behaviorTreeEntity.first_node.zbarrier.angles, boardActionAnimation );
1373  //angles = GetStartAngles( behaviorTreeEntity.first_node.zbarrier.origin, behaviorTreeEntity.first_node.zbarrier.angles, boardActionAnimation );
1374  //
1375  //behaviorTreeEntity ForceTeleport( origin, angles, true );
1376 
1377  ‪AnimationStateNetworkUtility::RequestState( behaviorTreeEntity, asmStateName );
1378 
1379  return ‪BHTN_RUNNING;
1380 }
1381 
1382 function ‪zombieGrabBoardActionTerminate( behaviorTreeEntity, asmStateName )
1383 {
1384  behaviortreeentity.keepClaimedNode = false;
1385  return ‪BHTN_SUCCESS;
1386 }
1387 
1388 function ‪zombiePullBoardAction( behaviorTreeEntity, asmStateName )
1389 {
1390  behaviortreeentity.keepClaimedNode = true;
1391  ‪Blackboard::SetBlackBoardAttribute( behaviorTreeEntity, ‪WHICH_BOARD_PULL_TYPE, int( behaviorTreeEntity.chunk ) );
1392  ‪Blackboard::SetBlackBoardAttribute( behaviorTreeEntity, ‪BOARD_ATTACK_SPOT, float( behaviorTreeEntity.attacking_spot_index ) );
1393 
1394  boardActionAST = behaviorTreeEntity ASTSearch( IString( asmStateName ) );
1395  boardActionAnimation = ‪AnimationStateNetworkUtility::SearchAnimationMap( behaviorTreeEntity, boardActionAST[ ‪ASM_ALIAS_ATTRIBUTE ] );
1396  //behaviorTreeEntity AnimScripted( "grab_anim", behaviorTreeEntity.first_node.zbarrier.origin, behaviorTreeEntity.first_node.zbarrier.angles, boardActionAnimation );
1397 
1398  //origin = GetStartOrigin( behaviorTreeEntity.first_node.zbarrier.origin, behaviorTreeEntity.first_node.zbarrier.angles, boardActionAnimation );
1399  //angles = GetStartAngles( behaviorTreeEntity.first_node.zbarrier.origin, behaviorTreeEntity.first_node.zbarrier.angles, boardActionAnimation );
1400  //
1401  //behaviorTreeEntity ForceTeleport( origin, angles, true );
1402 
1403  ‪AnimationStateNetworkUtility::RequestState( behaviorTreeEntity, asmStateName );
1404 
1405  return ‪BHTN_RUNNING;
1406 }
1407 
1408 function ‪zombiePullBoardActionTerminate( behaviorTreeEntity, asmStateName )
1409 {
1410  behaviortreeentity.keepClaimedNode = false;
1411 
1412  //to prevent the zombie from being deleted by the failsafe system
1413  self.lastchunk_destroy_time = GetTime();
1414 
1415  return ‪BHTN_SUCCESS;
1416 }
1417 
1418 // ------- ZOMBIE MELEE BEHIND BOARDS -----------//
1419 
1420 function ‪zombieAttackThroughBoardsAction( behaviorTreeEntity, asmStateName )
1421 {
1422  behaviortreeentity.keepClaimedNode = true;
1423  behaviortreeentity.boardAttack = true;
1424 
1425  ‪AnimationStateNetworkUtility::RequestState( behaviorTreeEntity, asmStateName );
1426 
1427  return ‪BHTN_RUNNING;
1428 }
1429 
1430 function ‪zombieAttackThroughBoardsActionTerminate( behaviorTreeEntity, asmStateName )
1431 {
1432  behaviortreeentity.keepClaimedNode = false;
1433  behaviortreeentity.boardAttack = false;
1434 
1435 
1436  return ‪BHTN_SUCCESS;
1437 }
1438 
1439 // ------- ZOMBIE TAUNT -----------//
1440 
1441 function ‪zombieTauntAction( behaviorTreeEntity, asmStateName )
1442 {
1443  behaviortreeentity.keepClaimedNode = true;
1444 
1445  ‪AnimationStateNetworkUtility::RequestState( behaviorTreeEntity, asmStateName );
1446 
1447  return ‪BHTN_RUNNING;
1448 }
1449 
1450 function ‪zombieTauntActionTerminate( behaviorTreeEntity, asmStateName )
1451 {
1452  behaviortreeentity.keepClaimedNode = false;
1453 
1454  return ‪BHTN_SUCCESS;
1455 }
1456 
1457 function ‪zombieMantleAction( behaviorTreeEntity, asmStateName )
1458 {
1459  behaviorTreeEntity.clamptonavmesh = 0;
1460  if( IsDefined( behaviorTreeEntity.attacking_spot_index ) )
1461  {
1462  behaviorTreeEntity.saved_attacking_spot_index = behaviorTreeEntity.attacking_spot_index;
1463  ‪Blackboard::SetBlackBoardAttribute( behaviorTreeEntity, ‪BOARD_ATTACK_SPOT, float( behaviorTreeEntity.attacking_spot_index ) );
1464  }
1465 
1466  behaviorTreeEntity.isInMantleAction = true;
1467 
1468  // the attack spot needs to be cleared when a zombie enters playable area
1469  behaviorTreeEntity ‪zombie_utility::reset_attack_spot();
1470 
1471  ‪AnimationStateNetworkUtility::RequestState( behaviorTreeEntity, asmStateName );
1472 
1473  return ‪BHTN_RUNNING;
1474 }
1475 
1476 function ‪zombieMantleActionTerminate( behaviorTreeEntity, asmStateName )
1477 {
1478  behaviorTreeEntity.clamptonavmesh = 1;
1479 
1480  behaviorTreeEntity.isInMantleAction = undefined;
1481 
1482  behaviorTreeEntity ‪zm_behavior_utility::enteredPlayableArea();
1483 
1484  return ‪BHTN_SUCCESS;
1485 }
1486 
1487 // ------- ZOMBIE MOCOMP -----------//
1488 function ‪boardTearMocompStart( entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration )
1489 {
1490  origin = GetStartOrigin( entity.first_node.zbarrier.origin, entity.first_node.zbarrier.angles, mocompAnim );
1491  angles = GetStartAngles( entity.first_node.zbarrier.origin, entity.first_node.zbarrier.angles, mocompAnim );
1492 
1493  entity ForceTeleport( origin, angles, true );
1494 
1495  entity.pushable = false;
1496  entity.blockingPain = true;
1497 
1498  entity AnimMode( ‪AI_ANIM_USE_BOTH_DELTAS_NOCLIP, true );
1499  entity OrientMode( "face angle", angles[1] );
1500 }
1501 
1502 function ‪boardTearMocompUpdate( entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration )
1503 {
1504  entity AnimMode( ‪AI_ANIM_USE_BOTH_DELTAS_NOCLIP, false );
1505  entity.pushable = false;
1506  entity.blockingPain = true;
1507 }
1508 
1509 function ‪barricadeEnterMocompStart( entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration )
1510 {
1511  origin = GetStartOrigin( entity.first_node.zbarrier.origin, entity.first_node.zbarrier.angles, mocompAnim );
1512  angles = GetStartAngles( entity.first_node.zbarrier.origin, entity.first_node.zbarrier.angles, mocompAnim );
1513 
1514  if( isdefined(entity.mocomp_barricade_offset) )
1515  {
1516  origin = origin + AnglesToForward(angles) * entity.mocomp_barricade_offset;
1517  }
1518 
1519  entity ForceTeleport( origin, angles, true );
1520 
1521  entity AnimMode( ‪AI_ANIM_USE_BOTH_DELTAS_NOCLIP, false );
1522  entity OrientMode( "face angle", angles[1] );
1523 
1524  entity.pushable = false;
1525  entity.blockingPain = true;
1526  entity PathMode( "dont move" );
1527  entity.useGoalAnimWeight = true;
1528 }
1529 
1530 function ‪barricadeEnterMocompUpdate( entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration )
1531 {
1532  entity AnimMode( ‪AI_ANIM_USE_BOTH_DELTAS_NOCLIP, false );
1533 
1534  entity.pushable = false;
1535 }
1536 
1537 function ‪barricadeEnterMocompTerminate( entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration )
1538 {
1539  entity.pushable = true;
1540  entity.blockingPain = false;
1541  entity PathMode( "move allowed" );
1542  entity.useGoalAnimWeight = false;
1543 
1544  entity AnimMode( ‪AI_ANIM_MOVE_CODE, false );
1545  entity OrientMode( "face motion" );
1546 }
1547 
1548 function ‪barricadeEnterMocompNoZStart( entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration )
1549 {
1550  zbarrier_origin = (entity.first_node.zbarrier.origin[0], entity.first_node.zbarrier.origin[1], entity.origin[2]);
1551 
1552  origin = GetStartOrigin( zbarrier_origin, entity.first_node.zbarrier.angles, mocompAnim );
1553  angles = GetStartAngles( zbarrier_origin, entity.first_node.zbarrier.angles, mocompAnim );
1554 
1555  if( isdefined(entity.mocomp_barricade_offset) )
1556  {
1557  origin = origin + AnglesToForward(angles) * entity.mocomp_barricade_offset;
1558  }
1559 
1560  entity ForceTeleport( origin, angles, true );
1561 
1562  entity AnimMode( ‪AI_ANIM_USE_BOTH_DELTAS_NOCLIP, false );
1563  entity OrientMode( "face angle", angles[1] );
1564 
1565  entity.pushable = false;
1566  entity.blockingPain = true;
1567  entity PathMode( "dont move" );
1568  entity.useGoalAnimWeight = true;
1569 }
1570 
1571 function ‪barricadeEnterMocompNoZUpdate( entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration )
1572 {
1573  entity AnimMode( ‪AI_ANIM_USE_BOTH_DELTAS_NOCLIP, false );
1574  entity.pushable = false;
1575 }
1576 
1577 function ‪barricadeEnterMocompNoZTerminate( entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration )
1578 {
1579  entity.pushable = true;
1580  entity.blockingPain = false;
1581  entity PathMode( "move allowed" );
1582  entity.useGoalAnimWeight = false;
1583 
1584  entity AnimMode( ‪AI_ANIM_MOVE_CODE, false );
1585  entity OrientMode( "face motion" );
1586 }
1587 
1588 // ------- ZM NOTETRACK HANDLERS -----------//
1589 function ‪notetrackBoardTear( animationEntity )
1590 {
1591  if( IsDefined( animationEntity.chunk ) )
1592  {
1593  animationEntity.first_node.zbarrier SetZBarrierPieceState( animationEntity.chunk, "opening" );
1594  }
1595 }
1596 
1597 function ‪notetrackBoardMelee( animationEntity )
1598 {
1599  assert( animationEntity.meleeWeapon != level.weaponnone, "Actor does not have a melee weapon" );
1600  // just hit a player
1601  if ( IsDefined( animationEntity.first_node ) )
1602  {
1603  meleeDistSq = ‪ZM_BOARD_MELEE_DIST_SQ;
1604 
1605  if ( IsDefined( level.attack_player_thru_boards_range ) )
1606  {
1607  meleeDistSq = level.attack_player_thru_boards_range * level.attack_player_thru_boards_range;
1608  }
1609 
1610  triggerDistSq = ‪ZM_BOARD_TRIGGER_DIST_SQ;
1611 
1612  for ( i = 0; i < animationEntity.player_targets.size; i++ )
1613  {
1614  playerDistSq = Distance2DSquared( animationEntity.player_targets[i].origin, animationEntity.origin );
1615  heightDiff = abs( animationEntity.player_targets[i].origin[2] - animationEntity.origin[2] ); // be sure we're on the same floor
1616  if ( playerDistSq < meleeDistSq && (heightDiff * heightDiff) < meleeDistSq )
1617  {
1618  playerTriggerDistSq = Distance2DSquared( animationEntity.player_targets[i].origin, animationEntity.first_node.trigger_location.origin );
1619  heightDiff = abs( animationEntity.player_targets[i].origin[2] - animationEntity.first_node.trigger_location.origin[2] ); // be sure we're on the same floor
1620  if ( playerTriggerDistSq < triggerDistSq && (heightDiff * heightDiff) < triggerDistSq )
1621  {
1622  animationEntity.player_targets[i] DoDamage( animationEntity.meleeWeapon.meleeDamage, animationEntity.origin, self, self, "none", "MOD_MELEE" );
1623  break;
1624  }
1625  }
1626  }
1627  }
1628  else
1629  {
1630  animationentity Melee();
1631  }
1632 }
1633 
1635 {
1636  zombies = GetAiSpeciesArray( level.zombie_team, "all" );
1637 
1638  zombie_enemy = undefined;
1639  closest_dist = undefined;
1640 
1641  foreach( zombie in zombies )
1642  {
1643  if ( IsAlive( zombie ) && ‪IS_TRUE( zombie.completed_emerging_into_playable_area ) && !‪zm_utility::is_magic_bullet_shield_enabled( zombie ) &&
1644  (zombie.archetype == ‪ARCHETYPE_ZOMBIE || ‪IS_TRUE(zombie.canBeTargetedByTurnedZombies)) )
1645  {
1646  dist = DistanceSquared( self.origin, zombie.origin );
1647  if ( !isdefined( closest_dist ) || dist < closest_dist )
1648  {
1649  closest_dist = dist;
1650  zombie_enemy = zombie;
1651  }
1652  }
1653  }
1654 
1655  self.favoriteenemy = zombie_enemy;
1656 
1657  if ( isdefined( self.favoriteenemy ) )
1658  {
1659  self SetGoal( self.favoriteenemy.origin );
1660  }
1661  else
1662  {
1663  self SetGoal( self.origin );
1664  }
1665 }
1666 
1667 function ‪zombieBlackHoleBombPullStart( entity, asmStateName )
1668 {
1669  entity.pullTime = GetTime();
1670  entity.pullOrigin = entity.origin;
1671 
1672  ‪AnimationStateNetworkUtility::RequestState( entity, asmStateName );
1673 
1675 
1676  if( IsDefined( entity.damageOrigin ) )
1677  {
1678  entity.n_zombie_custom_goal_radius = 8;
1679  entity.v_zombie_custom_goal_pos = entity.damageOrigin;
1680  }
1681 
1682  return ‪BHTN_RUNNING;
1683 }
1684 
1685 #define SOUL_BURST_RANGE 2500 //50*50
1686 #define PULLED_IN_RANGE 16384 //128*128
1687 #define INNER_RANGE 1048576 //1024*1024
1688 #define OUTER_RANGE 4227136 //2056*2056
1689 
1691 {
1692  dist_to_bomb = DistanceSquared( entity.origin, entity.damageOrigin );
1693 
1694  if( dist_to_bomb < ‪PULLED_IN_RANGE )
1695  {
1696  entity._black_hole_bomb_collapse_death = true;
1697  }
1698  else if( dist_to_bomb < ‪INNER_RANGE )
1699  {
1701  }
1702  else if( dist_to_bomb < ‪OUTER_RANGE )
1703  {
1705  }
1706 }
1707 
1708 function ‪zombieBlackHoleBombPullUpdate( entity, asmStateName )
1709 {
1710  if( !IsDefined( entity.interdimensional_gun_kill ) )
1711  {
1712  return ‪BHTN_SUCCESS;
1713  }
1714 
1716 
1717  if( ‪IS_TRUE( entity._black_hole_bomb_collapse_death ) )
1718  {
1719  entity.skipAutoRagdoll = true;
1720  entity DoDamage( entity.health + 666, entity.origin + ( 0, 0, 50 ), entity.interdimensional_gun_attacker, undefined, undefined, "MOD_CRUSH" );
1721  return ‪BHTN_SUCCESS;
1722  }
1723 
1724  if( IsDefined( entity.damageOrigin ) )
1725  {
1726  entity.v_zombie_custom_goal_pos = entity.damageOrigin;
1727  }
1728 
1729  if ( !‪IS_TRUE( entity.missingLegs ) && ( GetTime() - entity.pullTime > ‪ZM_MOVE_TIME ) )
1730  {
1731  distSq = Distance2DSquared( entity.origin, entity.pullOrigin );
1732  if ( distSq < ‪ZM_MOVE_DIST_SQ )
1733  {
1734  entity SetAvoidanceMask( "avoid all" );
1735  entity.cant_move = true;
1736 
1737  if ( IsDefined( entity.cant_move_cb ) )
1738  {
1739  entity [[ entity.cant_move_cb ]]();
1740  }
1741  }
1742  else
1743  {
1744  entity SetAvoidanceMask( "avoid none" );
1745  entity.cant_move = false;
1746  }
1747 
1748  entity.pullTime = GetTime();
1749  entity.pullOrigin = entity.origin;
1750  }
1751 
1752  return ‪BHTN_RUNNING;
1753 }
1754 
1755 function ‪zombieBlackHoleBombPullEnd( entity, asmStateName )
1756 {
1757  entity.v_zombie_custom_goal_pos = undefined;
1758  entity.n_zombie_custom_goal_radius = undefined;
1759 
1760  entity.pullTime = undefined;
1761  entity.pullOrigin = undefined;
1762 
1763  return ‪BHTN_SUCCESS;
1764 }
1765 
1767 {
1768  if( !‪IS_TRUE( self.missingLegs) && ‪IS_TRUE( entity.interdimensional_gun_kill ) && !‪IS_TRUE( entity._black_hole_bomb_collapse_death ) )
1769  {
1770  return true;
1771  }
1772 
1773  return false;
1774 }
1775 
1777 {
1778  if( ‪IS_TRUE( entity._black_hole_bomb_collapse_death ) )
1779  {
1780  return true;
1781  }
1782 
1783  return false;
1784 }
1785 
1786 function ‪zombieKilledByBlackHoleBombStart( entity, asmStateName )
1787 {
1788  ‪AnimationStateNetworkUtility::RequestState( entity, asmStateName );
1789 
1790  if( IsDefined( level.black_hole_bomb_death_start_func ) )
1791  {
1792  entity thread [[level.black_hole_bomb_death_start_func]]( entity.damageOrigin, entity.interdimensional_gun_projectile );
1793  }
1794 
1795  return ‪BHTN_RUNNING;
1796 }
1797 
1798 function ‪zombieKilledByBlackHoleBombEnd( entity, asmStateName )
1799 {
1800  if( IsDefined( level._effect ) && IsDefined( level._effect[ "black_hole_bomb_zombie_gib" ] ) )
1801  {
1802  fxOrigin = entity GetTagOrigin( "tag_origin" );
1803 
1804  forward = AnglesToForward( entity.angles );
1805 
1806  PlayFX( level._effect[ "black_hole_bomb_zombie_gib" ], fxOrigin, forward, ( 0, 0, 1 ) );
1807  }
1808  entity Hide();
1809 
1810  return ‪BHTN_SUCCESS;
1811 }
1812 
1813 function ‪zombieBHBBurst( entity )
1814 {
1815  if( IsDefined( level._effect ) && IsDefined( level._effect[ "black_hole_bomb_zombie_destroy" ] ) )
1816  {
1817  fxOrigin = entity GetTagOrigin( "tag_origin" );
1818  ‪PlayFx(level._effect[ "black_hole_bomb_zombie_destroy" ], fxOrigin );
1819  }
1820 
1821  if( IsDefined( entity.interdimensional_gun_projectile ) )
1822  {
1823  entity.interdimensional_gun_projectile notify( "black_hole_bomb_kill" );
1824  }
1825 }
‪zombieMoveToAttackSpotAction
‪function zombieMoveToAttackSpotAction(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1319
‪zombieIsAtGoal
‪function zombieIsAtGoal(behaviorTreeEntity)
Definition: _zm_behavior.gsc:1154
‪run_ignore_player_handler
‪function run_ignore_player_handler()
Definition: zombie_utility.gsc:3030
‪zombieKilledWhileGettingPulled
‪function zombieKilledWhileGettingPulled(entity)
Definition: _zm_behavior.gsc:1766
‪zombieTraverseAction
‪function zombieTraverseAction(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:938
‪zombieKnockdownActionStart
‪function private zombieKnockdownActionStart(behaviorTreeEntity)
Definition: _zm_behavior.gsc:897
‪zombieIsAtEntrance
‪function zombieIsAtEntrance(behaviorTreeEntity)
Definition: _zm_behavior.gsc:1161
‪getChunkService
‪function getChunkService(behaviorTreeEntity)
Definition: _zm_behavior.gsc:1170
‪boardTearMocompUpdate
‪function boardTearMocompUpdate(entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration)
Definition: _zm_behavior.gsc:1502
‪ZIGZAG_DISTANCE_MIN
‪#define ZIGZAG_DISTANCE_MIN
Definition: _zm_behavior.gsh:33
‪ZM_TURN_OFF_PUSH_TIME
‪#define ZM_TURN_OFF_PUSH_TIME
Definition: _zm_behavior.gsh:25
‪update_valid_players
‪function update_valid_players(origin, ignore_player)
Definition: _zm_utility.gsc:1519
‪zombieStunActionEnd
‪function zombieStunActionEnd(behaviorTreeEntity)
Definition: _zm_behavior.gsc:933
‪ASM_STATE_COMPLETE
‪#define ASM_STATE_COMPLETE
Definition: animation_state_machine.gsh:15
‪ZM_ENTRANCE_DIST
‪#define ZM_ENTRANCE_DIST
Definition: _zm_behavior.gsh:2
‪zombiePullBoardAction
‪function zombiePullBoardAction(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1388
‪BOARD_ATTACK_SPOT
‪#define BOARD_ATTACK_SPOT
Definition: blackboard.gsh:171
‪BLACKHOLEBOMB_PULL_SLOW
‪#define BLACKHOLEBOMB_PULL_SLOW
Definition: blackboard.gsh:250
‪BT_REGISTER_API
‪#define BT_REGISTER_API(name, function)
Definition: behavior.gsh:1
‪updateChunkService
‪function updateChunkService(behaviorTreeEntity)
Definition: _zm_behavior.gsc:1180
‪zombieKilledByBlackHoleBombCondition
‪function zombieKilledByBlackHoleBombCondition(entity)
Definition: _zm_behavior.gsc:1776
‪findZombieEnemy
‪function findZombieEnemy()
Definition: _zm_behavior.gsc:1634
‪zombieShouldMoveAwayCondition
‪function zombieShouldMoveAwayCondition(behaviorTreeEntity)
Definition: _zm_behavior.gsc:788
‪zombieGetupActionTerminate
‪function private zombieGetupActionTerminate(behaviorTreeEntity)
Definition: _zm_behavior.gsc:904
‪ZM_MOVE_TIME
‪#define ZM_MOVE_TIME
Definition: zombie.gsh:52
‪ZIGZAG_DISTANCE_MAX
‪#define ZIGZAG_DISTANCE_MAX
Definition: _zm_behavior.gsh:34
‪WHICH_BOARD_PULL_TYPE
‪#define WHICH_BOARD_PULL_TYPE
Definition: blackboard.gsh:170
‪zombieBHBBurst
‪function zombieBHBBurst(entity)
Definition: _zm_behavior.gsc:1813
‪get_closest_non_destroyed_chunk
‪function get_closest_non_destroyed_chunk(origin, barrier, barrier_chunks)
Definition: _zm_utility.gsc:2392
‪PULLED_IN_RANGE
‪#define PULLED_IN_RANGE
Definition: _zm_behavior.gsc:1686
‪BHTN_RUNNING
‪#define BHTN_RUNNING
Definition: behavior_tree.gsh:9
‪notetrackBoardTear
‪function notetrackBoardTear(animationEntity)
Definition: _zm_behavior.gsc:1589
‪ASM_REGISTER_NOTETRACK_HANDLER
‪#define ASM_REGISTER_NOTETRACK_HANDLER(notetrackname, handlerfunction)
Definition: animation_state_machine.gsh:4
‪GETUP_DIRECTION
‪#define GETUP_DIRECTION
Definition: blackboard.gsh:204
‪zombieMoveToAttackSpotActionTerminate
‪function zombieMoveToAttackSpotActionTerminate(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1327
‪zombiePullBoardActionTerminate
‪function zombiePullBoardActionTerminate(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1408
‪zombiePushedActionTerminate
‪function private zombiePushedActionTerminate(behaviorTreeEntity)
Definition: _zm_behavior.gsc:914
‪zombieMoveToEntranceAction
‪function zombieMoveToEntranceAction(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1301
‪SetBlackBoardAttribute
‪function SetBlackBoardAttribute(entity, attributeName, attributeValue)
Definition: blackboard.gsc:56
‪enablePowerups
‪function enablePowerups(behaviorTreeEntity)
Definition: _zm_behavior.gsc:808
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪get_attack_spot
‪function get_attack_spot(node)
Definition: _zm_spawner.gsc:1170
‪NOTETRACK_ZOMBIES_BOARD_MELEE
‪#define NOTETRACK_ZOMBIES_BOARD_MELEE
Definition: _zm_behavior.gsh:17
‪barricadeEnterMocompStart
‪function barricadeEnterMocompStart(entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration)
Definition: _zm_behavior.gsc:1509
‪SQR
‪#define SQR(__var)
Definition: shared.gsh:293
‪zombieKilledByBlackHoleBombStart
‪function zombieKilledByBlackHoleBombStart(entity, asmStateName)
Definition: _zm_behavior.gsc:1786
‪zombieIsBeingGrappled
‪function zombieIsBeingGrappled(behaviorTreeEntity)
Definition: _zm_behavior.gsc:863
‪INNER_RANGE
‪#define INNER_RANGE
Definition: _zm_behavior.gsc:1687
‪zombieMoveAway
‪function zombieMoveAway(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:813
‪GRAPPLE_DIRECTION
‪#define GRAPPLE_DIRECTION
Definition: blackboard.gsh:136
‪zombieTauntAction
‪function zombieTauntAction(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1441
‪barricadeEnterMocompNoZUpdate
‪function barricadeEnterMocompNoZUpdate(entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration)
Definition: _zm_behavior.gsc:1571
‪SearchAnimationMap
‪function SearchAnimationMap(entity, aliasName)
Definition: animation_state_machine_utility.gsc:9
‪zombieAttackableObjectService
‪function zombieAttackableObjectService(behaviorTreeEntity)
Definition: _zm_behavior.gsc:1268
‪reset_attack_spot
‪function reset_attack_spot()
Definition: zombie_utility.gsc:1671
‪check_point_in_playable_area
‪function check_point_in_playable_area(origin)
Definition: _zm_utility.gsc:480
‪zombieHasAttackSpotAlreadyCondition
‪function zombieHasAttackSpotAlreadyCondition(behaviorTreeEntity)
Definition: _zm_behavior.gsc:985
‪zombieShouldKnockdown
‪function zombieShouldKnockdown(behaviorTreeEntity)
Definition: _zm_behavior.gsc:872
‪has_behavior_attribute
‪function has_behavior_attribute(attribute)
Definition: ai_shared.gsc:198
‪zombieBlackHoleBombPullStart
‪function zombieBlackHoleBombPullStart(entity, asmStateName)
Definition: _zm_behavior.gsc:1667
‪zombieTauntActionTerminate
‪function zombieTauntActionTerminate(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1450
‪check_zbarrier_piece_for_zombie_death
‪function check_zbarrier_piece_for_zombie_death(chunk_index, zbarrier, zombie)
Definition: _zm_spawner.gsc:1506
‪zombieMantleAction
‪function zombieMantleAction(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1457
‪zombieTraverseActionTerminate
‪function zombieTraverseActionTerminate(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:949
‪zombieBlackHoleBombPullUpdate
‪function zombieBlackHoleBombPullUpdate(entity, asmStateName)
Definition: _zm_behavior.gsc:1708
‪PUSH_DIRECTION
‪#define PUSH_DIRECTION
Definition: blackboard.gsh:209
‪BLACKHOLEBOMB_PULL_STATE
‪#define BLACKHOLEBOMB_PULL_STATE
Definition: blackboard.gsh:249
‪AI_ANIM_MOVE_CODE
‪#define AI_ANIM_MOVE_CODE
Definition: animation_state_machine.gsh:77
‪notetrackBoardMelee
‪function notetrackBoardMelee(animationEntity)
Definition: _zm_behavior.gsc:1597
‪ASM_REGISTER_MOCOMP
‪#define ASM_REGISTER_MOCOMP(name, initFunction, updateFunction, terminateFunction)
Definition: animation_state_machine.gsh:1
‪zombieUpdateGoal
‪function zombieUpdateGoal()
Definition: _zm_behavior.gsc:498
‪zombieFindFlesh
‪function zombieFindFlesh(behaviorTreeEntity)
Definition: _zm_behavior.gsc:149
‪zombieAttackThroughBoardsActionTerminate
‪function zombieAttackThroughBoardsActionTerminate(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1430
‪zombieStunActionStart
‪function zombieStunActionStart(behaviorTreeEntity)
Definition: _zm_behavior.gsc:928
‪zombieMantleActionTerminate
‪function zombieMantleActionTerminate(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1476
‪zombieShouldTearCondition
‪function zombieShouldTearCondition(behaviorTreeEntity)
Definition: _zm_behavior.gsc:1000
‪updateAttackSpotService
‪function updateAttackSpotService(behaviorTreeEntity)
Definition: _zm_behavior.gsc:1189
‪zombieIsPushed
‪function zombieIsPushed(behaviorTreeEntity)
Definition: _zm_behavior.gsc:882
‪ZM_FIND_FLESH_RADIUS
‪#define ZM_FIND_FLESH_RADIUS
Definition: _zm_behavior.gsh:20
‪AI_ANIM_USE_BOTH_DELTAS_NOCLIP
‪#define AI_ANIM_USE_BOTH_DELTAS_NOCLIP
Definition: animation_state_machine.gsh:83
‪zombieBlackHoleBombPullEnd
‪function zombieBlackHoleBombPullEnd(entity, asmStateName)
Definition: _zm_behavior.gsc:1755
‪zombiePushedActionStart
‪function private zombiePushedActionStart(behaviorTreeEntity)
Definition: _zm_behavior.gsc:909
‪ZM_ATTACKING_SPOT_DIST
‪#define ZM_ATTACKING_SPOT_DIST
Definition: _zm_behavior.gsh:3
‪zombieGotToEntranceCondition
‪function zombieGotToEntranceCondition(behaviorTreeEntity)
Definition: _zm_behavior.gsc:965
‪zombieGrabBoardActionTerminate
‪function zombieGrabBoardActionTerminate(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1382
‪zombieShouldEnterPlayableCondition
‪function zombieShouldEnterPlayableCondition(behaviorTreeEntity)
Definition: _zm_behavior.gsc:1092
‪zombieGotToAttackSpotCondition
‪function zombieGotToAttackSpotCondition(behaviorTreeEntity)
Definition: _zm_behavior.gsc:975
‪barricadeEnterMocompNoZTerminate
‪function barricadeEnterMocompNoZTerminate(entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration)
Definition: _zm_behavior.gsc:1577
‪zombieUpdateGoalCode
‪function zombieUpdateGoalCode()
Definition: _zm_behavior.gsc:634
‪zombieHoldBoardAction
‪function zombieHoldBoardAction(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1335
‪zombieGrabBoardAction
‪function zombieGrabBoardAction(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1361
‪zombieShouldTauntCondition
‪function zombieShouldTauntCondition(behaviorTreeEntity)
Definition: _zm_behavior.gsc:1064
‪isChunkValidCondition
‪function isChunkValidCondition(behaviorTreeEntity)
Definition: _zm_behavior.gsc:1108
‪barricadeEnterMocompUpdate
‪function barricadeEnterMocompUpdate(entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration)
Definition: _zm_behavior.gsc:1530
‪ZM_BOARD_TRIGGER_DIST_SQ
‪#define ZM_BOARD_TRIGGER_DIST_SQ
Definition: _zm_behavior.gsh:5
‪zombieShouldStun
‪function zombieShouldStun(behaviorTreeEntity)
Definition: _zm_behavior.gsc:919
‪get_closest_valid_player
‪function get_closest_valid_player(origin, ignore_player)
Definition: skeleton.gsc:321
‪BHB_BURST
‪#define BHB_BURST
Definition: _zm_behavior.gsc:36
‪findNodesService
‪function findNodesService(behaviorTreeEntity)
Definition: _zm_behavior.gsc:1227
‪zombieHoldBoardActionTerminate
‪function zombieHoldBoardActionTerminate(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1355
‪get_zombie_point_of_interest
‪function get_zombie_point_of_interest(origin, poi_array)
Definition: _zm_utility.gsc:893
‪get_attackable
‪function get_attackable()
Definition: _zm_attackables.gsc:59
‪disablePowerups
‪function disablePowerups(behaviorTreeEntity)
Definition: _zm_behavior.gsc:803
‪BHTN_SUCCESS
‪#define BHTN_SUCCESS
Definition: behavior_tree.gsh:8
‪ARCHETYPE_ZOMBIE
‪#define ARCHETYPE_ZOMBIE
Definition: archetype_shared.gsh:10
‪ZIGZAG_ACTIVATION_DISTANCE
‪#define ZIGZAG_ACTIVATION_DISTANCE
Definition: _zm_behavior.gsh:28
‪zombieGrappleActionStart
‪function zombieGrappleActionStart(behaviorTreeEntity)
Definition: _zm_behavior.gsc:892
‪NOTETRACK_ZOMBIES_BOARD_TEAR
‪#define NOTETRACK_ZOMBIES_BOARD_TEAR
Definition: _zm_behavior.gsh:16
‪InitZmBehaviorsAndASM
‪function private InitZmBehaviorsAndASM()
Definition: _zm_behavior.gsc:55
‪barricadeEnterMocompTerminate
‪function barricadeEnterMocompTerminate(entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration)
Definition: _zm_behavior.gsc:1537
‪KNOCKDOWN_TYPE
‪#define KNOCKDOWN_TYPE
Definition: blackboard.gsh:210
‪ASM_ALIAS_ATTRIBUTE
‪#define ASM_ALIAS_ATTRIBUTE
Definition: animation_state_machine.gsh:22
‪shouldMoveCondition
‪function shouldMoveCondition(behaviorTreeEntity)
Definition: _zm_behavior.gsc:773
‪zombieShouldAttackThroughBoardsCondition
‪function zombieShouldAttackThroughBoardsCondition(behaviorTreeEntity)
Definition: _zm_behavior.gsc:1013
‪zombieAttackThroughBoardsAction
‪function zombieAttackThroughBoardsAction(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1420
‪KNOCKDOWN_DIRECTION
‪#define KNOCKDOWN_DIRECTION
Definition: blackboard.gsh:208
‪INNER_ZIGZAG_RADIUS
‪#define INNER_ZIGZAG_RADIUS
Definition: _zm_behavior.gsh:30
‪should_skip_teardown
‪function should_skip_teardown(find_flesh_struct_string)
Definition: _zm_spawner.gsc:446
‪init
‪function autoexec init()
Definition: _zm_behavior.gsc:38
‪all_chunks_destroyed
‪function all_chunks_destroyed(barrier, barrier_chunks)
Definition: _zm_utility.gsc:455
‪zombieIsThinkDone
‪function zombieIsThinkDone(behaviorTreeEntity)
Definition: _zm_behavior.gsc:1138
‪traverseActionStart
‪function traverseActionStart(behaviorTreeEntity, asmStateName)
Definition: archetype_locomotion_utility.gsc:314
‪OUTER_RANGE
‪#define OUTER_RANGE
Definition: _zm_behavior.gsc:1688
‪barricadeEnterMocompNoZStart
‪function barricadeEnterMocompNoZStart(entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration)
Definition: _zm_behavior.gsc:1548
‪inPlayableArea
‪function inPlayableArea(behaviorTreeEntity)
Definition: _zm_behavior.gsc:1118
‪get_non_destroyed_chunks
‪function get_non_destroyed_chunks(barrier, barrier_chunks)
Definition: _zm_utility.gsc:2506
‪enteredPlayableArea
‪function enteredPlayableArea()
Definition: _zm_behavior_utility.gsc:50
‪RequestState
‪function RequestState(entity, stateName)
Definition: animation_state_machine_utility.gsc:8
‪ORANGE
‪#define ORANGE
Definition: shared.gsh:179
‪BT_REGISTER_ACTION
‪#define BT_REGISTER_ACTION(name, initFunction, updateFunction, terminateFunction)
Definition: behavior.gsh:4
‪get_behavior_attribute
‪function get_behavior_attribute(attribute)
Definition: ai_shared.gsc:184
‪zombieMoveToEntranceActionTerminate
‪function zombieMoveToEntranceActionTerminate(behaviorTreeEntity, asmStateName)
Definition: _zm_behavior.gsc:1309
‪wasKilledByTeslaCondition
‪function wasKilledByTeslaCondition(behaviorTreeEntity)
Definition: _zm_behavior.gsc:793
‪zombieEnteredPlayable
‪function zombieEnteredPlayable(behaviorTreeEntity)
Definition: _zm_behavior.gsc:754
‪zombieFindFleshCode
‪function zombieFindFleshCode(behaviorTreeEntity)
Definition: _zm_behavior.gsc:385
‪zombieKilledByBlackHoleBombEnd
‪function zombieKilledByBlackHoleBombEnd(entity, asmStateName)
Definition: _zm_behavior.gsc:1798
‪ZM_BOARD_MELEE_DIST_SQ
‪#define ZM_BOARD_MELEE_DIST_SQ
Definition: _zm_behavior.gsh:4
‪boardTearMocompStart
‪function boardTearMocompStart(entity, mocompAnim, mocompAnimBlendOutTime, mocompAnimFlag, mocompDuration)
Definition: _zm_behavior.gsc:1488
‪zombieUpdateBlackHoleBombPullState
‪function zombieUpdateBlackHoleBombPullState(entity)
Definition: _zm_behavior.gsc:1690
‪OUTER_ZIGZAG_RADIUS
‪#define OUTER_ZIGZAG_RADIUS
Definition: _zm_behavior.gsh:31
‪ZM_ZOMBIE_HEIGHT
‪#define ZM_ZOMBIE_HEIGHT
Definition: _zm_behavior.gsh:23
‪shouldSkipTeardown
‪function shouldSkipTeardown(behaviorTreeEntity)
Definition: _zm_behavior.gsc:1128
‪is_magic_bullet_shield_enabled
‪function is_magic_bullet_shield_enabled(ent)
Definition: _zm_utility.gsc:3474
‪BLACKHOLEBOMB_PULL_FAST
‪#define BLACKHOLEBOMB_PULL_FAST
Definition: blackboard.gsh:251
‪zombie_complete_emerging_into_playable_area
‪function zombie_complete_emerging_into_playable_area()
Definition: _zm_spawner.gsc:3253
‪PlayFx
‪function PlayFx(name)
Definition: _counteruav.gsc:390
‪ZM_MOVE_DIST_SQ
‪#define ZM_MOVE_DIST_SQ
Definition: zombie.gsh:53