1 #using scripts\shared\ai_shared;
2 #using scripts\shared\array_shared;
3 #using scripts\shared\flag_shared;
4 #using scripts\shared\system_shared;
5 #using scripts\shared\trigger_shared;
6 #using scripts\shared\spawner_shared;
7 #using scripts\shared\util_shared;
9 #insert scripts\shared\archetype_shared\archetype_shared.gsh;
10 #insert scripts\shared\shared.gsh;
13 #define IS_NULL(variable) (IsInt(variable) && variable == 0)
15 #define SQUAD_RADIUS_MIN 200
16 #define SQUAD_RADIUS_MAX 300
18 #define SQUAD_BREADCRUMB_DISTSQ 96 * 96
19 #define SQUAD_SPRINT_OFFSET_DISTSQ 150 * 150
29 actorSpawnerArray = GetActorSpawnerTeamArray(
"axis" );
53 /# RecordCircle( ai.origin, 4,
BLUE,
"Animscript", ai ); #/
123 level._squads[squadName] =
new Squad();
124 return level._squads[squadName];
129 if( IsDefined( level._squads ) && IsDefined( level._squads[squadName] ) )
131 level._squads[squadName] = undefined;
137 return level._squads[squadName];
144 if( [[ level._squads[squadName] ]]->Think() )
158 self waittill(
"death" );
160 if( IsDefined(
self.squadName ) && IsDefined( level._squads[
self.squadName] ) )
162 [[ level._squads[
self.squadName] ]]->RemoveAIFromSqaud(
self );
170 if( !IsDefined(
self.script_aisquadname ) )
177 self.squadName =
self.script_aisquadname;
179 if( IsDefined(
self.squadName ) )
182 if( !IsDefined( level._squads[
self.squadName] ) )
185 newSquadCreated =
true;
193 [[squad]]->AddAIToSquad(
self );
207 squadLeader = [[ level._squads[
self.squadName] ]]->GetLeader();
213 /# RecordEntText(
self.squadName +
": LEADER",
self,
GREEN,
"Animscript" ); #/
214 /# RecordEntText(
self.squadName +
": LEADER",
self,
GREEN,
"Animscript" ); #/
217 if( IsDefined(
self.enemy ) )
219 self SetGoal(
self.enemy );
222 [[squad]]->addSquadBreadCrumbs(
self );
227 /# RecordEntText(
self.squadName+
": FOLLOWER",
self,
GREEN,
"Animscript" ); #/
229 followPosition = [[squad]]->getSquadBreadCrumb();
230 followDistSq = Distance2DSquared(
self.goalPos, followPosition );
234 if( !IsDefined(
self.enemy ) || ( IsDefined(
self.enemy ) &&
self.enemy !=
squadLeader.enemy ) )
238 if( IsDefined(
self.goalPos ) && followDistSq >= 16 * 16 )
249 self SetGoal( followPosition,
true );
269 isAISquadLeader = IsDefined( currentSquadLeader ) && currentSquadLeader == ai;
271 if( squadMember && !isAISquadLeader )
281 if( IsDefined( ai.squadName ) )
285 if( IsDefined( squad ) )
296 if( IsDefined( ai.squadName ) )
300 if( IsDefined( squad ) )
313 if( IsDefined( ai.squadName ) )
317 if( IsDefined( squad ) )
319 return [[squad]]->GetLeader();