Added instructions, split grieffix into enhanced and basic versions

Also implemented better countdown hud from sparker.
This commit is contained in:
JezuzLizard 2020-09-16 11:36:26 -07:00
parent fd78f09d98
commit feeee14740
6 changed files with 371 additions and 101 deletions

View File

@ -1,24 +0,0 @@
Remaining = create_simple_hud();
Remaining.horzAlign = "center";
Remaining.vertAlign = "middle";
Remaining.alignX = "center";
Remaining.alignY = "middle";
Remaining.y = 20;
Remaining.x = 0;
Remaining.foreground = 1;
Remaining.fontscale = 2.0;
Remaining.alpha = 1;
Remaining.color = ( 0.98, 0.549, 0 );
Countdown = create_simple_hud();
Countdown.horzAlign = "center";
Countdown.vertAlign = "middle";
Countdown.alignX = "center";
Countdown.alignY = "middle";
Countdown.y = -20;
Countdown.x = 0;
Countdown.foreground = 1;
Countdown.fontscale = 2.0;
Countdown.alpha = 1;
Countdown.color = ( 1.000, 1.000, 1.000 );
Countdown SetText( "Match begins in" );

View File

@ -0,0 +1,320 @@
#include maps\mp\_utility;
#include common_scripts\utility;
#include maps\mp\zombies\_zm_utility;
#include maps\mp\gametypes_zm\_hud_util;
#include maps\mp\gametypes_zm\_hud_message;
#include maps\mp\zombies\_zm;
#include maps\mp\zombies\_zm_perks;
init()
{
thread griefFunctionsAndVars();
gameDelayFunctionsAndVars()
thread setPlayersToSpectator();
thread gscRestart();
thread emptyLobbyRestart();
thread gscMapChange();
}
gameDelayFunctionsAndVars()
{
//game delay functions options
level.wait_time = getDvarIntDefault( "waitTime", 30 ); //change this to adjust the start time once the player quota is met
level.player_quota_active = getDvarIntDefault( "playerQuotaActive", 1 ); //set this to 0 to disable player quotas recommended to be 1 for grief
level.player_quota = getDvarIntDefault( "playerQuota", 2 ); //number of players required before the game starts
level.waiting = 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
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
}
griefFunctionsAndVars()
{
if ( level.scr_zm_ui_gametype_group != "zencounter" )
{
return;
}
level.default_solo_laststandpistol = "m1911_zm"; //prevents players from having the solo pistol when downed in grief
for(;;)
{
level waittill("connected", player);
player teamBalancing();
player [[ level.givecustomcharacters ]]();
}
}
round_prestart_func()
{
players = get_players();
while ( players.size < level.player_quota && level.player_quota_active == 1 || players.size < 1)
{
wait 0.5;
players = get_players();
}
wait level.wait_time;
}
teamBalancing()
{
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 )
{
break;
}
}
}
add_bots()
{
players = get_players();
level.waiting = 1;
thread waitMessage();
while ( players.size < level.player_quota && level.player_quota_active || players.size < 1)
{
wait 0.5;
players = get_players();
}
level.waiting = 0;
level.countdown_start = 1;
thread countdownTimer();
wait level.wait_time;
flag_set( "start_zombie_round_logic" );
}
waitMessage()
{
level endon("game_ended");
self endon("disconnect");
if( level.waiting == 0 )
{
return;
}
Waiting = create_simple_hud();
Waiting.horzAlign = "center"; //valid inputs: center, top, bottom, left, right, top_right, top_left, topcenter, bottom_right, bottom_left
Waiting.vertAlign = "middle";
Waiting.alignX = "center";
Waiting.alignY = "middle";
Waiting.y = 0; //- is top 0 is middle + is bottom
Waiting.x = -1;
Waiting.foreground = 1;
Waiting.fontscale = 3.0;
Waiting.alpha = 1; //transparency
Waiting.color = ( 1.000, 1.000, 1.000 ); //RGB
Waiting SetText( "Waiting for 1 more player" );
while ( 1 )
{
if ( level.waiting == 0 )
{
Waiting destroy();
break;
}
wait 1;
}
}
countdownTimer()
{
level endon("game_ended");
self endon("disconnect");
if ( level.countdown_start == 0 )
{
return;
}
Remaining = create_simple_hud();
Remaining.horzAlign = "center";
Remaining.vertAlign = "middle";
Remaining.alignX = "center";
Remaining.alignY = "middle";
Remaining.y = 20;
Remaining.x = 0;
Remaining.foreground = 1;
Remaining.fontscale = 2.0;
Remaining.alpha = 1;
Remaining.color = ( 0.98, 0.549, 0 );
Countdown = create_simple_hud();
Countdown.horzAlign = "center";
Countdown.vertAlign = "middle";
Countdown.alignX = "center";
Countdown.alignY = "middle";
Countdown.y = -20;
Countdown.x = 0;
Countdown.foreground = 1;
Countdown.fontscale = 2.0;
Countdown.alpha = 1;
Countdown.color = ( 1.000, 1.000, 1.000 );
Countdown SetText( "Match begins in" );
timer = level.wait_time;
while ( level.countdown_start == 1 )
{
Remaining SetValue( timer );
wait 1;
timer--;
if ( timer <= 0 )
{
Countdown destroy();
Remaining destroy();
break;
}
}
}
gscRestart()
{
if ( level.map_rotate && level.script == "zm_transit" )
{
return;
}
level waittill( "end_game" );
wait 12;
map_restart( false );
}
//grief games don't end if no players remain in the server so this will force a restart to reset the map
emptyLobbyRestart()
{
while ( 1 )
{
players = get_players();
if (players.size > 0 )
{
while ( 1 )
{
players = get_players();
if ( players.size < 1 )
{
map_restart( false );
}
wait 1;
}
}
wait 1;
}
}
gscMapChange()
{
if ( !level.map_rotate || level.script != "zm_transit" )
{
return;
}
level waittill( "end_game" );
wait 20;
mapChange( location() );
map_restart( false );
}
location()
{
//move the order of the if statements to change the order of the rotation
if ( getDvarIntDefault( "farm", 1 ) )
{
setDvar( "farm", 0 );
return "farm";
}
if ( getDvarIntDefault( "town", 1 ) )
{
setDvar( "town", 0 );
return "town";
}
if ( getDvarIntDefault( "transit", 1 ) )
{
setDvar( "transit", 0 );
return "transit";
}
setDvar( "farm", 1 );
setDvar( "transit", 1 );
setDvar( "town", 1 );
}
mapChange( startlocation )
{
setDvar( "ui_zm_mapstartlocation", startlocation );
makedvarserverinfo( "ui_zm_mapstartlocation", startlocation );
}
setPlayersToSpectator()
{
level.no_end_game_check = 1;
wait 3;
players = get_players();
i = 0;
while ( i < players.size )
{
if ( i == 0 )
{
i++;
}
players[ i ] kill();
i++;
}
wait 10;
spawnAllPlayers();
}
kill()
{
self.maxhealth = 100;
self.health = self.maxhealth;
self disableInvulnerability();
self dodamage( self.health * 2, self.origin );
self.bleedout_time = 0;
}
spawnAllPlayers()
{
players = get_players();
i = 0;
while ( i < players.size )
{
if ( players[ i ].sessionstate == "spectator" && isDefined( players[ i ].spectator_respawn ) )
{
players[ i ] [[ level.spawnplayer ]]();
thread refresh_player_navcard_hud();
}
i++;
}
}

