‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_fx.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\exploder_shared;
4 #using scripts\shared\fx_shared;
5 #using scripts\shared\sound_shared;
6 
7 #insert scripts\shared\shared.gsh;
8 
9 #using scripts\zm\_util;
10 
11 /*
12  ****************************************************************************************************************
13  GunFireLoopfx: Simulates bursts of fire.
14  fx::gunfireloopfx(fxId, fxPos, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax)
15 
16  Example:
17  fx::gunfireloopfx (level.medFire, // Medium fire effect
18  (-701, -18361, 148), // Origin
19  10, 15, // 10 to 15 shots
20  0.1, 0.3, // 0.1 to 0.3 seconds between shots
21  2.5, 9); // 2.5 to 9 seconds between sets of shots.
22  ****************************************************************************************************************
23 
24  ****************************************************************************************************************
25  GrenadeExplosionfx: Creates a grenade explosion with view jitter.
26  fx::GrenadeExplosionfx((x y z));
27 
28  Example:
29  fx::GrenadeExplosionfx( (-701, -18361, 148) ); // origin
30  ****************************************************************************************************************
31 */
32 
33 #namespace fx;
34 
35 function ‪print_org (fxcommand, fxId, fxPos, waittime)
36 {
37 }
38 
39 function ‪gunfireloopfx(fxId, fxPos, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax)
40 {
41  thread ‪gunfireloopfxthread (fxId, fxPos, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax);
42 }
43 
44 function ‪gunfireloopfxthread (fxId, fxPos, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax)
45 {
46  level endon ("stop all gunfireloopfx");
47  wait .05; // waitframe
48 
49  if (betweenSetsMax < betweenSetsMin)
50  {
51  temp = betweenSetsMax;
52  betweenSetsMax = betweenSetsMin;
53  betweenSetsMin = temp;
54  }
55 
56  betweenSetsBase = betweenSetsMin;
57  betweenSetsRange = betweenSetsMax - betweenSetsMin;
58 
59  if (shotdelayMax < shotdelayMin)
60  {
61  temp = shotdelayMax;
62  shotdelayMax = shotdelayMin;
63  shotdelayMin = temp;
64  }
65 
66  shotdelayBase = shotdelayMin;
67  shotdelayRange = shotdelayMax - shotdelayMin;
68 
69  if (shotsMax < shotsMin)
70  {
71  temp = shotsMax;
72  shotsMax = shotsMin;
73  shotsMin = temp;
74  }
75 
76  shotsBase = shotsMin;
77  shotsRange = shotsMax - shotsMin;
78 
79  fxEnt = spawnFx( level._effect[fxId], fxPos );
80  for (;;)
81  {
82  shotnum = shotsBase + randomint (shotsRange);
83  for (i=0;i<shotnum;i++)
84  {
85  triggerFx( fxEnt );
86 
87  wait (shotdelayBase + randomfloat (shotdelayRange));
88  }
89  wait (betweenSetsBase + randomfloat(betweenSetsRange));
90  }
91 }
92 
93 function ‪gunfireloopfxVec(fxId, fxPos, fxPos2, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax)
94 {
95  thread ‪gunfireloopfxVecthread (fxId, fxPos, fxPos2, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax);
96 }
97 
98 function ‪gunfireloopfxVecthread (fxId, fxPos, fxPos2, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax)
99 {
100  level endon ("stop all gunfireloopfx");
101  wait .05; // waitframe
102 
103  if (betweenSetsMax < betweenSetsMin)
104  {
105  temp = betweenSetsMax;
106  betweenSetsMax = betweenSetsMin;
107  betweenSetsMin = temp;
108  }
109 
110  betweenSetsBase = betweenSetsMin;
111  betweenSetsRange = betweenSetsMax - betweenSetsMin;
112 
113  if (shotdelayMax < shotdelayMin)
114  {
115  temp = shotdelayMax;
116  shotdelayMax = shotdelayMin;
117  shotdelayMin = temp;
118  }
119 
120  shotdelayBase = shotdelayMin;
121  shotdelayRange = shotdelayMax - shotdelayMin;
122 
123  if (shotsMax < shotsMin)
124  {
125  temp = shotsMax;
126  shotsMax = shotsMin;
127  shotsMin = temp;
128  }
129 
130  shotsBase = shotsMin;
131  shotsRange = shotsMax - shotsMin;
132 
133  fxPos2 = vectornormalize (fxPos2 - fxPos);
134 
135  fxEnt = spawnFx ( level._effect[fxId], fxPos, fxPos2 );
136 
137  for (;;)
138  {
139  shotnum = shotsBase + randomint (shotsRange);
140  for (i=0;i<int(shotnum/level.fxfireloopmod);i++)
141  {
142  triggerFx( fxEnt );
143  ‪delay =((shotdelayBase + randomfloat (shotdelayRange))*level.fxfireloopmod);
144  if(‪delay < .05)
145  ‪delay = .05;
146  wait ‪delay;
147  }
148  wait (shotdelayBase + randomfloat (shotdelayRange));
149  wait (betweenSetsBase + randomfloat(betweenSetsRange));
150  }
151 }
152 
154 {
155  playfx (level._effect["mechanical explosion"], pos);
156  ‪earthquake(0.15, 0.5, pos, 250);
157  // TODO: Add explosion effect and view jitter
158 // println("The script command grenadeExplosionEffect has been removed. fx::GrenadeExplosionfx must be set up to make an effect and jitter the view.");
159 }
‪gunfireloopfxthread
‪function gunfireloopfxthread(fxId, fxPos, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax)
Definition: _fx.gsc:44
‪gunfireloopfxVecthread
‪function gunfireloopfxVecthread(fxId, fxPos, fxPos2, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax)
Definition: _fx.gsc:98
‪delay
‪function delay(time_or_notify, str_endon, func, arg1, arg2, arg3, arg4, arg5, arg6)
Definition: util_shared.csc:784
‪gunfireloopfxVec
‪function gunfireloopfxVec(fxId, fxPos, fxPos2, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax)
Definition: _fx.gsc:93
‪print_org
‪function print_org(fxcommand, fxId, fxPos, waittime)
Definition: _fx.gsc:35
‪GrenadeExplosionfx
‪function GrenadeExplosionfx(pos)
Definition: _fx.gsc:153
‪earthquake
‪function earthquake()
Definition: exploder_shared.gsc:850
‪gunfireloopfx
‪function gunfireloopfx(fxId, fxPos, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax)
Definition: _fx.gsc:39