summaryrefslogtreecommitdiff
path: root/sneed.gsc
blob: dfde794d7972aa7d43f56abae2e6b3d67881deeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
/*
 *	 Black Ops 2 Plutonium
 *
 *	 Creator : Rafael Marçalo
 *	 Project : SneedZombies
 *	 Version : v1
 *	 Mode : Zombies
 *	 Date : 2023/03/20
 *
 */

//////////////
// INCLUDES //
//////////////

#include common_scripts/utility;
#include maps/mp/gametypes_zm/_hud_util;
#include maps/mp/zombies/_zm;
#include maps/mp/zombies/_zm_utility;
#include maps/mp/zombies/_zm_weapons;
#include maps/mp/zombies/_zm_afterlife;
#include maps/mp/zombies/_zm_perks;

//////////
// MAIN //
//////////

init() // entry point
{
	// level setPerkLimit(12); // Sets the max perks allowed to be consumed per player
	level thread onplayerconnect();
}

onplayerconnect()
{
	for(;;)
	{
		level waittill("connected", player);
		player thread onplayerspawned();
	}
}

onplayerspawned()
{
	self endon("disconnect");
	for(;;)
	{
		// self thread darkMode();	// Forces the map to have a darker color palette
		// self infinteAfterlife();	// You'll get infinte time in afterlife;
		self waitForLoadedLevel();
		// self thread welcomeMessage("^3 Welcome to ^1SneedZombies ^3it's time to ^1SNEED ^3some zombies and ^1FEED ^3some points");	// Shows a welcome message
		// self thread zombieCounter(0, 190);	// Shows the number of zombies alive, the parameters are the coordinates X and Y where the counter will appear
		// self thread healthCounter(0, 190);	// Shows your health, the parameters are the coordinates X and Y where the counter will appear
		// level thread customMysteryBoxPrice(500);			// Sets the default mystery box price, the parameters define the box price value
		// self thread customStartingPoints(1000);			// Sets the default player's starting points, the parameters define the players's starting points value
		// self thread customPrimaryWeapon("galil_zm", true);		// Gives the player a custom primary weapon, the parameters define the base weapon codename and true/false if the weapon should come upgraded or not
		// self thread customSecondaryWeapon("ray_gun_zm", false);	// Gives the player a custom secondary weapon, the parameters define the base weapon codename and true/false if the weapon should come upgraded or not
		// level customZombieSpawnLimit(24);	// Sets the max amount of spawned zombies per round
		// self thread perkaholic(true);	// Gives the player all the available perks in the game, the parameters define if the player should see the bottle drinking animation;
		// self godMode();			// Enables player god mode
		// self thread unlimitedAmmo();		// Enables the player to have unlimited ammo;
	}
}

///////////////////////
// !! DANGER ZONE !! //
///////////////////////

///////////////
// MAIN MODS //
///////////////

setPerkLimit(numberOfPerks)
{
	self.perk_purchase_limit = numberOfPerks;
}

welcomeMessage(message)
{
	level waittill( "start_of_round" );
	self iprintln(message);
}

zombieCounter(x, y)
{
	self.zombiecounter = drawCounter(self.zombiecounter, x, y, "Objective", 1.7);

	for(;;)
	{
		zombies = level.zombie_total + get_current_zombie_count();
		if ( zombies > 0 )
		{
			self.zombiecounter.label = &"Zombies: ^1";
		}
		else
		{
			self.zombiecounter.label = &"Zombies: ^6";
		}

		self.zombiecounter setvalue(zombies);
		wait 0.05;
	}
}

healthCounter(x, y)
{
	self.healthcounter = drawCounter(self.healthcounter, x, y, "Objective", 1.7);

	for(;;)
	{
		if ( self checkAfterlife() )
		{
			self.healthcounter.alpha = 0.2;
		}
		else
		{
			self.healthcounter.alpha = 1;
		}

		health = self.health;

		if( health <= 15 )
		{
			self.healthcounter.label = &"Health: ^1";
		}
		else if ( self.health <= 50 )
		{
			self.healthcounter.label = &"Health: ^3";
		}
		else
		{
			self.healthcounter.label = &"Health: ^2";
		}

		self.healthcounter setValue(health);
		wait 0.05;
	}
}

perkaholic(animation)
{
	if (isDefined(self.customPrimary) && self.customPrimary)
	{
		self waittill("customPrimary");
	}

	self giveAllPerks(animation);
}

customMysteryBoxPrice(price)
{
	for (i = 0; i < self.chests.size; i++)
	{
		self.chests[ i ].zombie_cost = price;
		self.chests[ i ].old_cost = price;
	}
}