View File

@ -79,8 +79,6 @@ griefFunctionsAndVars()
for(;;) for(;;)
{ {
level waittill("connected", player); level waittill("connected", player);
level.playerTeamNameTag = player getTeamNameTag();
player teamPicking();
player teamBalancing(); player teamBalancing();
player [[ level.givecustomcharacters ]](); player [[ level.givecustomcharacters ]]();
} }
@ -97,47 +95,8 @@ 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()
{ {
teamChosen = teamPicking();
if ( teamChosen )
{
return;
}
teamplayersallies = countplayers( "allies"); teamplayersallies = countplayers( "allies");
teamplayersaxis = countplayers( "axis"); teamplayersaxis = countplayers( "axis");
if (teamplayersallies > teamplayersaxis && !level.isresetting_grief) if (teamplayersallies > teamplayersaxis && !level.isresetting_grief)
@ -243,27 +202,27 @@ countdownTimer()
Remaining = create_simple_hud(); Remaining = create_simple_hud();
Remaining.horzAlign = "center"; Remaining.horzAlign = "center";
Remaining.vertAlign = "middle"; Remaining.vertAlign = "middle";
Remaining.alignX = "Left"; Remaining.alignX = "center";
Remaining.alignY = "middle"; Remaining.alignY = "middle";
Remaining.y = 0; Remaining.y = 20;
Remaining.x = 135; Remaining.x = 0;
Remaining.foreground = 1; Remaining.foreground = 1;
Remaining.fontscale = 3.0; Remaining.fontscale = 2.0;
Remaining.alpha = 1; Remaining.alpha = 1;
Remaining.color = ( 1.000, 1.000, 1.000 ); Remaining.color = ( 0.98, 0.549, 0 );
Countdown = create_simple_hud(); Countdown = create_simple_hud();
Countdown.horzAlign = "center"; Countdown.horzAlign = "center";
Countdown.vertAlign = "middle"; Countdown.vertAlign = "middle";
Countdown.alignX = "center"; Countdown.alignX = "center";
Countdown.alignY = "middle"; Countdown.alignY = "middle";
Countdown.y = 0; Countdown.y = -20;
Countdown.x = -1; Countdown.x = 0;
Countdown.foreground = 1; Countdown.foreground = 1;
Countdown.fontscale = 3.0; Countdown.fontscale = 2.0;
Countdown.alpha = 1; Countdown.alpha = 1;
Countdown.color = ( 1.000, 1.000, 1.000 ); Countdown.color = ( 1.000, 1.000, 1.000 );
Countdown SetText( "Time until game starts:" ); Countdown SetText( "Match begins in" );
timer = level.wait_time; timer = level.wait_time;
while ( level.countdown_start == 1 ) while ( level.countdown_start == 1 )
@ -283,28 +242,18 @@ countdownTimer()
deleteBuyableDoors() deleteBuyableDoors()
{ {
doors_trigs = getentarray( "zombie_door", "targetname" ); doors_trigs = getentarray( "zombie_door", "targetname" );
_a41 = doors_trigs; foreach ( door in doors_trigs )
_k41 = getFirstArrayKey( _a41 );
while ( isDefined( _k41 ) )
{
door = _a41[ _k41 ];
//deletes the depot main door trigger
door self_delete(); door self_delete();
_k41 = getNextArrayKey( _a41, _k41 );
} }
} }
deleteBuyableDebris() deleteBuyableDebris()
{ {
debris_trigs = getentarray( "zombie_debris", "targetname" ); debris_trigs = getentarray( "zombie_debris", "targetname" );
_a41 = debris_trigs; foreach ( debris in debris_trigs )
_k41 = getFirstArrayKey( _a41 ); {
while ( isDefined( _k41 ) )
{
debris = _a41[ _k41 ];
//deletes the depot main door trigger //deletes the depot main door trigger
debris self_delete(); debris self_delete();
_k41 = getNextArrayKey( _a41, _k41 );
} }
} }
@ -315,7 +264,7 @@ gscRestart()
return; return;
} }
level waittill( "end_game" ); level waittill( "end_game" );
wait 20; wait 12;
map_restart( false ); map_restart( false );
} }

