Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIGoalReaction.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
2// GOAL REACTION BASE
3//------------------------------------------------------------------------------------------------
4
7{
8 // Don't use, it's here for backwards compatibility, not guaranteed to work in all classes
9 [Attribute(defvalue: "", uiwidget: UIWidgets.EditBox, desc: "Don't use, it's here for backwards compatibility, not guaranteed to work in all classes", params: "bt")]
10 string m_OverrideBehaviorTree;
11
12 [Attribute("0", UIWidgets.ComboBox, "Type of event activating the reaction", "", ParamEnumArray.FromEnum(EMessageType_Goal) )]
13 EMessageType_Goal m_eType;
14
15 void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message) {}
16 void PerformReaction(notnull SCR_AIGroupUtilityComponent utility, SCR_AIMessageBase message) {}
17};
18
19
20//------------------------------------------------------------------------------------------------
21// GOAL REACTIONS - Reactions on different orders
22//------------------------------------------------------------------------------------------------
23
26{
27 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
28 {
29 SCR_AIMessage_Attack msg = SCR_AIMessage_Attack.Cast(message); // new approach: m_Target can be null!
30 if (!msg)
31 return;
32
33 utility.m_CombatComponent.UpdateLastSeenPosition(msg.m_TargetInfo.m_Entity, msg.m_TargetInfo);
34 utility.m_CombatComponent.SetAssignedTargets({msg.m_TargetInfo.m_Entity}, null);
35 }
36};
37
40{
41 // Duration of investigation if target is not seen
42 const float INVESTIGATION_DURATION_S = 120.0;
43
44 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
45 {
47 if (!msg)
48 return;
49
50 // Does it still exist?
51 if (!msg.m_TargetClusterState || !msg.m_TargetClusterState.m_Cluster)
52 return;
53
54 // ------ Set assigned targets
55 utility.m_CombatComponent.SetAssignedTargets(null, msg.m_TargetClusterState);
56
57
58 // ------ Should we investigate there?
59
60 // Check if we have identified at least one target
61 if (msg.m_bAllowInvestigate)
62 {
63 bool targetIdentified = false;
64 foreach (IEntity targetEntity : msg.m_TargetClusterState.m_Cluster.m_aEntities)
65 {
66 if (utility.m_PerceptionComponent.GetTargetPerceptionObject(targetEntity, ETargetCategory.ENEMY))
67 {
68 targetIdentified = true; // Found in 'Enemy' category - we have direct sight on it
69 break;
70 }
71 else
72 continue;
73 }
74
75 // If we haven't identified any target, go there
76 if (!targetIdentified && msg.m_bAllowInvestigate)
77 {
78 // Cancel all other investigations
79 utility.SetStateAllActionsOfType(SCR_AIMoveAndInvestigateBehavior, EAIActionState.FAILED);
80
81 vector investigatePos;
82 float investigateRadius;
83 SCR_AIInvestigateClusterActivity.CalculateInvestigationArea(msg.m_TargetClusterState, investigatePos, investigateRadius);
84
85 auto investigateBehavior = new SCR_AIMoveAndInvestigateBehavior(utility, msg.m_RelatedGroupActivity,
86 investigatePos, radius: investigateRadius,
87 priorityLevel: msg.m_fPriorityLevel, isDangerous: true,
88 duration: INVESTIGATION_DURATION_S);
89 utility.AddAction(investigateBehavior);
90 }
91 }
92 else
93 {
94 // Report 'Covering' if we are not supposed to investigate there
95 SCR_AICommsHandler commsHandler = utility.m_CommsHandler;
96 if (!commsHandler.CanBypass())
97 {
98 SCR_AITalkRequest rq = new SCR_AITalkRequest(ECommunicationType.REPORT_COVERING, null, vector.Zero, 0, false, false, SCR_EAITalkRequestPreset.MEDIUM);
99 commsHandler.AddRequest(rq);
100 }
101 }
102 }
103}
104
106class SCR_AIGoalReaction_AttackClusterDone : SCR_AIGoalReaction
107{
108 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
109 {
111 if (!msg)
112 return;
113
114 utility.m_CombatComponent.ResetAssignedTargets();
115 }
116}
117
119class SCR_AIGoalReaction_CoverCluster : SCR_AIGoalReaction
120{
121 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
122 {
123 // Now we don't have a behavior to cover those who are attacking/ivnestigating a cluster yet
124 // We just use it for voice line
125 SCR_AICommsHandler commsHandler = utility.m_CommsHandler;
126 if (!commsHandler.CanBypass())
127 {
128 SCR_AITalkRequest rq = new SCR_AITalkRequest(ECommunicationType.REPORT_COVERING, null, vector.Zero, 0, false, false, SCR_EAITalkRequestPreset.MEDIUM);
129 commsHandler.AddRequest(rq);
130 }
131 }
132}
133
135class SCR_AIGoalReaction_Move : SCR_AIGoalReaction
136{
137 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
138 {
139 auto msg = SCR_AIMessage_Move.Cast(message);
140 if (!msg)
141 return;
142
143 auto behavior = new SCR_AIMoveIndividuallyBehavior(utility, msg.m_RelatedGroupActivity,
144 msg.m_MovePosition, SCR_AIActionBase.PRIORITY_BEHAVIOR_MOVE_INDIVIDUALLY, msg.m_fPriorityLevel, msg.m_FollowEntity);
145
146 utility.WrapBehaviorOutsideOfVehicle(behavior);
147 utility.AddAction(behavior);
148 }
149
150 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility, SCR_AIMessageBase message)
151 {
152 auto msg = SCR_AIMessage_Move.Cast(message);
153 if (!msg)
154 return;
155
156 auto activity = new SCR_AIMoveActivity(utility, msg.m_RelatedWaypoint, msg.m_MovePosition,
157 msg.m_FollowEntity, msg.m_eMovementType, msg.m_bUseVehicles, SCR_AIActionBase.PRIORITY_ACTIVITY_MOVE, priorityLevel: msg.m_fPriorityLevel);
158
159 utility.SetStateAllActionsOfType(SCR_AISearchAndDestroyActivity,EAIActionState.FAILED); // move fails seek and destroy
160 utility.AddAction(activity);
161 }
162};
163
166{
167 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility, SCR_AIMessageBase message)
168 {
169 auto msg = SCR_AIMessage_Follow.Cast(message);
170 if (!msg || !msg.m_FollowEntity)
171 return;
172
173 auto activity = new SCR_AIFollowActivity(utility, msg.m_RelatedWaypoint, vector.Zero, msg.m_FollowEntity,
174 msg.m_eMovementType, false, SCR_AIActionBase.PRIORITY_ACTIVITY_FOLLOW, priorityLevel: msg.m_fPriorityLevel, distance: msg.m_fDistance);
175 utility.SetStateAllActionsOfType(SCR_AISearchAndDestroyActivity, EAIActionState.FAILED); // move fails seek and destroy
176 utility.AddAction(activity);
177 }
179
182{
183 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
184 {
185 auto msg = SCR_AIMessage_Investigate.Cast(message);
186 if (!msg)
187 return;
188
189 // Cancel previous investigations
190 utility.SetStateAllActionsOfType(SCR_AIMoveAndInvestigateBehavior, EAIActionState.FAILED);
191
192 auto behavior = new SCR_AIMoveAndInvestigateBehavior(utility, msg.m_RelatedGroupActivity, msg.m_vMovePosition,
193 SCR_AIActionBase.PRIORITY_BEHAVIOR_MOVE_AND_INVESTIGATE, msg.m_fPriorityLevel, isDangerous: msg.m_bIsDangerous, radius: msg.m_fRadius, targetUnitType: msg.m_eTargetUnitType, duration: msg.m_fDuration);
194 utility.AddAction(behavior);
195 }
196};
197
200{
201 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
202 {
203 SCR_AIMessageGoal msg = SCR_AIMessageGoal.Cast(message);
204
205 auto behavior = new SCR_AIMoveInFormationBehavior(utility, msg.m_RelatedGroupActivity, msg.m_fPriorityLevel);
206
207 utility.AddAction(behavior);
208 }
209};
210
213{
214 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
215 {
216 auto msg = SCR_AIMessage_GetIn.Cast(message);
217 if (!msg)
218 return;
219 if (!msg.m_Vehicle)
220 return;
221 // from msg.m_eRoleInVehicle and msg.m_Vehicle we deduce empty compartment to get in, if none found, we dont add behavior get in
222 BaseCompartmentSlot compartmentSlot;
223 EAICompartmentType wantedCompartmentType = msg.m_eRoleInVehicle;
224 if (msg.m_CompartmentSlot)
225 {
226 compartmentSlot = msg.m_CompartmentSlot;
227 wantedCompartmentType = SCR_AICompartmentHandling.CompartmentClassToType(compartmentSlot.Type());
228 }
229 else
230 {
232 if (!compMan)
233 return;
234 array<BaseCompartmentSlot> compartments = {};
235 compMan.GetCompartments(compartments);
236 foreach (BaseCompartmentSlot comp: compartments)
237 {
238 if (msg.m_eRoleInVehicle == EAICompartmentType.None)
239 wantedCompartmentType = SCR_AICompartmentHandling.CompartmentClassToType(comp.Type());
240
241 if (comp.IsReserved() || (SCR_AICompartmentHandling.CompartmentClassToType(comp.Type()) != wantedCompartmentType))
242 continue;
243
244 IEntity occupant = comp.GetOccupant();
245 if (occupant && occupant == utility.m_OwnerEntity)
246 // we are already inside correct compartment type! we are done -> do not add new behavior
247 return;
248 else if (occupant && SCR_AIDamageHandling.IsConscious(occupant))
249 continue;
250 comp.SetReserved(utility.m_OwnerEntity);
251 compartmentSlot = comp;
252 break;
253 }
254 }
255 if (!compartmentSlot)
256 {
257#ifdef AI_DEBUG
258 PrintFormat("Warning: unit %1 got to get in %2 but there is no room for it in comp type %3!", utility.m_OwnerEntity, msg.m_Vehicle, msg.m_eRoleInVehicle);
259#endif
260 return;
261 }
262 auto behavior = new SCR_AIGetInVehicle(utility, msg.m_RelatedGroupActivity, msg.m_Vehicle, compartmentSlot, wantedCompartmentType, SCR_AIActionBase.PRIORITY_BEHAVIOR_GET_IN_VEHICLE, msg.m_fPriorityLevel);
263 if (m_OverrideBehaviorTree != string.Empty)
264 behavior.m_sBehaviorTree = m_OverrideBehaviorTree;
265
266 utility.AddAction(behavior);
267 }
268
269 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility, SCR_AIMessageBase message)
270 {
271 auto msg = SCR_AIMessage_GetIn.Cast(message);
272 if (!msg)
273 return;
274
275 auto activity = new SCR_AIGetInActivity(utility, msg.m_RelatedWaypoint, msg.m_Vehicle, msg.m_BoardingParams, msg.m_eRoleInVehicle, priorityLevel: msg.m_fPriorityLevel);
276 utility.AddAction(activity);
277 }
278};
279
282{
283 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
284 {
285 auto msg = SCR_AIMessage_GetOut.Cast(message);
286 if (!msg)
287 return;
288
289 auto behavior = new SCR_AIGetOutVehicle(utility, msg.m_RelatedGroupActivity, msg.m_Vehicle, delay_s: msg.m_fDelay_s, priority: SCR_AIActionBase.PRIORITY_BEHAVIOR_GET_OUT_VEHICLE, priorityLevel: msg.m_fPriorityLevel);
290 if (m_OverrideBehaviorTree != string.Empty)
291 behavior.m_sBehaviorTree = m_OverrideBehaviorTree;
292
293 utility.AddAction(behavior);
294 }
295
296 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility, SCR_AIMessageBase message)
297 {
298 auto msg = SCR_AIMessage_GetOut.Cast(message);
299 if (!msg)
300 return;
301
302 // if current activity is follow, make get out a priority so AI disembarks vehicle first
303 float customPriorityLevel;
304 SCR_AIFollowActivity follow = SCR_AIFollowActivity.Cast(utility.GetCurrentAction());
305 if (follow)
306 customPriorityLevel = SCR_AIActionBase.PRIORITY_LEVEL_GAMEMASTER;
307 else
308 customPriorityLevel = msg.m_fPriorityLevel;
309
310 auto activity = new SCR_AIGetOutActivity(utility, msg.m_RelatedWaypoint, msg.m_Vehicle, msg.m_BoardingParams, priorityLevel: customPriorityLevel);
311
312 utility.AddAction(activity);
313 }
314};
315
318{
319 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility, SCR_AIMessageBase message)
320 {
321 auto msg = SCR_AIMessage_SeekAndDestroy.Cast(message);
322 if (!msg)
323 return;
324
325 auto activity = new SCR_AISearchAndDestroyActivity(utility, msg.m_RelatedWaypoint, msg.m_MovePosition, ent: msg.m_FollowEntity, useVehicles: msg.m_bUseVehicles, priorityLevel: msg.m_fPriorityLevel);
326
327 utility.SetStateAllActionsOfType(SCR_AIMoveActivity,EAIActionState.FAILED);
328 utility.AddAction(activity);
329 }
330};
331
334{
335 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
336 {
337 auto msg = SCR_AIMessage_Heal.Cast(message);
338 if (!msg)
339 return;
340
341 auto behavior = new SCR_AIMedicHealBehavior(utility, msg.m_RelatedGroupActivity, msg.m_EntityToHeal, false, priorityLevel: msg.m_fPriorityLevel);
342 if (m_OverrideBehaviorTree != string.Empty)
343 behavior.m_sBehaviorTree = m_OverrideBehaviorTree;
344
345 utility.WrapBehaviorOutsideOfVehicle(behavior);
346 utility.AddAction(behavior);
347 }
348
349 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility, SCR_AIMessageBase message)
350 {
351 auto msg = SCR_AIMessage_Heal.Cast(message);
352 if (!msg)
353 return;
354
355 SCR_AIActionBase currentAction = SCR_AIActionBase.Cast(utility.GetCurrentAction());
356 if (!currentAction)
357 return;
358
359 float priorityLevelClamped = currentAction.GetRestrictedPriorityLevel(msg.m_fPriorityLevel);
360
361 // Check if we already have an activity to heal this soldier
362 array <ref AIActionBase> actions = {};
363 utility.FindActionsOfType(SCR_AIHealActivity, actions);
364 foreach (AIActionBase action : actions)
365 {
366 SCR_AIHealActivity healActivity = SCR_AIHealActivity.Cast(action);
367
368 //Return if we are already healing this soldier
369 if (healActivity.m_EntityToHeal.m_Value == msg.m_EntityToHeal)
370 {
371 healActivity.SetPriorityLevel(priorityLevelClamped);
372 return;
373 }
374 }
375
376
377 auto activity = new SCR_AIHealActivity(utility, msg.m_RelatedWaypoint, msg.m_EntityToHeal, priorityLevel: priorityLevelClamped);
378
379 utility.AddAction(activity);
380 }
381};
382
385{
386 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
387 {
388 auto msg = SCR_AIMessage_HealWait.Cast(message);
389 if (!msg)
390 return;
391
392 auto behavior = new SCR_AIHealWaitBehavior(utility, msg.m_RelatedGroupActivity, msg.m_HealProvider, msg.m_fPriorityLevel);
393
394 utility.AddAction(behavior);
395 }
396};
397
400{
401 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
402 {
403 auto msg = SCR_AIMessage_Defend.Cast(message);
404 if (!msg || !msg.m_RelatedWaypoint)
405 return;
406
407 auto behavior = new SCR_AIDefendBehavior(utility, msg.m_RelatedGroupActivity, msg.m_RelatedWaypoint,
408 msg.m_vDefendDirection, msg.m_fDefendAngularRange, priorityLevel: msg.m_fPriorityLevel);
409 if (m_OverrideBehaviorTree != string.Empty)
410 behavior.m_sBehaviorTree = m_OverrideBehaviorTree;
411
412 utility.AddAction(behavior);
413 }
414
415 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility, SCR_AIMessageBase message)
416 {
417 auto msg = SCR_AIMessage_Defend.Cast(message);
418 if (!msg || !msg.m_RelatedWaypoint)
419 return;
420
421 auto activity = new SCR_AIDefendActivity(utility, msg.m_RelatedWaypoint, msg.m_vDefendDirection,
422 priorityLevel: msg.m_fPriorityLevel);
423 if (m_OverrideBehaviorTree != string.Empty)
424 activity.m_sBehaviorTree = m_OverrideBehaviorTree;
425
426 utility.AddAction(activity);
427 }
428};
429
432{
433 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
434 {
435 auto msg = SCR_AIMessage_PerformAction.Cast(message);
436 if (!msg)
437 return;
438
439 auto behavior = new SCR_AIPerformActionBehavior(utility, msg.m_RelatedGroupActivity, msg.m_SmartActionComponent, priorityLevel: msg.m_fPriorityLevel);
440 if (m_OverrideBehaviorTree != string.Empty)
441 behavior.m_sBehaviorTree = m_OverrideBehaviorTree;
442
443 utility.AddAction(behavior);
444 }
445
446 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility, SCR_AIMessageBase message)
447 {
448 auto msg = SCR_AIMessage_PerformAction.Cast(message);
449 if (!msg)
450 return;
451
452 auto activity = new SCR_AIPerformActionActivity(utility, msg.m_RelatedWaypoint, msg.m_SmartActionEntity, msg.m_SmartActionTag, priorityLevel: msg.m_fPriorityLevel);
453 if (m_OverrideBehaviorTree != string.Empty)
454 activity.m_sBehaviorTree = m_OverrideBehaviorTree;
455
456 utility.AddAction(activity);
457 }
458};
459
462{
463 static const string SMART_ACTION_TAG = "OpenGate";
464
465 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
466 {
467 auto msg = SCR_AIMessage_OpenNavlinkDoor.Cast(message);
468 if (!msg)
469 return;
470
471 if (!msg.m_DoorEntity)
472 return;
473
474 SCR_AISmartActionComponent smartActionComp = SCR_AISmartActionHandling.FindSmartAction(msg.m_DoorEntity, SMART_ACTION_TAG, false);
475
476 if (!smartActionComp)
477 return;
478
479 SCR_AIPerformActionBehavior performActionBehavior = new SCR_AIPerformActionBehavior(utility,
480 msg.m_RelatedGroupActivity, smartActionComp,
481 priority: SCR_AIActionBase.PRIORITY_BEHAVIOR_OPEN_NAVLINK_DOOR,
482 priorityLevel: msg.m_fPriorityLevel);
483
484 utility.WrapBehaviorOutsideOfVehicle(performActionBehavior);
485 utility.AddAction(performActionBehavior);
486 }
487}
488
490class SCR_AIGoalReaction_Cancel : SCR_AIGoalReaction
491{
492 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
493 {
494 SCR_AIMessage_Cancel msg = SCR_AIMessage_Cancel.Cast(message);
495 if (!msg || !msg.m_RelatedGroupActivity)
496 return;
497 //utility.SetStateOfRelatedAction(msg.m_RelatedGroupActivity, EAIActionState.FAILED); TODO: fix code, this is not working right
498 array<ref AIActionBase> actions = {};
499 utility.GetActions(actions);
500 foreach(AIActionBase action: actions)
501 {
502 if (action.GetRelatedGroupActivity() == msg.m_RelatedGroupActivity)
503 {
504 SCR_AIActionBase actionBase = SCR_AIActionBase.Cast(action);
505 if (actionBase)
506 actionBase.SetFailReason(EAIActionFailReason.CANCELLED);
507 action.Fail();
508 }
509 };
510 }
511};
512
515{
516 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
517 {
519 if (!msg)
520 return;
521
522 SCR_AIThrowGrenadeToBehavior behavior = new SCR_AIThrowGrenadeToBehavior(utility, msg.m_RelatedGroupActivity, msg.m_vTargetPosition, msg.e_WeaponType, msg.m_fDelay, msg.m_fPriorityLevel);
523 utility.AddAction(behavior);
524 }
525};
526
529{
530 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
531 {
533 if (!msg)
534 return;
535
536 BaseWeaponComponent weaponComponent;
537 BaseMagazineComponent magazineComponent;
538 int muzzleId;
539
540 // Don't react if we can't fire a flare
541 if (!SCR_AIActivityIllumFlareFeature.GetAgentIllumWeaponAndMuzzle(utility.m_AIInfo, weaponComponent, magazineComponent, muzzleId))
542 return;
543
544 SCR_AIFireIllumFlareBehavior behavior = new SCR_AIFireIllumFlareBehavior(utility, msg.m_RelatedGroupActivity, msg.m_vTargetPosition, weaponComponent, magazineComponent, muzzleId, msg.m_fPriorityLevel);
545 utility.AddAction(behavior);
546 }
547};
548
551{
552 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
553 {
555 if (!msg)
556 return;
557
558 SCR_AIProvideAmmoBehavior behavior = new SCR_AIProvideAmmoBehavior(utility, msg.m_RelatedGroupActivity,
559 msg.m_AmmoConsumer, msg.m_MagazineWell, msg.m_fPriorityLevel);
560
561 utility.AddAction(behavior);
562 }
563}
564
566class SCR_AIGoalReaction_PickupInventoryItems : SCR_AIGoalReaction
567{
568 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
569 {
571 if (!msg)
572 return;
573
574 SCR_AIPickupInventoryItemsBehavior behavior = new SCR_AIPickupInventoryItemsBehavior(utility, msg.m_RelatedGroupActivity,
575 msg.m_vPickupPosition, msg.m_MagazineWellType, msg.m_fPriorityLevel);
576
577 utility.AddAction(behavior);
578 }
579}
580
582class SCR_AIGoalReaction_Suppress : SCR_AIGoalReaction
583{
584 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
585 {
586 SCR_AIMessage_Suppress msg = SCR_AIMessage_Suppress.Cast(message);
587 if (!msg || !msg.m_Volume)
588 return;
589
590 SCR_AISuppressBehavior behavior = new SCR_AISuppressBehavior(utility, msg.m_RelatedGroupActivity, msg.m_Volume, msg.m_fDuration_s, fireRate: msg.m_fFireRate, priorityLevel: msg.m_fPriorityLevel);
591 utility.AddAction(behavior);
592 }
593};
594
597{
598 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
599 {
600 auto msg = SCR_AIMessage_Animate.Cast(message);
601 if (!msg || !msg.m_RootEntity)
602 return;
603
604 auto behavior = new SCR_AIAnimateBehavior(utility, msg.m_RelatedGroupActivity, rootEntity: msg.m_RootEntity, priorityLevel: msg.m_fPriorityLevel, scriptForAgent: msg.m_AgentScript, relatedInvoker: msg.m_RelatedInvoker);
605 if (m_OverrideBehaviorTree != string.Empty)
606 behavior.m_sBehaviorTree = m_OverrideBehaviorTree;
607
608 utility.AddAction(behavior);
609 }
610
611 override void PerformReaction(notnull SCR_AIGroupUtilityComponent utility, SCR_AIMessageBase message)
612 {
613 auto msg = SCR_AIMessage_Animate.Cast(message);
614 if (!msg || !msg.m_RelatedWaypoint)
615 return;
616
617 auto activity = new SCR_AIAnimateActivity(utility, msg.m_RelatedWaypoint, priorityLevel: msg.m_fPriorityLevel);
618 if (m_OverrideBehaviorTree != string.Empty)
619 activity.m_sBehaviorTree = m_OverrideBehaviorTree;
620
621 utility.AddAction(activity);
622 }
623};
624
627{
628 override void PerformReaction(notnull SCR_AIUtilityComponent utility, SCR_AIMessageBase message)
629 {
631 if (!msg)
632 return;
633
634 array<ref AIActionBase> actions = {};
635 utility.FindActionsOfType(SCR_AIStaticArtilleryBehavior, actions);
636 foreach (auto a : actions)
637 a.Fail();
638
639 SCR_AIStaticArtilleryBehavior b = new SCR_AIStaticArtilleryBehavior(utility, msg.m_RelatedGroupActivity, msg.m_ArtilleryEntity, msg.m_vTargetPos, msg.m_eAmmoType, priorityLevel: msg.m_fPriorityLevel);
640 utility.AddAction(b);
641 }
642};
string message
EAIActionFailReason
Fail reasons of actions. They can be generic or specific to some behavior.
Definition SCR_AIAction.c:3
SCR_AIGoalReaction_Follow BaseContainerProps
void SCR_AIMessage_PickupInventoryItems()
SCR_AIMessage_AttackCluster SCR_AIMessageGoal SCR_AIMessage_AttackClusterDone()
void SCR_AIMessage_ArtillerySupport()
EMessageType_Goal
ECommunicationType
void SCR_AITalkRequest(ECommunicationType type, IEntity entity, vector pos, int enumSignal, bool transmitIfNoReceivers, bool transmitIfPassenger, SCR_EAITalkRequestPreset preset)
EAICompartmentType
float distance
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void AddRequest(SCR_AITalkRequest request)
bool CanBypass(SCR_AITalkRequest request=null)
static void CalculateInvestigationArea(notnull SCR_AITargetClusterState s, out vector outCenterPos, out float outRadius)
Calculates position and radius of investigation area.
EAIActionState
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
SCR_FieldOfViewSettings Attribute
ETargetCategory