‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
zm_giant_fx.csc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\exploder_shared;
4 #using scripts\shared\scene_shared;
5 #using scripts\shared\util_shared;
6 
7 #insert scripts\shared\shared.gsh;
8 
9 #precache( "client_fx", "zombie/fx_glow_eye_orange" );
10 #precache( "client_fx", "electric/fx_elec_sparks_burst_sm_circuit_os" );
11 #precache( "client_fx", "electric/fx_elec_sparks_directional_orange" );
12 #precache( "client_fx", "electric/fx_elec_sparks_burst_sm_circuit_os" );
13 #precache( "client_fx", "maps/zombie/fx_zombie_light_glow_green" );
14 #precache( "client_fx", "maps/zombie/fx_zombie_light_glow_red" );
15 #precache( "client_fx", "electrical/fx_elec_wire_spark_dl_oneshot" );
16 #precache( "client_fx", "electric/fx_elec_sparks_burst_sm_circuit_os" );
17 #precache( "client_fx", "zombie/fx_glow_eye_orange" );
18 #precache( "client_fx", "zombie/fx_powerup_on_green_zmb" );
19 #precache( "client_fx", "zombie/fx_bul_flesh_head_fatal_zmb" );
20 #precache( "client_fx", "zombie/fx_bul_flesh_head_nochunks_zmb" );
21 #precache( "client_fx", "zombie/fx_bul_flesh_neck_spurt_zmb" );
22 #precache( "client_fx", "zombie/fx_blood_torso_explo_zmb" );
23 #precache( "client_fx", "trail/fx_trail_blood_streak" );
24 #precache( "client_fx", "env/fire/fx_embers_falling_sm" );
25 #precache( "client_fx", "zombie/fx_smk_stack_burning_zmb" );
26 #precache( "client_fx", "electric/fx_elec_sparks_burst_sm_circuit_os" );
27 #precache( "client_fx", "zombie/fx_elec_gen_idle_zmb" );
28 #precache( "client_fx", "zombie/fx_moon_eclipse_zmb" );
29 #precache( "client_fx", "zombie/fx_clock_hand_zmb" );
30 #precache( "client_fx", "zombie/fx_elec_pole_terminal_zmb" );
31 #precache( "client_fx", "electric/fx_elec_sparks_burst_sm_circuit_os" );
32 #precache( "client_fx", "dlc0/factory/fx_elec_trap_factory" );
33 
34 
35 // load fx used by util scripts
37 {
38 
39 }
40 
41 function ‪main()
42 {
45 
46  disableFX = GetDvarInt( "disable_fx" );
47  if( !IsDefined( disableFX ) || disableFX <= 0 )
48  {
50  }
51 
52  // use this array to convert a teleport_pad index to a, b, or c
53  level.teleport_pad_names = [];
54  level.teleport_pad_names[0] = "a";
55  level.teleport_pad_names[1] = "c";
56  level.teleport_pad_names[2] = "b";
57 
58  level thread ‪perk_wire_fx( "pw0", "pad_0_wire", "t01" );
59  level thread ‪perk_wire_fx( "pw1", "pad_1_wire", "t11" );
60  level thread ‪perk_wire_fx( "pw2", "pad_2_wire", "t21" );
61 
62  // Threads controlling the lights on the maps in the Teleporter rooms
63  level thread ‪teleporter_map_light( 0, "t01" );
64  level thread ‪teleporter_map_light( 1, "t11" );
65  level thread ‪teleporter_map_light( 2, "t21" );
66  level.map_light_receiver_on = false;
67  level thread ‪teleporter_map_light_receiver();
68 
69  level thread ‪light_model_swap( "smodel_light_electric", "lights_indlight_on" );
70  level thread ‪light_model_swap( "smodel_light_electric_milit", "lights_milit_lamp_single_int_on" );
71  level thread ‪light_model_swap( "smodel_light_electric_tinhatlamp", "lights_tinhatlamp_on" );
72 }
73 
75 {
76  level._effect["electric_short_oneshot"] = "electrical/fx_elec_sparks_burst_sm_circuit_os";
77  level._effect["switch_sparks"] = "electric/fx_elec_sparks_directional_orange";
78 
79  level._effect["elec_trail_one_shot"] = "electric/fx_elec_sparks_burst_sm_circuit_os";
80 
81  level._effect["zapper_light_ready"] = "maps/zombie/fx_zombie_light_glow_green";
82  level._effect["zapper_light_notready"] = "maps/zombie/fx_zombie_light_glow_red";
83  level._effect["wire_sparks_oneshot"] = "electrical/fx_elec_wire_spark_dl_oneshot";
84 
85  level._effect["wire_spark"] = "electric/fx_elec_sparks_burst_sm_circuit_os";
86 
87  level._effect["eye_glow"] = "zombie/fx_glow_eye_orange";
88  level._effect["headshot"] = "zombie/fx_bul_flesh_head_fatal_zmb";
89  level._effect["headshot_nochunks"] = "zombie/fx_bul_flesh_head_nochunks_zmb";
90  level._effect["bloodspurt"] = "zombie/fx_bul_flesh_neck_spurt_zmb";
91 
92  level._effect["powerup_on"] = "zombie/fx_powerup_on_green_zmb";
93 
94  level._effect["animscript_gib_fx"] = "zombie/fx_blood_torso_explo_zmb";
95  level._effect["animscript_gibtrail_fx"] = "trail/fx_trail_blood_streak";
96 }
97 
99 {
100  level._effect["a_embers_falling_sm"] = "env/fire/fx_embers_falling_sm";
101  level._effect["mp_smoke_stack"] = "zombie/fx_smk_stack_burning_zmb";
102  level._effect["mp_elec_spark_fast_random"] = "electric/fx_elec_sparks_burst_sm_circuit_os";
103  level._effect["zombie_elec_gen_idle"] = "zombie/fx_elec_gen_idle_zmb";
104  level._effect["zombie_moon_eclipse"] = "zombie/fx_moon_eclipse_zmb";
105  level._effect["zombie_clock_hand"] = "zombie/fx_clock_hand_zmb";
106  level._effect["zombie_elec_pole_terminal"] = "zombie/fx_elec_pole_terminal_zmb";
107  level._effect["mp_elec_broken_light_1shot"] = "electric/fx_elec_sparks_burst_sm_circuit_os";
108  level._effect["zapper"] = "dlc0/factory/fx_elec_trap_factory";
109 }
110 
111 function ‪perk_wire_fx(notify_wait, init_targetname, done_notify )
112 {
113  level waittill(notify_wait);
114 
115  players = getlocalplayers();
116  for(i = 0; i < players.size;i++)
117  {
118  players[i] thread ‪perk_wire_fx_client( i, init_targetname, done_notify );
119  }
120 }
121 
122 // Actually Plays the FX along the wire
123 function ‪perk_wire_fx_client( clientnum, init_targetname, done_notify )
124 {
125 
126  targ = ‪struct::get(init_targetname,"targetname");
127  if ( !IsDefined( targ ) )
128  {
129  return;
130  }
131 
132  mover = ‪spawn( clientnum, targ.origin, "script_model" );
133  mover SetModel( "tag_origin" );
134  fx = PlayFxOnTag( clientnum, level._effect["wire_spark"], mover, "tag_origin" );
135 
136  playsound( 0, "tele_spark_hit", mover.origin );
137  mover playloopsound( "tele_spark_loop");
138 
139  while(isDefined(targ))
140  {
141  if(isDefined(targ.target))
142  {
143 
144  target = ‪struct::get(targ.target,"targetname");
145 
146 // PlayFx( clientnum, level._effect["wire_spark"], mover.origin );
147  mover MoveTo( target.origin, 0.1 );
148  wait( 0.1 );
149 
150  targ = target;
151  }
152  else
153  {
154  break;
155  }
156  }
157  level notify( "spark_done" );
158  mover Delete();
159 
160  // Link complete, light is green
161  level notify( done_notify );
162 }
163 
164 
166 {
167  for ( localClientNum = 0; localClientNum < level.localPlayers.size; localClientNum++ )
168  {
169  SetLitFogBank( localClientNum, -1, 1, -1 );
170  SetWorldFogActiveBank( localClientNum, 2 );
171  }
172 
173  wait( 2.5 );
174 
175  for ( localClientNum = 0; localClientNum < level.localPlayers.size; localClientNum++ )
176  {
177  SetLitFogBank( localClientNum, -1, 0, -1 );
178  SetWorldFogActiveBank( localClientNum, 1 );
179  }
180 }
181 
182 //
183 // Replace the light models when the lights turn on and off
184 function ‪light_model_swap( ‪name, model )
185 {
186  level waittill( "pl1" ); // Power lights on
187 
188  players = getlocalplayers();
189  for ( p=0; p<players.size; p++ )
190  {
191  lamps = GetEntArray( p, ‪name, "targetname" );
192  for ( i=0; i<lamps.size; i++ )
193  {
194  lamps[i] SetModel( model );
195  }
196  }
197 }
198 
199 
200 //
201 // This is some crap to get around my inability to get usable angles from a model in a prefab
203 {
204  guide_structs = ‪struct::get_array( "map_fx_guide_struct", "targetname" );
205  if ( guide_structs.size > 0 )
206  {
207  guide = guide_structs[0];
208  dist = DistanceSquared(ent.origin, guide.origin);
209  for ( i=1; i<guide_structs.size; i++ )
210  {
211  new_dist = DistanceSquared(ent.origin, guide_structs[i].origin);
212  if ( new_dist < dist )
213  {
214  guide = guide_structs[i];
215  dist = new_dist;
216  }
217  }
218 
219  return guide.angles;
220  }
221 
222  return (0, 0, 0);
223 }
224 
225 // Controls the lights on the teleporters
226 // client-sided in case we do any flashing/blinking
227 function ‪teleporter_map_light( index, on_msg )
228 {
229  level waittill( "pl1" ); // power lights on
230 
231  ‪exploder::exploder( "map_lgt_" + level.teleport_pad_names[index] + "_red" );
232 
233  // wait until it is linked
234  level waittill( on_msg );
235 
236  ‪exploder::stop_exploder( "map_lgt_" + level.teleport_pad_names[index] + "_red" );
237  ‪exploder::exploder( "map_lgt_" + level.teleport_pad_names[index] + "_green" );
238 
239  level thread ‪scene::play( "fxanim_diff_engine_zone_" + level.teleport_pad_names[index] + "1", "targetname" );
240  level thread ‪scene::play( "fxanim_diff_engine_zone_" + level.teleport_pad_names[index] + "2", "targetname" );
241 
242  level thread ‪scene::play( "fxanim_powerline_" + level.teleport_pad_names[index], "targetname" );
243 }
244 
245 //
246 // The map light for the receiver is special. It acts differently than the teleporter lights
247 //
249 {
250  level waittill( "pl1" ); // power lights on
251 
253 
254  ‪exploder::exploder( "map_lgt_pap_red" );
255 
256  level waittill( "pap1" ); // Pack-a-Punch On
257  wait( 1.5 ); // dramatic pause
258 
259  ‪exploder::stop_exploder( "map_lgt_pap_red" );
260  ‪exploder::stop_exploder( "map_lgt_pap_flash" );
261  ‪exploder::exploder( "map_lgt_pap_green" );
262 }
263 
264 
265 //
266 // When the players try to link teleporters, we need to flash the light
267 //
269 {
270  level endon( "pap1" ); // Pack-A-Punch machine is on
271  level waittill( "TRf" ); // Teleporter Receiver map light flash
272 
273  // After you have started, then you can end when you get a stop command.
274  // Putting it after you start prevents premature stopping
275  level endon( "TRs" ); // Teleporter receiver map light stop
277 
278  ‪exploder::stop_exploder( "map_lgt_pap_red" );
279  ‪exploder::exploder( "map_lgt_pap_flash" );
280 }
281 
282 
283 //
284 // When you stop flashing, put the correct model back on
286 {
287  level endon( "pap1" ); // Pack-A-Punch machine is on
288 
289  level waittill( "TRs" ); // teleporter receiver light stop
290 
291  ‪exploder::stop_exploder( "map_lgt_pap_flash" );
292  ‪exploder::exploder( "map_lgt_pap_red" );
293 
294  // listen for another flash message
296 }
297 
‪exploder
‪function exploder(exploder_id, n_localclientnumber)
Definition: exploder_shared.csc:297
‪main
‪function main()
Definition: zm_giant_fx.csc:41
‪stop_exploder
‪function stop_exploder(exploder_id, n_localclientnumber)
Definition: exploder_shared.csc:368
‪teleporter_map_light_receiver
‪function teleporter_map_light_receiver()
Definition: zm_giant_fx.csc:248
‪precache_createfx_fx
‪function precache_createfx_fx()
Definition: zm_giant_fx.csc:98
‪get_guide_struct_angles
‪function get_guide_struct_angles(ent)
Definition: zm_giant_fx.csc:202
‪teleporter_map_light
‪function teleporter_map_light(index, on_msg)
Definition: zm_giant_fx.csc:227
‪play
‪function play(animation, v_origin_or_ent, v_angles_or_tag, n_rate=1, n_blend_in=.2, n_blend_out=.2, n_lerp, b_link=false)
Definition: animation_shared.csc:44
‪get_array
‪function get_array(kvp_value, kvp_key="targetname")
Definition: struct.csc:34
‪spawn
‪function spawn(v_origin=(0, 0, 0), v_angles=(0, 0, 0))
Definition: struct.csc:23
‪precache_util_fx
‪function precache_util_fx()
Definition: zm_giant_fx.csc:36
‪get
‪function get(kvp_value, kvp_key="targetname")
Definition: struct.csc:13
‪teleporter_map_light_receiver_flash
‪function teleporter_map_light_receiver_flash()
Definition: zm_giant_fx.csc:268
‪precache_scripted_fx
‪function precache_scripted_fx()
Definition: zm_giant_fx.csc:74
‪perk_wire_fx_client
‪function perk_wire_fx_client(clientnum, init_targetname, done_notify)
Definition: zm_giant_fx.csc:123
‪ramp_fog_in_out
‪function ramp_fog_in_out()
Definition: zm_giant_fx.csc:165
‪perk_wire_fx
‪function perk_wire_fx(notify_wait, init_targetname, done_notify)
Definition: zm_giant_fx.csc:111
‪teleporter_map_light_receiver_stop
‪function teleporter_map_light_receiver_stop()
Definition: zm_giant_fx.csc:285
‪name
‪class GroundFx name
‪light_model_swap
‪function light_model_swap(name, model)
Definition: zm_giant_fx.csc:184