customStartingPoints(points)
{
	self.score = points;
}

customPrimaryWeapon(weapon, upgraded)
{
	self.customPrimary = true;
	currentWeapon = self getcurrentweapon();

	if ( currentWeapon != "none" )
	{
		self takeweapon(currentWeapon);
	}

	if ( upgraded )
	{
		self givePaPWeapon(weapon);
	}
	else
	{
		self giveWeapon(weapon);
	}

	self waittill("weapon_change_complete");
	self notify("customPrimary");
}

customSecondaryWeapon(weapon, upgraded)
{
	self.customSecondary = true;

	offHandWeapon = self getcurrentoffhand();

	if ( offHandWeapon != "none" )
	{
		self takeweapon(offHandWeapon);
	}

	if ( upgraded )
	{
		self givePaPWeapon(weapon);
	}
	else
	{
		self giveWeapon(weapon);
	}
}

customZombieSpawnLimit(limit)
{
	self.zombie_ai_limit = limit;
}

godMode()
{
	self enableInvulnerability(); // ToDo: Fix when coming back from afterlife, the god mode wears off
}

unlimitedAmmo()
{
	for(;;)
	{
		wait 0.05;

		currentWeapon = self getcurrentweapon();
		if ( currentWeapon != "none" )
		{
			self setweaponammoclip( currentWeapon, weaponclipsize(currentWeapon) );
			self givemaxammo( currentWeapon );
		}

		currentoffhand = self getcurrentoffhand();

		if ( currentoffhand != "none" )
		{
			self givemaxammo( currentoffhand );
		}
	}
}

darkMode()
{
	self setclientdvar( "r_dof_enable", 0 );
	self setclientdvar( "r_lodBiasRigid", -1000 );
	self setclientdvar( "r_lodBiasSkinned", -1000 );
	self setclientdvar( "r_enablePlayerShadow", 1 );
	self setclientdvar( "r_skyTransition", 1 );
	self setclientdvar( "sm_sunquality", 2 );
	self setclientdvar( "vc_fbm", "0 0 0 0" );
	self setclientdvar( "vc_fsm", "1 1 1 1" );
	self thread visualFix();
	self thread enableDarkMode();
}

// Mob of the Dead Specific
infinteAfterlife()
{
	self.infinite_mana = 1;
}


///////////////////
// AUXILIAR CODE //
///////////////////

waitForLoadedLevel()
{
	self waittill("spawned_player");
	flag_wait( "initial_blackscreen_passed" );

	if ( self checkAfterlife() && level initialRound() )
	{
		self waittill("player_revived");
	}

	wait 1;
}

drawCounter(counterVar, x, y, font, size)
{
	counterVar = createfontstring( font, size );
	counterVar setpoint( "CENTER", "CENTER", x, y);
	counterVar.alpha = 1;
	counterVar.hidewheninmenu = 1;
	counterVar.hidewhendead = 1;
	return counterVar;
}

// Level Entity
initialRound()
{
	return (self.round_number == self.start_round);
}

// Player Entity
checkAfterlife()
{
	if( isDefined(self.afterlife) && self.afterlife )
	{
		return 1;
	}
	return 0;
}

doGivePerk(perk, animation)
{
	if ( animation )
	{
		self endon("perk_abort_drinking");
		if (!(self hasperk(perk) || (self maps/mp/zombies/_zm_perks::has_perk_paused(perk))))
		{
			gun = self maps/mp/zombies/_zm_perks::perk_give_bottle_begin(perk);
			evt = self waittill_any_return("fake_death", "death", "player_downed", "weapon_change_complete");
			if (evt == "weapon_change_complete")
				self thread maps/mp/zombies/_zm_perks::wait_give_perk(perk, 1);
			self maps/mp/zombies/_zm_perks::perk_give_bottle_end(gun, perk);
			if (self maps/mp/zombies/_zm_laststand::player_is_in_laststand() || isDefined(self.intermission) && self.intermission)
				return;
			self notify("burp");
		}
	}
	else
	{
		if (!(self hasperk(perk) || (self maps/mp/zombies/_zm_perks::has_perk_paused(perk))))
		{
			self give_perk(perk);
		}
	}
}

