‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
behavior.gsh
Go to the documentation of this file.
1 #define BT_REGISTER_API(name,function) \
2  BehaviorTreeNetworkUtility::RegisterBehaviorTreeScriptAPI(name,function);
3 
4 #define BT_REGISTER_ACTION(name,initFunction,updateFunction,terminateFunction) \
5  BehaviorTreeNetworkUtility::RegisterBehaviorTreeAction(name,initFunction,updateFunction,terminateFunction);
6 
7 #define BT_REGISTER_ACTION_SIMPLE(name) \
8  BehaviorTreeNetworkUtility::RegisterBehaviorTreeAction(name,undefined,undefined,undefined);
9 
10 // at 96 units distance, AI will prefer to walk instead of running to it.
11 #define TACTICAL_WALK_SHORT_DIST_SQ 96 * 96
12 
13 // standing offset at covernodes based on the AI pose
14 #define COVER_LEFT_YAW_OFFSET 90.0
15 #define COVER_RIGHT_YAW_OFFSET -90.0
16 #define COVER_PILLAR_YAW_OFFSET 180.0
17 
18 // yaws used to check if the AI can see the enemy
19 #define COVER_CORNER_VALID_YAW_RANGE_MAX 60
20 #define COVER_CORNER_VALID_YAW_RANGE_MIN 10
21 
22 // offsets used to check if the AI can see the enemy
23 #define COVER_LEFT_OFFSET (-36, 7, 63)
24 #define COVER_RIGHT_OFFSET (36, 7, 63)
25 #define COVER_CROUCH_OFFSET (3.5, -12.5, 45)
26 #define COVER_STAND_OFFSET (-3.7, -22, 63)
27 #define COVER_PILLAR_LEFT_OFFSET (-32, 3.7, 60)
28 #define COVER_PILLAR_RIGHT_OFFSET (32, 3.7, 60)
29 
30 #define SEEN_ENEMY_RECENTLY_INTERVAL 4 // in sec, if AI has not seen enemy for 4 sec, then he will be considered hidden
31 
32 // maximum time for idle action at cover, ir-respective of the animation length
33 #define MAX_IDLE_TIME_MILLIS 2000
34 
35 // grenade throw ranges
36 #define MIN_GRENADE_THROW_DIST_SQ SQR(500)
37 #define MAX_GRENADE_THROW_DIST_SQ SQR(1250)
38 
39 // grenade throw modifiers
40 #define MIN_GRENADE_TEAM_TIME 1000 // Lower bound of time before a person of the same team can throw another grenade
41 #define MAX_GRENADE_TEAM_TIME 2000 // Upper bound of time before a person of the same team can throw another grenade
42 
43 #define MIN_GRENADE_ANIMSCRIPTED_TIME 3000 // Lower bound of time before a person that finished a scripted animation can throw a grenade
44 #define MAX_GRENADE_ANIMSCRIPTED_TIME 4000 // Upper bound of time before a person that finished a scripted animation can throw a grenade
45 
46 #define MIN_GRENADE_THROW_TIME 15000 // Lower bound of time before being able to throw another grenade
47 #define MAX_GRENADE_THROW_TIME 20000 // Upper bound of time before being able to throw another grenade
48 #define GRENADE_OVERLAP_DIST_SQ (600 * 600) // New grenade throws must land atleast this far from any previous throw, within the GRENADE_THROW_TIME window.
49 #define ALLIED_GRENADE_SAFE_DIST_SQ (500 * 500 ) // Don't throw a grenade if you are on team allies and it will land this close to a player (may want to change to any ally)
50 #define LASTSTAND_GRENADE_SAFE_DIST_SQ (500 * 500 ) // Don't throw a grenade if there is a player in laststand this close to the target.
51 
52 // Melee ranges and timers
53 #define CHARGE_RANGE_SQ_VS_PLAYER SQR(140)
54 #define MELEE_RANGE_SQ SQR(64)
55 #define BLEND_MELEE_RANGE_SQ SQR(74) // allowed 10 units to account for charge blend
56 #define MELEE_NEAR_RANGE 36
57 #define MELEE_NEAR_RANGE_SQ SQR(MELEE_NEAR_RANGE)
58 #define MELEE_RANGE_MAX_SQ CHARGE_RANGE_SQ_VS_PLAYER // charge distance is the minimum distance required to even attempt melee
59 
60 #define NEXT_CHARGE_MELEE_TIME 2000
61 #define MELEE_YAW_THRESHOLD 80
62 #define MELEE_YAW_THRESHOLDNEAR 40
63 #define MELEE_ENEMY_DISTANCE_PREDICTION_TIME 0.25
64 #define MAX_MELEE_PLAYER_ATTACKERS 1
65 
66 // Arrival
67 #define MIN_ARRIVAL_DIST_SQ ( 64 * 64 )
68 #define ARRIVAL_COVER_SPLIT_NOTETRACK "cover_split"
69 
70 // Distance at which enmey is considered to be nearby
71 #define CLOSE_ENEMY_DISTANCE_SQ ( 150 * 150 )
72 
73 // Cover modes
74 #define COVER_MODE_OVER "over"
75 #define COVER_MODE_LEAN "lean"
76 
77 //Sprint values
78 #define SPRINT_GAP_TIME 5000 //delay between two sprints
79 #define RANDOM_SPRINT_TIME 1000 //upto one more second delay between sprint
80 #define ADDITIONAL_SPRINT_GAP 2000 //additional compensation factor
81 #define SPRINT_PROBABILITY 40 //value between 0 and 100, probability of sprinting
82 
83 // Cover shoot times
84 #define COVER_SHOOT_MIN_TIME 800
85 #define COVER_SHOOT_TAKEDOWN_TIME 3000
86 
87 
88 // *********** SUMEET TODO - Merge seeking and exposed reacquiring behavior together. ***********
89 
90 // Reacquire/ Cover/Locomotion Seek
91 #define COS_60 0.5
92 #define REACQUIRE_STEP_SIZE 32
93 #define REACQUIRE_RESET 15
94 
95 #define SEEK_OUT_ENEMY_RADIUS_BIG 400
96 #define SEEK_OUT_ENEMY_RADIUS_SMALL 256
97 #define SEEK_OUT_ENEMY_INTERVAL_SUCCESS 5 * 1000
98 #define SEEK_OUT_ENEMY_INTERVAL_FAILURE 2 * 1000
99 #define SEEK_OUT_ENEMY_FAILURE_MAX_ATTEMPTS 5