‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_missile_drone.csc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\clientfield_shared;
4 #using scripts\shared\fx_shared;
5 #using scripts\shared\system_shared;
6 #using scripts\shared\util_shared;
7 
8 #insert scripts\shared\shared.gsh;
9 #insert scripts\shared\version.gsh;
10 
11 #using scripts\mp\_util;
12 
13 #precache( "client_fx", "killstreaks/fx_hrpy_single_light_red" );
14 
15 #using_animtree( "mp_missile_drone" );
16 
17 #namespace missile_drone;
18 
19 ‪REGISTER_SYSTEM( "missile_drone", &‪__init__, undefined )
20 
21 function ‪__init__()
22 {
23  level._effect["missile_drone_enemy_light"] = "killstreaks/fx_hrpy_single_light_red";
24  level._effect["missile_drone_friendly_light"] = "killstreaks/fx_hrpy_single_light_red";
28 }
29 
30 function ‪missile_drone_projectile_animate_cb( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
31 {
32  self endon( "entityshutdown" );
33  self endon( "death" );
34  wait( 0.1 );
35  self ‪util::waittill_dobj(localClientNum);
36  self UseAnimTree( #animtree );
37  self SetAnim( %o_drone_hunter_launch, 1.0, 0.0, 1.0 );
38 }
39 
40 function ‪missile_drone_projectile_active_cb( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
41 {
42  if ( newVal == 1 )
43  {
44  // iprintlnbold( "ON" );
45  self thread ‪fx::blinky_light( localClientNum, "tag_target", level._effect["missile_drone_friendly_light"], level._effect["missile_drone_enemy_light"] );
46  }
47  else
48  {
49  // iprintlnbold( "OFF" );
50  self thread ‪fx::stop_blinky_light( localClientNum );
51  }
52 }
53 
54 function ‪missile_drone_active_cb( localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump )
55 {
56  if( newVal == 2 )
57  {
58  //iprintlnbold( "ENABLED" );
59  self ‪targetAcquired( localClientNum );
60  }
61  else if( newVal == 1 )
62  {
63  //iprintlnbold( "ON" );
64  self ‪targetScan( localClientNum );
65  }
66  else
67  {
68  //iprintlnbold( "OFF" );
69  self ‪targetLost( localClientNum );
70  }
71 }
72 
73 function ‪targetLost( localClientNum )
74 {
75  self notify( "targetLost" );
76 
77  //iprintlnbold( "target Lost" );
78 
79  if ( isdefined ( self.missile_drone_fx ) )
80  {
81  stopFX( localClientNum, self.missile_drone_fx );
82  }
83  // stop viewModelFX
84 
85 }
86 function ‪targetAcquired( localClientNum )
87 {
88  self endon( "disconnect" );
89  self endon( "targetLost" );
90  self endon( "targetScanning" );
91  self endon( "entityshutdown" );
92  self notify( "targetAcquired" );
93 
94  soundPlayed = false;
95  for( ;; )
96  {
97  currentweapon = GetCurrentWeapon( localclientnum );
98 
99  if ( currentweapon.name != "missile_drone" && currentweapon.name != "inventory_missile_drone" )
100  {
101  waitrealtime( 1 );
102  continue;
103  }
104 
105  if ( IsADS( localclientnum ) || IsThrowingGrenade( localclientnum ) || IsMeleeing( localclientnum ) || IsOnTurret( localclientnum ) )
106  {
107  waitrealtime( 1 );
108  continue;
109  }
110 
111  if ( GetWeaponAmmoClip( localclientnum, currentweapon ) <= 0 )
112  {
113  waitrealtime( 1 );
114  continue;
115  }
116 
117  self.missile_drone_fx = PlayViewmodelFX( localClientNum, level._effect["missile_drone_enemy_light"], "tag_target" );
118 
119  if ( !soundPlayed )
120  {
121  playsound( localClientNum, "fly_hunter_raise_plr", self.origin );
122  }
123  soundPlayed = true;
124 
125  waitrealtime( .5 );
126  }
127 }
128 
129 function ‪targetScan( localClientNum )
130 {
131  self endon( "disconnect" );
132  self endon( "targetLost" );
133  self endon( "targetAcquired" );
134  self notify( "targetScanning" );
135 
136  soundPlayed = false;
137  for( ;; )
138  {
139  currentweapon = GetCurrentWeapon( localclientnum );
140 
141  if ( currentweapon.name != "missile_drone" && currentweapon.name != "inventory_missile_drone" )
142  {
143  waitrealtime( 1 );
144  continue;
145  }
146 
147 // if ( !soundPlayed )
148 // {
149 // playsound( localClientNum, "mpl_hk_scan", self.origin );
150 // }
151  soundPlayed = true;
152 
153  waitrealtime( 1 );
154  }
155 }
‪missile_drone_projectile_animate_cb
‪function missile_drone_projectile_animate_cb(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _missile_drone.csc:30
‪__init__
‪function __init__()
Definition: _missile_drone.csc:21
‪CF_CALLBACK_ZERO_ON_NEW_ENT
‪#define CF_CALLBACK_ZERO_ON_NEW_ENT
Definition: version.gsh:103
‪VERSION_SHIP
‪#define VERSION_SHIP
Definition: version.gsh:36
‪stop_blinky_light
‪function stop_blinky_light(localClientNum)
Definition: fx_shared.csc:315
‪targetAcquired
‪function targetAcquired(localClientNum)
Definition: _missile_drone.csc:86
‪blinky_light
‪function blinky_light(localClientNum, tagName, friendlyfx, enemyfx)
Definition: fx_shared.csc:280
‪CF_HOST_ONLY
‪#define CF_HOST_ONLY
Definition: version.gsh:102
‪missile_drone_active_cb
‪function missile_drone_active_cb(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _missile_drone.csc:54
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪targetLost
‪function targetLost(localClientNum)
Definition: _missile_drone.csc:73
‪targetScan
‪function targetScan(localClientNum)
Definition: _missile_drone.csc:129
‪waittill_dobj
‪function waittill_dobj(localClientNum)
Definition: util_shared.csc:1117
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪missile_drone_projectile_active_cb
‪function missile_drone_projectile_active_cb(localClientNum, oldVal, newVal, bNewEnt, bInitialSnap, fieldName, bWasTimeJump)
Definition: _missile_drone.csc:40