‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_zm_trap_fire.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\clientfield_shared;
4 #using scripts\shared\exploder_shared;
5 #using scripts\shared\laststand_shared;
6 #using scripts\shared\system_shared;
7 #using scripts\shared\visionset_mgr_shared;
8 #using scripts\shared\util_shared;
9 #using scripts\shared\_burnplayer;
10 
11 #insert scripts\shared\shared.gsh;
12 #insert scripts\shared\version.gsh;
13 
14 #using scripts\zm\_zm_audio;
15 #using scripts\zm\_zm_stats;
16 #using scripts\zm\_zm_traps;
17 #using scripts\zm\_zm_utility;
18 
19 #using scripts\shared\ai\zombie_death;
20 
21 #insert scripts\zm\_zm_perks.gsh;
22 #insert scripts\zm\_zm_traps.gsh;
23 
24 #namespace zm_trap_fire;
25 
26 ‪REGISTER_SYSTEM( "zm_trap_fire", &‪__init__, undefined )
27 
28 function ‪__init__()
29 {
32 
33  a_traps = ‪struct::get_array( "trap_fire", "targetname" );
34  foreach( trap in a_traps )
35  {
36  ‪clientfield::register( "world", trap.script_noteworthy, ‪VERSION_DLC5, 1, "int" );
37  }
38 }
39 
41 {
42  self._trap_duration = 40;
43  self._trap_cooldown_time = 60;
44 
45  if ( isdefined( level.sndTrapFunc ) )
46  {
47  level thread [[ level.sndTrapFunc ]]( self, 1 );
48  }
49 
50  self notify("trap_activate");//TODO let's get rid of this and instead use the level notify
51  level notify( "trap_activate", self );
52 
53  level ‪clientfield::set( self.target , 1 );
54 
55  // Kick off audio
56  fx_points = ‪struct::get_array( self.target,"targetname" );
57  for( i=0; i<fx_points.size; i++ )
58  {
60  fx_points[i] thread ‪trap_audio(self);
61  }
62 
63  // Do the damage
64  self thread ‪zm_traps::trap_damage();
65  self ‪util::waittill_notify_or_timeout( "trap_deactivate", self._trap_duration );
66 
67  // Shut down
68  self notify ("trap_done");
69 
70  level ‪clientfield::set( self.target , 0 );
71 }
72 
73 function ‪trap_audio( trap )
74 {
75  sound_origin = ‪Spawn( "script_origin", self.origin );
76  sound_origin PlaySound( "wpn_zmb_inlevel_fire_trap_start" );
77  sound_origin PlayLoopSound( "wpn_zmb_inlevel_fire_trap_loop" );
78  self thread ‪play_fire_sound( trap );
79 
80  trap ‪util::waittill_any_timeout( trap._trap_duration, "trap_done");
81 
82  if(isdefined(sound_origin))
83  {
84  PlaySoundAtPosition( "wpn_zmb_inlevel_fire_trap_stop", sound_origin.origin );
85 
86  sound_origin StopLoopSound();
87  wait(.05);
88  playsoundatposition ("zmb_fire_trap_cooldown", sound_origin.origin);
89  sound_origin Delete();
90  }
91 }
92 
93 function ‪play_fire_sound( trap )
94 {
95  trap endon ("trap_done");
96  while( 1 )
97  {
98  wait( RandomFloatRange(0.1, 0.5) );
99  playsoundatposition( "amb_flame", self.origin );//TODO T7 sound
100  }
101 }
102 
104 {
105  self endon("death");
106  self endon("disconnect");
107 
108  if( !‪IS_TRUE( self.is_burning ) && !self ‪laststand::player_is_in_laststand() )
109  {
110  self.is_burning = 1;
111  if( ‪IS_TRUE( level.trap_fire_visionset_registered ) )
112  {
113  ‪visionset_mgr::activate( "overlay", "zm_trap_burn", self, ‪ZM_TRAP_BURN_MAX, ‪ZM_TRAP_BURN_MAX );
114  }
115  else
116  {
117  self burnplayer::setplayerburning( ‪ZM_TRAP_BURN_MAX, .05, 0 );
118  }
119 
120  self notify("burned");
121 
122  if(!self HasPerk( ‪PERK_JUGGERNOG ) || self.health - 100 < 1)
123  {
124  RadiusDamage(self.origin,10,self.health + 100,self.health + 100);
125  self.is_burning = undefined;
126  }
127  else
128  {
129  self DoDamage(50, self.origin);
130  wait(.1);
131  self playsound("zmb_ignite"); //TODO make custom sound later
132  self.is_burning = undefined;
133  }
134  }
135 }
136 
137 function ‪damage( trap )
138 {
139  self endon("death");
140 
141  n_param = RandomInt(100);
142 
143  self.marked_for_death = true;
144 
145  // Param is used as a random chance number
146 
147  if ( isdefined( self.animname ) && self.animname != "zombie_dog" )
148  {
149  // 10% chance the zombie will burn, a max of 6 burning zombs can be going at once
150  // otherwise the zombie just gibs and dies
151  if( (n_param > 90) && (level.burning_zombies.size < 6) )
152  {
153  level.burning_zombies[level.burning_zombies.size] = self;
154  self thread ‪zm_traps::zombie_flame_watch();
155  self PlaySound("zmb_ignite");
156 
157  self thread ‪zombie_death::flame_death_fx();
158  PlayFxOnTag( level._effect["character_fire_death_torso"], self, "J_SpineLower" );
159 
160  wait( RandomFloat(1.25) );
161  }
162  else
163  {
164  refs[0] = "guts";
165  refs[1] = "right_arm";
166  refs[2] = "left_arm";
167  refs[3] = "right_leg";
168  refs[4] = "left_leg";
169  refs[5] = "no_legs";
170  refs[6] = "head";
171  self.a.gib_ref = refs[RandomInt(refs.size)];
172 
173  PlaySoundAtPosition("zmb_ignite", self.origin);
174 
175  wait( RandomFloat(1.25) );
176  self PlaySound("zmb_vocals_zombie_death_fire");
177  }
178  }
179 
180  // custom damage
181  if ( isdefined( self.fire_damage_func ) )
182  {
183  self [[ self.fire_damage_func ]]( trap );
184  }
185  else
186  {
187  level notify( "trap_kill", self, trap );
188  self DoDamage(self.health + 666, self.origin, trap);
189  }
190 }
‪PERK_JUGGERNOG
‪#define PERK_JUGGERNOG
Definition: mechz.gsc:47
‪activate
‪function activate()
Definition: traps_shared.gsc:655
‪register_trap_basic_info
‪function register_trap_basic_info(str_trap, func_activate, func_audio)
Definition: _zm_traps.gsc:1220
‪get_array
‪function get_array(kvp_value, kvp_key="targetname")
Definition: struct.csc:34
‪player_damage
‪function player_damage()
Definition: _zm_trap_fire.gsc:103
‪damage
‪function damage(trap)
Definition: _zm_trap_fire.gsc:137
‪waittill_any_timeout
‪function waittill_any_timeout(n_timeout, string1, string2, string3, string4, string5)
Definition: util_shared.csc:423
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪register_trap_damage
‪function register_trap_damage(str_trap, func_player_damage, func_damage)
Definition: _zm_traps.gsc:1257
‪play_fire_sound
‪function play_fire_sound(trap)
Definition: _zm_trap_fire.gsc:93
‪trap_activate_fire
‪function trap_activate_fire()
Definition: _zm_trap_fire.gsc:40
‪ZM_TRAP_BURN_MAX
‪#define ZM_TRAP_BURN_MAX
Definition: _zm_traps.gsh:3
‪wait_network_frame
‪function wait_network_frame(n_count=1)
Definition: util_shared.gsc:64
‪waittill_notify_or_timeout
‪function waittill_notify_or_timeout(msg, timer)
Definition: util_shared.csc:473
‪trap_damage
‪function trap_damage()
Definition: _zm_traps.gsc:695
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪__init__
‪function __init__()
Definition: _zm_trap_fire.gsc:28
‪Spawn
‪function Spawn(parent, onDeathCallback)
Definition: _flak_drone.gsc:427
‪flame_death_fx
‪function flame_death_fx(localClientNum)
Definition: zombie_death.csc:35
‪trap_audio
‪function trap_audio(trap)
Definition: _zm_trap_fire.gsc:73
‪zombie_flame_watch
‪function zombie_flame_watch()
Definition: _zm_traps.gsc:976
‪set
‪function set(str_field_name, n_value)
Definition: clientfield_shared.gsc:34
‪VERSION_DLC5
‪#define VERSION_DLC5
Definition: version.gsh:99
‪player_is_in_laststand
‪function player_is_in_laststand()
Definition: laststand_shared.gsc:18
‪register
‪function register()
Definition: _ai_tank.gsc:126