updated with dvar support and misc fixes

This commit is contained in:
JezuzLizard 2020-03-21 17:33:19 -07:00
parent 5eb84dd9eb
commit 10e514206e
3 changed files with 176 additions and 89 deletions

View File

@ -8,6 +8,16 @@
* *
*/ */
/*
* Black Ops 2 - GSC Studio by iMCSx
*
* Creator : JezuzLizard
* Project : grieffix2
* Mode : Zombies
* Date : 2020/01/31 - 03:36:03
*
*/
#include maps\mp\_utility; #include maps\mp\_utility;
#include common_scripts\utility; #include common_scripts\utility;
#include maps\mp\gametypes_zm\_hud_util; #include maps\mp\gametypes_zm\_hud_util;
@ -17,10 +27,8 @@
#include maps\mp\zombies\_zm_perks; #include maps\mp\zombies\_zm_perks;
#include maps\mp\zm_alcatraz_grief_cellblock; #include maps\mp\zm_alcatraz_grief_cellblock;
#include maps\mp\zm_prison; #include maps\mp\zm_prison;
#include maps\mp\zm_highrise;
#include maps\mp\zm_transit; #include maps\mp\zm_transit;
#include maps\mp\zm_buried; #include maps\mp\zm_buried;
#include maps\mp\zm_tomb;
init() init()
{ {
@ -37,48 +45,50 @@ init()
gameSettings() gameSettings()
{ {
//random game settings options set these to 0 to disable them happening //random game settings options set these to 0 to disable them happening
level.random_game_settings = true; //disable this to diable all random settings effects level.random_game_settings = getDvarIntDefault( "randomGameSettings", "1" ); //disable this to disable all random settings effects
level.hyper_speed_spawns_chance_active = true; //this enables a chance that zombies will have max move speed, max spawnrate, no walkers, and 1 second between rounds
level.extra_drops_chance_active = true; //this enables a chance that drops will drop upto 4x as much per round level.hyper_speed_spawns_chance_active = getDvarIntDefault( "hyperSpeedSpawnsChanceActive", "1" ); //this enables a chance that zombies will have max move speed, max spawnrate, no walkers, and 1 second between rounds
level.max_zombies_chance_active = true; //this enables a chance to increase max ai at once to 32 level.extra_drops_chance_active = getDvarIntDefault( "extraDropsChanceActive", "1" ); //this enables a chance that drops will drop upto 4x as much per round
level.reduced_zombies_per_round_chance_active = true; //enable this for a chance to get to higher rounds quicker level.max_zombies_chance_active = getDvarIntDefault( "maxHordeSizeIncreaseChanceActive", "1" ); //this enables a chance to increase max ai at once to 32
level.deflation_chance_active = true; //this enables a chance that the zombies only give points when killed level.reduced_zombies_per_round_chance_active = getDvarIntDefault( "shorterRoundsChanceActive", "1" ); //enable this for a chance to get to higher rounds quicker
level.deadlier_emps_chance_active = true; //this enables a chance to make emp duration 4x as long level.deflation_chance_active = getDvarIntDefault( "deflationChanceActive", "1" ); //this enables a chance that the zombies only give points when killed
level.disable_revive_chance_active = true; //this enables a chance to disable revive from appearing in games level.deadlier_emps_chance_active = getDvarIntDefault( "deadlierEMPsChanceActive", "1" ); //this enables a chance to make emp duration 4x as long
level.disable_jugg_chance_active = true; //this enables a chance to disable jugg from appearing in games level.disable_revive_chance_active = getDvarIntDefault( "disableReviveChanceActive", "1" ); //this enables a chance to disable revive from appearing in games
level.electric_doors_enabled_chance_active = true; //this enables a chance that the electric doors on transit maps will be disabled level.disable_jugg_chance_active = getDvarIntDefault( "disableJuggChanceActive", "1" ); //this enables a chance to disable jugg from appearing in games
level.first_room_doors_enabled_chance_active = true; //this enables a chance that the first room doors on all grief maps will be disabled level.electric_doors_enabled_chance_active = getDvarIntDefault( "electricDoorsDisabledChanceActive", "1" ); //this enables a chance that the electric doors on transit maps will be disabled
level.disable_box_moving_chance_active = true; //this enables a chance that the box won't move after too many uses level.first_room_doors_enabled_chance_active = getDvarIntDefault( "firstRoomOnlyChanceActive", "1" ); //this enables a chance that the first room doors on all grief maps will be disabled
level.disable_box_moving_chance_active = getDvarIntDefault( "disableBoxMoveChanceActive", "1" ); //this enables a chance that the box won't move after too many uses
//chances of something happening setting to 100 makes it always on //chances of something happening setting to 100 makes it always on
level.hyper_speed_spawns_chance = 30; //30% default level.hyper_speed_spawns_chance = getDvarIntDefault( "hyperSpeedSpawnsChance", "50" ); //50% default
level.extra_drops_chance = 15; //15% default level.extra_drops_chance = getDvarIntDefault( "extraDropsChance", "15" ); //15% default
level.max_zombies_chance = 50; //50 default level.max_zombies_chance = getDvarIntDefault( "maxHordeSizeIncreaseChanceActive", "50" ); //50% default
level.reduced_zombies_per_round_chance = 20; //20% default level.reduced_zombies_per_round_chance = getDvarIntDefault( "shorterRoundsChanceActive", "20" ); //20% default
level.deflation_chance = 20; //20% default level.deflation_chance = getDvarIntDefault( "deflationChance", "20" ); //20% default
level.deadlier_emps_chance = 40; //40% default level.deadlier_emps_chance = getDvarIntDefault( "deadlierEMPsChance", "40" ); //40% default
level.disable_revive_chance = 50; //50% default level.disable_revive_chance = getDvarIntDefault( "disableReviveChance", "50" ); //50% default
level.disable_jugg_chance = 30; //30% default level.disable_jugg_chance = getDvarIntDefault( "disableJuggChance", "30" ); //30% default
level.first_room_doors_enabled_chance = 20; //20% default level.first_room_doors_enabled_chance = getDvarIntDefault( "electricDoorsDisabledChance", "20" ); //20% default
level.electric_doors_enabled_chance = 40; //40% default level.electric_doors_enabled_chance = getDvarIntDefault( "firstRoomOnlyChance", "40" ); //40% default
level.disable_box_moving_chance = 10; //10% default level.disable_box_moving_chance = getDvarIntDefault( "disableBoxMoveChance", "10" ); //10% default
//map rotate feature overrides the normal restart if active //map rotate feature overrides the normal restart if active
level.map_rotate = true; level.map_rotate = getDvarIntDefault( "townFarmBusdepotRotation", "1" );
return level.random_game_settings; return level.random_game_settings;
} }
gameDelayFunctionsAndVars() gameDelayFunctionsAndVars()
{ {
//game delay functions options //game delay functions options
level.wait_time = 30; //change this to adjust the start time once the player quota is met level.wait_time = getDvarIntDefault( "waitTime", "30" ); //change this to adjust the start time once the player quota is met
level.player_quota_active = 1; //set this to 0 to disable player quotas recommended to be 1 for grief level.player_quota_active = getDvarIntDefault( "playerQuotaActive", "1" ); //set this to 0 to disable player quotas recommended to be 1 for grief
level.player_quota = 2; //number of players required before the game starts level.player_quota = getDvarIntDefault( "playerQuota", "2" ); //number of players required before the game starts
level.waiting = 0; //don't change this level.waiting = 0; //don't change this
level.countdown_start = 0; //don't change this level.countdown_start = 0; //don't change this
level.round_prestart_func =::round_prestart_func; //delays the rounds from starting level.round_prestart_func =::round_prestart_func; //delays the rounds from starting
SetDvar( "scr_zm_enable_bots", "1" ); //this is required for the mod to work SetDvar( "scr_zm_enable_bots", "1" ); //this is required for the mod to work
thread flag_clearer();
thread add_bots(); //this overrides the typical start time logic thread add_bots(); //this overrides the typical start time logic
} }
@ -90,11 +100,13 @@ griefFunctionsAndVars()
} }
level.default_solo_laststandpistol = "m1911_zm"; //prevents players from having the solo pistol when downed in grief level.default_solo_laststandpistol = "m1911_zm"; //prevents players from having the solo pistol when downed in grief
for(;;) for(;;)
{ {
level waittill("connected", player); level waittill("connected", player);
player thread teamBalancing(); level.playerTeamNameTag = player getTeamNameTag();
player thread give_team_characters(); player teamPicking();
} player teamBalancing();
player give_team_characters();
}
} }
round_prestart_func() round_prestart_func()
@ -108,43 +120,95 @@ round_prestart_func()
wait level.wait_time; wait level.wait_time;
} }
getTeamNameTag()
{
name = self.name;
return name[0] + name[1] + name[2];
}
teamPicking()
{
teamplayersallies = countplayers( "allies");
teamplayersaxis = countplayers( "axis");
if ( level.playerTeamNameTag == "cdc" && teamplayersallies < 4 && !level.isresetting_grief )
{
self.team = "allies";
self.sessionteam = "allies";
self [[level.allies]]();
self.pers["team"] = "allies";
self._encounters_team = "B";
return true;
}
else if ( level.playerTeamNameTag == "cia" && teamplayersaxis < 4 && !level.isresetting_grief )
{
self.team = "axis";
self.sessionteam = "axis";
self [[level.axis]]();
self.pers["team"] = "axis";
self._encounters_team = "A";
return true;
}
else
{
return false;
}
}
teamBalancing() teamBalancing()
{ {
teamplayersallies = countplayers( "allies"); teamChosen = teamPicking();
teamplayersaxis = countplayers( "axis"); if ( teamChosen )
if (teamplayersallies > teamplayersaxis && !level.isresetting_grief) {
return;
}
teamplayersallies = countplayers( "allies");
teamplayersaxis = countplayers( "axis");
if (teamplayersallies > teamplayersaxis && !level.isresetting_grief)
{
self.team = "axis";
self.sessionteam = "axis";
self [[level.axis]]();
self.pers["team"] = "axis";
self._encounters_team = "A";
}
else if (teamplayersallies < teamplayersaxis && !level.isresetting_grief)
{
self.team = "allies";
self.sessionteam = "allies";
self [[level.allies]]();
self.pers["team"] = "allies";
self._encounters_team = "B";
}
else if (teamplayersallies == teamplayersaxis && !level.isresetting_grief)
{
self.team = "allies";
self.sessionteam = "allies";
self [[level.allies]]();
self.pers["team"] = "allies";
self._encounters_team = "B";
}
}
flag_clearer()
{
//hopefully keep the game from starting prematurely on map_restart
while ( 1 )
{
flag_clear( "solo_game" );
flag_clear( "start_zombie_round_logic" );
wait 0.1;
if ( !level.waiting )
{ {
self.team = "axis"; break;
self.sessionteam = "axis";
self [[level.axis]]();
self.pers["team"] = "axis";
self._encounters_team = "A";
}
else if (teamplayersallies < teamplayersaxis && !level.isresetting_grief)
{
self.team = "allies";
self.sessionteam = "allies";
self [[level.allies]]();
self.pers["team"] = "allies";
self._encounters_team = "B";
}
else if (teamplayersallies == teamplayersaxis && !level.isresetting_grief)
{
self.team = "allies";
self.sessionteam = "allies";
self [[level.allies]]();
self.pers["team"] = "allies";
self._encounters_team = "B";
} }
}
} }
add_bots() add_bots()
{ {
flag_clear( "solo_game" ); players = get_players();
flag_clear( "start_zombie_round_logic" );
players = get_players();
level.waiting = 1; level.waiting = 1;
thread waitMessage(); thread waitMessage();
while ( players.size < level.player_quota && level.player_quota_active || players.size < 1) while ( players.size < level.player_quota && level.player_quota_active || players.size < 1)
{ {
wait 0.5; wait 0.5;
@ -154,7 +218,7 @@ add_bots()
level.countdown_start = 1; level.countdown_start = 1;
thread countdownTimer(); thread countdownTimer();
wait level.wait_time; wait level.wait_time;
flag_set( "start_zombie_round_logic" ); flag_set( "start_zombie_round_logic" );
} }
waitMessage() waitMessage()
@ -345,7 +409,7 @@ emptyLobbyRestart()
gscMapChange() gscMapChange()
{ {
if ( !level.map_rotate || !level.script == "zm_transit" ) if ( !level.map_rotate || level.script != "zm_transit" )
{ {
return; return;
} }
@ -386,10 +450,12 @@ mapChange( startlocation )
randomizedSettings() randomizedSettings()
{ {
//level.random_game_settings = 0;
if ( !gameSettings() ) if ( !gameSettings() )
{ {
return; return 0;
} }
if ( ( randomint( 100 ) <= level.first_room_doors_enabled_chance ) && level.first_room_doors_enabled_chance_active ) if ( ( randomint( 100 ) <= level.first_room_doors_enabled_chance ) && level.first_room_doors_enabled_chance_active )
{ {
level.first_room_doors_enabled = 0; level.first_room_doors_enabled = 0;
@ -471,7 +537,6 @@ walkersDisabledAndAllRunners()
setPlayersToSpectator() setPlayersToSpectator()
{ {
level.no_end_game_check = 1; level.no_end_game_check = 1;
level.zombie_vars["penalty_no_revive"] = 0;
wait 3; wait 3;
players = get_players(); players = get_players();
i = 0; i = 0;
@ -499,7 +564,6 @@ kill()
spawnAllPlayers() spawnAllPlayers()
{ {
level.zombie_vars["penalty_no_revive"] = 0.1;
players = get_players(); players = get_players();
i = 0; i = 0;
while ( i < players.size ) while ( i < players.size )
@ -508,28 +572,7 @@ spawnAllPlayers()
{ {
players[ i ] [[ level.spawnplayer ]](); players[ i ] [[ level.spawnplayer ]]();
thread refresh_player_navcard_hud(); thread refresh_player_navcard_hud();
players[ i ].score = 500;
players[ i ].downs = 0; //set player downs to 0 since they didn't actually die during gameplay
} }
i++; i++;
} }
} }

View File

@ -12,6 +12,8 @@ Added map change option (only for farm, town, and bus depot)
Added empty lobby restart Added empty lobby restart
Added dvar support
## Team Balancing: ## Team Balancing:
Picks a team for a player on join based on how many players are on each team Picks a team for a player on join based on how many players are on each team
@ -79,4 +81,11 @@ Reverted to killing players on Grief only
InitialMapRestart() replaced with give_team_characters InitialMapRestart() replaced with give_team_characters
Made the script map agnostic allowing it to be loaded on non-grief maps and 3/21/20
//Made the script map agnostic allowing it to be loaded on non-grief maps and
Map agnostic is too cumbersome to support don't load this mod on anything other than grief mode
Added dvar support allowing server hosters to change the vars from the config
Fixed a check involving mapMapChange()

View File

@ -0,0 +1,35 @@
//add this to the gts settings
gts teamCount "2"
//put these in your server config
//disable or enable settings
set randomGameSettings "1"
set hyperSpeedSpawnsChanceActive "1"
set extraDropsChanceActive "1"
set maxHordeSizeIncreaseChanceActive "1"
set shorterRoundsChanceActive "1"
set deflationChanceActive "1"
set deadlierEMPsChanceActive "1"
set disableReviveChanceActive "1"
set disableJuggChanceActive "1"
set electricDoorsDisabledChanceActive "1"
set firstRoomOnlyChanceActive "1"
set disableBoxMoveChanceActive "1"
//change settings chances of happening each time the server restarts
set hyperSpeedSpawnsChance "50"
set extraDropsChance "15"
set maxHordeSizeIncreaseChanceActive "50"
set shorterRoundsChanceActive "20"
set deflationChance "20"
set deadlierEMPsChance "40"
set disableReviveChance "50"
set disableJuggChance "30"
set electricDoorsDisabledChance "20"
set firstRoomOnlyChance "40"
set disableBoxMoveChance "10"
//game delay settings
set waitTime "30"
set playerQuotaActive "1"
set playerQuota "2"