‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
archetype_notetracks.gsc
Go to the documentation of this file.
1 #using scripts\shared\ai\archetype_human_cover;
2 #using scripts\shared\ai\archetype_utility;
3 #using scripts\shared\ai\systems\ai_blackboard;
4 #using scripts\shared\ai\systems\animation_state_machine_notetracks;
5 #using scripts\shared\ai\systems\animation_state_machine_utility;
6 #using scripts\shared\ai\systems\behavior_tree_utility;
7 #using scripts\shared\ai\systems\blackboard;
8 #using scripts\shared\ai\systems\gib;
9 #using scripts\shared\ai\systems\shared;
10 #using scripts\shared\ai_shared;
11 
12 #insert scripts\shared\shared.gsh;
13 #insert scripts\shared\ai\aivsaimelee.gsh;
14 #insert scripts\shared\ai\systems\animation_state_machine.gsh;
15 #insert scripts\shared\ai\systems\blackboard.gsh;
16 #insert scripts\shared\ai\systems\behavior.gsh;
17 #insert scripts\shared\ai\systems\behavior_tree.gsh;
18 
19 #namespace AnimationStateNetwork;
20 
22 {
43 
46 
48 
53 }
54 
55 function private ‪notetrackAnimMovementStop( entity )
56 {
57  if( entity HasPath() )
58  {
59  entity PathMode( "move delayed", true, RandomFloatRange( 2, 4 ) );
60  }
61 }
62 
63 function private ‪notetrackStaircaseStep1( entity )
64 {
66  numSteps++;
67 
69 }
70 
71 function private ‪notetrackStaircaseStep2( entity )
72 {
74  numSteps += 2;
75 
77 }
78 
79 function private ‪notetrackDropGunInternal( entity )
80 {
81  if( entity.weapon == level.weaponNone )
82  return;
83 
84  entity.lastWeapon = entity.weapon;
85  primaryweapon = entity.primaryweapon;
86  secondaryweapon = entity.secondaryweapon;
87 
88  entity thread ‪shared::DropAIWeapon();
89 }
90 
91 // necessary for AI vs AI melees where soldiers need to stab each other
92 function private ‪notetrackAttachKnife( entity )
93 {
94  if( !‪IS_TRUE( entity._ai_melee_attachedKnife ) )
95  {
96  entity Attach( ‪KNIFE_MODEL, "TAG_WEAPON_LEFT" );
97  entity._ai_melee_attachedKnife = true;
98  }
99 }
100 
101 function private ‪notetrackDetachKnife( entity )
102 {
103  if( ‪IS_TRUE( entity._ai_melee_attachedKnife ) )
104  {
105  entity Detach( ‪KNIFE_MODEL, "TAG_WEAPON_LEFT" );
106  entity._ai_melee_attachedKnife = false;
107  }
108 }
109 
110 function private ‪notetrackHideWeapon( entity )
111 {
112  entity ‪ai::gun_remove();
113 }
114 
115 function private ‪notetrackShowWeapon( entity )
116 {
117  entity ‪ai::gun_recall();
118 }
119 
120 
121 function private ‪notetrackHideAI( entity )
122 {
123  entity Hide();
124 }
125 
126 function private ‪notetrackShowAI( entity )
127 {
128  entity Show();
129 }
130 
131 function private ‪notetrackStartRagdoll( entity )
132 {
133  if( IsActor( entity ) && entity IsInScriptedState() )
134  {
135  entity.overrideActorDamage = undefined;
136  entity.allowdeath = true;//This ignores/overrides the scene setting if set
137  entity.skipdeath = true;
138  entity Kill();
139  }
140 
141  // SUMEET HACK - drop gun, if its not dropped already
142  ‪notetrackDropGunInternal( entity );
143  entity StartRagdoll();
144 }
145 
146 function ‪_DelayedRagdoll( entity )
147 {
148  wait 0.25;
149 
150  if ( IsDefined( entity ) && !entity IsRagdoll() )
151  {
152  entity StartRagdoll();
153  }
154 }
155 
157 {
158  if( IsDefined( entity._ai_melee_opponent ) )
159  {
160  entity._ai_melee_opponent Unlink();
161  }
162 
163  // Delay ragdoll to let more of the animscripted to play out.
164  entity thread ‪_DelayedRagdoll( entity );
165 }
166 
167 function private ‪notetrackFireBullet( animationEntity )
168 {
169  // Fire a MagicBullet in scripted animations
170  if ( IsActor( animationEntity ) && animationEntity IsInScriptedState() )
171  {
172  if( animationEntity.weapon != level.weaponNone )
173  {
174  animationEntity notify("about_to_shoot");
175 
176  startPos = animationEntity GetTagOrigin( "tag_flash" );
177  endPos = startPos + VectorScale( animationEntity GetWeaponForwardDir(), 100 );
178  MagicBullet( animationEntity.weapon, startPos, endPos, animationEntity );
179 
180  animationEntity notify("shoot");
181  animationEntity.bulletsInClip--;
182  }
183  }
184 }
185 
186 function private ‪notetrackDropGun( animationEntity )
187 {
188  ‪notetrackDropGunInternal( animationEntity );
189 }
190 
191 function private ‪notetrackDropShield( animationEntity )
192 {
193  ‪AiUtility::dropRiotshield( animationEntity );
194 }
195 
196 function private ‪notetrackGrenadeThrow( animationEntity )
197 {
199  {
200  animationEntity GrenadeThrow();
201  }
202  else if ( IsDefined( animationEntity.grenadeThrowPosition ) )
203  {
204  // Fallback to throwing the grenade at the last valid position.
205  arm_offset = ‪archetype_human_cover::TEMP_get_arm_offset( animationEntity, animationEntity.grenadeThrowPosition );
206  throw_vel = animationEntity CanThrowGrenadePos( arm_offset, animationEntity.grenadeThrowPosition );
207 
208  if ( IsDefined( throw_vel ) )
209  {
210  animationEntity GrenadeThrow();
211  }
212  }
213 }
214 
215 function private ‪notetrackMeleeUnsync( animationEntity )
216 {
217  if( IsDefined( animationEntity ) && IsDefined( animationEntity.enemy ) )
218  {
219  if( ‪IS_TRUE( animationEntity.enemy._ai_melee_markedDead ) )
220  {
221  animationEntity unlink();
222  }
223  }
224 }
225 
226 function private ‪notetrackGibDisable( animationEntity )
227 {
228  if ( animationEntity ‪ai::has_behavior_attribute( "can_gib" ) )
229  {
230  animationEntity ‪ai::set_behavior_attribute( "can_gib", false );
231  }
232 }
‪notetrackStaircaseStep1
‪function private notetrackStaircaseStep1(entity)
Definition: archetype_notetracks.gsc:63
‪KNIFE_MODEL
‪#define KNIFE_MODEL
Definition: aivsaimelee.gsh:2
‪notetrackHideWeapon
‪function private notetrackHideWeapon(entity)
Definition: archetype_notetracks.gsc:110
‪notetrackHideAI
‪function private notetrackHideAI(entity)
Definition: archetype_notetracks.gsc:121
‪gun_recall
‪function gun_recall()
Definition: ai_shared.gsc:141
‪DropAIWeapon
‪function DropAIWeapon()
Definition: shared.gsc:226
‪STAIRCASE_NUM_STEPS
‪#define STAIRCASE_NUM_STEPS
Definition: blackboard.gsh:374
‪NOTETRACK_RAGDOLL_NODEATH
‪#define NOTETRACK_RAGDOLL_NODEATH
Definition: animation_state_machine.gsh:58
‪GibLeftArm
‪function GibLeftArm(entity)
Definition: gib.gsc:450
‪NOTETRACK_GIB_ARM_RIGHT
‪#define NOTETRACK_GIB_ARM_RIGHT
Definition: animation_state_machine.gsh:53
‪notetrackStartRagdoll
‪function private notetrackStartRagdoll(entity)
Definition: archetype_notetracks.gsc:131
‪notetrackMeleeUnsync
‪function private notetrackMeleeUnsync(animationEntity)
Definition: archetype_notetracks.gsc:215
‪NOTETRACK_DROPGUN
‪#define NOTETRACK_DROPGUN
Definition: animation_state_machine.gsh:40
‪NOTETRACK_STAIRS_STEP1
‪#define NOTETRACK_STAIRS_STEP1
Definition: animation_state_machine.gsh:72
‪ASM_REGISTER_NOTETRACK_HANDLER
‪#define ASM_REGISTER_NOTETRACK_HANDLER(notetrackname, handlerfunction)
Definition: animation_state_machine.gsh:4
‪NOTETRACK_GIB_DISABLE
‪#define NOTETRACK_GIB_DISABLE
Definition: animation_state_machine.gsh:50
‪ASM_REGISTER_BLACKBOARD_NOTETRACK_HANDLER
‪#define ASM_REGISTER_BLACKBOARD_NOTETRACK_HANDLER(notetrackName, blackboardAttributeName, blackBoardValue)
Definition: animation_state_machine.gsh:7
‪NOTETRACK_GIB_LEG_LEFT
‪#define NOTETRACK_GIB_LEG_LEFT
Definition: animation_state_machine.gsh:54
‪TEMP_get_arm_offset
‪function TEMP_get_arm_offset(behaviorTreeEntity, throwPosition)
Definition: archetype_human_cover.gsc:500
‪SetBlackBoardAttribute
‪function SetBlackBoardAttribute(entity, attributeName, attributeValue)
Definition: blackboard.gsc:56
‪NOTETRACK_DROP_GUN_1
‪#define NOTETRACK_DROP_GUN_1
Definition: animation_state_machine.gsh:41
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪GetBlackBoardAttribute
‪function GetBlackBoardAttribute(entity, attributeName)
Definition: blackboard.gsc:32
‪STANCE_PRONE_ON_FRONT
‪#define STANCE_PRONE_ON_FRONT
Definition: blackboard.gsh:277
‪NOTETRACK_FIRE_BULLET
‪#define NOTETRACK_FIRE_BULLET
Definition: animation_state_machine.gsh:29
‪notetrackDetachKnife
‪function private notetrackDetachKnife(entity)
Definition: archetype_notetracks.gsc:101
‪GibRightLeg
‪function GibRightLeg(entity)
Definition: gib.gsc:496
‪NOTETRACK_GIB_ARM_LEFT
‪#define NOTETRACK_GIB_ARM_LEFT
Definition: animation_state_machine.gsh:52
‪notetrackGrenadeThrow
‪function private notetrackGrenadeThrow(animationEntity)
Definition: archetype_notetracks.gsc:196
‪STANCE
‪#define STANCE
Definition: blackboard.gsh:36
‪GibLeftLeg
‪function GibLeftLeg(entity)
Definition: gib.gsc:485
‪STANCE_STAND
‪#define STANCE_STAND
Definition: blackboard.gsh:273
‪notetrackShowWeapon
‪function private notetrackShowWeapon(entity)
Definition: archetype_notetracks.gsc:115
‪NOTETRACK_GIB_HEAD
‪#define NOTETRACK_GIB_HEAD
Definition: animation_state_machine.gsh:51
‪NOTETRACK_STANCE_STAND
‪#define NOTETRACK_STANCE_STAND
Definition: animation_state_machine.gsh:60
‪has_behavior_attribute
‪function has_behavior_attribute(attribute)
Definition: ai_shared.gsc:198
‪notetrackDropGun
‪function private notetrackDropGun(animationEntity)
Definition: archetype_notetracks.gsc:186
‪NOTETRACK_HIDE_WEAPON
‪#define NOTETRACK_HIDE_WEAPON
Definition: animation_state_machine.gsh:43
‪NOTETRACK_DETACH_KNIFE
‪#define NOTETRACK_DETACH_KNIFE
Definition: animation_state_machine.gsh:48
‪NOTETRACK_GIB_LEG_RIGHT
‪#define NOTETRACK_GIB_LEG_RIGHT
Definition: animation_state_machine.gsh:55
‪dropRiotshield
‪function dropRiotshield(behaviorTreeEntity)
Definition: archetype_utility.gsc:2543
‪NOTETRACK_SHOW_WEAPON
‪#define NOTETRACK_SHOW_WEAPON
Definition: animation_state_machine.gsh:44
‪notetrackAttachKnife
‪function private notetrackAttachKnife(entity)
Definition: archetype_notetracks.gsc:92
‪NOTETRACK_ATTACH_KNIFE
‪#define NOTETRACK_ATTACH_KNIFE
Definition: animation_state_machine.gsh:47
‪STANCE_PRONE_ON_BACK
‪#define STANCE_PRONE_ON_BACK
Definition: blackboard.gsh:276
‪NOTETRACK_STANCE_CROUCH
‪#define NOTETRACK_STANCE_CROUCH
Definition: animation_state_machine.gsh:59
‪NOTETRACK_GRENADE_THROW
‪#define NOTETRACK_GRENADE_THROW
Definition: animation_state_machine.gsh:56
‪NOTETRACK_RAGDOLL
‪#define NOTETRACK_RAGDOLL
Definition: animation_state_machine.gsh:57
‪NOTETRACK_MELEE_UNSYNC
‪#define NOTETRACK_MELEE_UNSYNC
Definition: animation_state_machine.gsh:70
‪NOTETRACK_STAIRS_STEP2
‪#define NOTETRACK_STAIRS_STEP2
Definition: animation_state_machine.gsh:73
‪NOTETRACK_HIDE_AI
‪#define NOTETRACK_HIDE_AI
Definition: animation_state_machine.gsh:45
‪NOTETRACK_STANCE_PRONE_BACK
‪#define NOTETRACK_STANCE_PRONE_BACK
Definition: animation_state_machine.gsh:63
‪notetrackStaircaseStep2
‪function private notetrackStaircaseStep2(entity)
Definition: archetype_notetracks.gsc:71
‪notetrackDropGunInternal
‪function private notetrackDropGunInternal(entity)
Definition: archetype_notetracks.gsc:79
‪NOTETRACK_STANCE_PRONE_FRONT
‪#define NOTETRACK_STANCE_PRONE_FRONT
Definition: animation_state_machine.gsh:62
‪notetrackStartRagdollNoDeath
‪function notetrackStartRagdollNoDeath(entity)
Definition: archetype_notetracks.gsc:156
‪NOTETRACK_SHOW_AI
‪#define NOTETRACK_SHOW_AI
Definition: animation_state_machine.gsh:46
‪set_behavior_attribute
‪function set_behavior_attribute(attribute, value)
Definition: ai_shared.gsc:159
‪notetrackDropShield
‪function private notetrackDropShield(animationEntity)
Definition: archetype_notetracks.gsc:191
‪notetrackFireBullet
‪function private notetrackFireBullet(animationEntity)
Definition: archetype_notetracks.gsc:167
‪RegisterDefaultNotetrackHandlerFunctions
‪function autoexec RegisterDefaultNotetrackHandlerFunctions()
Definition: archetype_notetracks.gsc:21
‪STANCE_CROUCH
‪#define STANCE_CROUCH
Definition: blackboard.gsh:274
‪shouldThrowGrenadeAtCoverCondition
‪function shouldThrowGrenadeAtCoverCondition(behaviorTreeEntity, throwIfPossible=false)
Definition: archetype_human_cover.gsc:54
‪NOTETRACK_MOVEMENT_STOP
‪#define NOTETRACK_MOVEMENT_STOP
Definition: animation_state_machine.gsh:65
‪notetrackShowAI
‪function private notetrackShowAI(entity)
Definition: archetype_notetracks.gsc:126
‪GibRightArm
‪function GibRightArm(entity)
Definition: gib.gsc:467
‪GibHead
‪function GibHead(entity)
Definition: gib.gsc:443
‪NOTETRACK_DROP_SHIELD
‪#define NOTETRACK_DROP_SHIELD
Definition: animation_state_machine.gsh:42
‪gun_remove
‪function gun_remove()
Definition: ai_shared.gsc:110
‪notetrackGibDisable
‪function private notetrackGibDisable(animationEntity)
Definition: archetype_notetracks.gsc:226
‪_DelayedRagdoll
‪function _DelayedRagdoll(entity)
Definition: archetype_notetracks.gsc:146
‪notetrackAnimMovementStop
‪function private notetrackAnimMovementStop(entity)
Definition: archetype_notetracks.gsc:55