28
GriefFix/instructions.md Normal file
View File

@ -0,0 +1,28 @@
# Instructions
## Installing the correct version
If you want to host a public grief server you need to include this fix otherwise teams don't balance.
I've decided to offer up two versions of the grieffix mod so if you don't want to use the version with bonus settings you can use the basic version.
### Installing the basic fix
Compile grief_fix_basic.gsc as _clientids.gsc and place it in maps/mp/gametypes_zm
### Installing the enhanced version
Compile grief_fix_enhanced.gsc as _clientids.gsc and place it maps/mp/gametypes_zm
### Loading up Grief
Make sure you have the dedicated_zm.cfg and the grief.cfg in gamesettings added from here:
https://github.com/xerxes-at/T6ServerConfigs
Next make an sv_maprotation in the dedicated_zm.cfg with only 1 map loading up the grief map of your choice.
It should look like this
```
sv_maprotation "exec zgrief.cfg gametype zgrief loc town map zm_transit"
map_rotate
```
Double check if you have another sv_maprotation set already since that can cause errors.
Feel free to modify the zgrief.cfg to change a few settings like start round or magic

View File

@ -75,9 +75,6 @@ Town, Farm and Bus Depot //requires one of these maps to be loaded initially and
## Requirements ## Requirements
Grief requires gts teamCount "2" to work properly in the server config turn it off when loading non-grief maps Grief requires gts teamCount "2" to work properly in the server config turn it off when loading non-grief maps
## Better countdown hud
An addon for grief regarding countdown ui, to enable this copy the lines from better-countdown-hud.gsc and replace lines 243 - 246 on main.gsc
### Changelog ### Changelog
//Players are set to spectator state directly instead of being killed //Players are set to spectator state directly instead of being killed
Reverted to killing players on Grief only Reverted to killing players on Grief only
@ -94,3 +91,5 @@ Fixed a check involving mapMapChange()
4/4/20 4/4/20
Fixed getDvarIntDefault() not properly defining the default dvars Fixed getDvarIntDefault() not properly defining the default dvars
9/16/20
GrieffFix separated into 2 versions and instructions.md added

View File

@ -1,7 +1,13 @@
``` ```
//add this to the gts settings //These settings apply to both versions
gts teamCount "2" //game delay settings
set waitTime "30"
set playerQuotaActive "1"
set playerQuota "2"
//this controls the simple map rotation between town, farm and bus depot
set mapRotate "1"
//grieff fix enhanced only
//put these in your server config //put these in your server config
//disable or enable settings //disable or enable settings
set randomGameSettings "1" set randomGameSettings "1"
@ -17,9 +23,6 @@ set electricDoorsDisabledChanceActive "1"
set firstRoomOnlyChanceActive "1" set firstRoomOnlyChanceActive "1"
set disableBoxMoveChanceActive "1" set disableBoxMoveChanceActive "1"
//this controls the simple map rotation between town, farm and bus depot
set mapRotate "1"
//change settings chances of happening each time the server restarts //change settings chances of happening each time the server restarts
set hyperSpeedSpawnsChance "50" set hyperSpeedSpawnsChance "50"
set extraDropsChance "15" set extraDropsChance "15"
@ -32,9 +35,4 @@ set disableJuggChance "30"
set electricDoorsDisabledChance "20" set electricDoorsDisabledChance "20"
set firstRoomOnlyChance "40" set firstRoomOnlyChance "40"
set disableBoxMoveChance "10" set disableBoxMoveChance "10"
//game delay settings
set waitTime "30"
set playerQuotaActive "1"
set playerQuota "2"
``` ```