giveAllPerks(animation)
{
	if (isDefined(level.zombiemode_using_juggernaut_perk) && level.zombiemode_using_juggernaut_perk)
		self doGivePerk("specialty_armorvest", animation);
	if (isDefined(level._custom_perks) && isDefined(level._custom_perks["specialty_nomotionsensor"]))
		self doGivePerk("specialty_nomotionsensor", animation);
	if (isDefined(level.zombiemode_using_doubletap_perk) && level.zombiemode_using_doubletap_perk)
		self doGivePerk("specialty_rof", animation);
	if (isDefined(level.zombiemode_using_marathon_perk) && level.zombiemode_using_marathon_perk)
		self doGivePerk("specialty_longersprint", animation);
	if (isDefined(level.zombiemode_using_sleightofhand_perk) && level.zombiemode_using_sleightofhand_perk)
		self doGivePerk("specialty_fastreload", animation);
	if(isDefined(level.zombiemode_using_additionalprimaryweapon_perk) && level.zombiemode_using_additionalprimaryweapon_perk)
		self doGivePerk("specialty_additionalprimaryweapon", animation);
	if (isDefined(level.zombiemode_using_revive_perk) && level.zombiemode_using_revive_perk)
		self doGivePerk("specialty_quickrevive", animation);
	if (isDefined(level.zombiemode_using_chugabud_perk) && level.zombiemode_using_chugabud_perk)
		self doGivePerk("specialty_finalstand", animation);
	if (isDefined(level._custom_perks) && isDefined(level._custom_perks["specialty_grenadepulldeath"]))
		self doGivePerk("specialty_grenadepulldeath", animation);
	if (isDefined(level._custom_perks) && isDefined(level._custom_perks["specialty_flakjacket"]) && (l.script != "zm_buried"))
		self doGivePerk("specialty_flakjacket", animation);
	if (isDefined(level.zombiemode_using_deadshot_perk) && level.zombiemode_using_deadshot_perk)
		self doGivePerk("specialty_deadshot", animation);
	if (isDefined(level.zombiemode_using_tombstone_perk) && level.zombiemode_using_tombstone_perk)
		self doGivePerk("specialty_scavenger", animation);
}

giveWeapon(weapon)
{
	if ( isDefined(weapon) )
	{

		self giveWeapon(weapon);
		self givemaxammo(weapon);
	}
}

givePaPWeapon(baseWeapon)
{
	if ( isDefined(baseWeapon) )
	{
		weapon = get_upgrade_weapon(baseWeapon, 0);
		if ( isDefined(weapon) )
		{
			self giveweapon(weapon, 0, self get_pack_a_punch_weapon_options(weapon));
			self givemaxammo(weapon);
		}
	}
}

visualFix()
{
	if( level.script == "zm_buried" )
	{
		while( 1 )
		{
			self setclientdvar( "r_lightTweakSunLight", 1 );
			self setclientdvar( "r_sky_intensity_factor0", 0 );
			wait 0.05;
		}
	}
	else if( level.script == "zm_prison" || level.script == "zm_tomb" )
	{
		while( getDvar( "r_lightTweakSunLight" ) != 0 )
		{
			for( i = getDvar( "r_lightTweakSunLight" ); i >= 0; i = ( i - 0.05 ) )
			{
				self setclientdvar( "r_lightTweakSunLight", i );
				wait 0.05;
			}
			wait 0.05;
		}
	}
	else return;
}

enableDarkMode()
{
	if( !isDefined( level.default_r_exposureValue ) )
		level.default_r_exposureValue = getDvar( "r_exposureValue" );
	if( !isDefined( level.default_r_lightTweakSunLight ) )
		level.default_r_lightTweakSunLight = getDvar( "r_lightTweakSunLight" );
	if( !isDefined( level.default_r_sky_intensity_factor0 ) )
		level.default_r_sky_intensity_factor0 = getDvar( "r_sky_intensity_factor0" );

	self setclientdvar( "r_filmUseTweaks", 1 );
	self setclientdvar( "r_bloomTweaks", 1 );
	self setclientdvar( "r_exposureTweak", 1 );
	self setclientdvar( "vc_rgbh", "0.1 0 0.3 0" );
	self setclientdvar( "vc_yl", "0 0 0.25 0" );
	self setclientdvar( "vc_yh", "0.02 0 0.1 0" );
	self setclientdvar( "vc_rgbl", "0.02 0 0.1 0" );
	self setclientdvar( "r_exposureValue", 3.9 );
	self setclientdvar( "r_lightTweakSunLight", 1 );
	self setclientdvar( "r_sky_intensity_factor0", 0 );

	if( level.script == "zm_buried" )
	{
		self setclientdvar( "r_exposureValue", 3.5 );
	}
	else if( level.script == "zm_tomb" )
	{
		self setclientdvar( "r_exposureValue", 4 );
	}
	else if( level.script == "zm_nuked" )
	{
		self setclientdvar( "r_exposureValue", 5.6 );
	}
	else if( level.script == "zm_highrise" )
	{
		self setclientdvar( "r_exposureValue", 3.9 );
	}
}