UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Round Restarting Tutorial

broken avatar :(
Created 11 years ago
by jbird
0 Members and 1 Guest are viewing this topic.
3,396 views
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 13 May 2014
Last active: 2 days ago
Posts
167
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
×
jbird's Groups
Want the round to restart when everyone dies instead of the game ending? Well here ya go!
Go into _zombiemode.gsc and search for "self.intermission = true;"
Change it to
Code Snippet
Plaintext
self.intermission = false;
Then look for "if( count == players.size )"
Replace that function with this:
Code Snippet
Plaintext
	if( count == players.size )
{
//level notify( "end_game" );

self maps\_laststand::laststand_take_player_weapons();

zombs = getaiarray("axis");
for(i=0;i<zombs.size;i++)
{
zombs[i] delete(); //removes all currently spawned in zombies
}

maps\_zombiemode_powerups::powerup_round_start(); //restarts the amount of powerups you can earn this round
array_thread( players, maps\_zombiemode_blockers_new::rebuild_barrier_reward_reset ); //restarts your barrier points this round
level thread [[level.round_spawn_func]](); //makes the amount of zombies restart to its original amount for the round

players = get_players();
for( i = 0; i < players.size; i++ ) //respawns you back in and gives you your weapons back
{
players[i] spectator_respawn();
players[i] [[level.spawnPlayer]]();
while(1)
{
if(players[i] hasWeapon("zombie_colt"))
{
players[i] takeAllWeapons();
players[i] maps\_laststand::laststand_giveback_player_weapons();
if( isDefined( players[i].has_altmelee ) && players[i].has_altmelee )
{
players[i] SetPerk( "specialty_altmelee" );
}
level thread award_grenades_for_survivors(); //get 2 extra grenades when you spawn back in, optional
break;
}
wait(0.05);
}
}
iprintlnbold("You have been given another chance"); //message letting you know the round restarted, optional
}

Add this function at the bottom
Code Snippet
Plaintext
round_restart()
{
level endon( "intermission" );
/#
level endon( "kill_round" );
#/

if( level.intermission )
{
return;
}

if( level.enemy_spawns.size < 1 )
{
ASSERTMSG( "No spawners with targetname zombie_spawner in map." );
return;
}

/#
if ( GetDVarInt( "zombie_cheat" ) == 2 || GetDVarInt( "zombie_cheat" ) >= 4 )
{
return;
}
#/

level.zombie_total = 0;

count = 0;

//CODER MOD: TOMMY K
players = get_players();
for( i = 0; i < players.size; i++ )
{
players[i].zombification_time = 0;
}

max = level.zombie_vars["zombie_max_ai"];

multiplier = level.round_number / 5;
if( multiplier < 1 )
{
multiplier = 1;
}

// After round 10, exponentially have more AI attack the player
if( level.round_number >= 10 )
{
multiplier *= level.round_number * 0.15;
}

player_num = get_players().size;

if( player_num == 1 )
{
max += int( ( 0.5 * level.zombie_vars["zombie_ai_per_player"] ) * multiplier );
}
else
{
max += int( ( ( player_num - 1 ) * level.zombie_vars["zombie_ai_per_player"] ) * multiplier );
}



if(level.round_number < 3 && level.script == "nazi_zombie_asylum")
{
if(get_players().size > 1)
{

max = get_players().size * 3 + level.round_number;

}
else
{

max = 6;

}
}
else if ( level.first_round )
{
max = int( max * 0.2 );
}
else if (level.round_number < 3)
{
max = int( max * 0.4 );
}
else if (level.round_number < 4)
{
max = int( max * 0.6 );
}
else if (level.round_number < 5)
{
max = int( max * 0.8 );
}


level.zombie_total = max;
iprintln(level.zombie_total);
mixed_spawns = 0; // Number of mixed spawns this round.  Currently means number of dogs in a mixed round

// DEBUG HACK:
//max = 1;
old_spawn = undefined;
while( count < max )
{

spawn_point = level.enemy_spawns[RandomInt( level.enemy_spawns.size )];

if( !IsDefined( old_spawn ) )
{
old_spawn = spawn_point;
}
else if( Spawn_point == old_spawn )
{
spawn_point = level.enemy_spawns[RandomInt( level.enemy_spawns.size )];
}
old_spawn = spawn_point;

// iPrintLn(spawn_point.targetname + " " + level.zombie_vars["zombie_spawn_delay"]);
while( get_enemy_count() > 31 )
{
wait( 0.05 );
}

// MM Mix in dog spawns...
if ( IsDefined( level.mixed_rounds_enabled ) && level.mixed_rounds_enabled == 1 )
{
spawn_dog = false;
if ( level.round_number > 30 )
{
if ( RandomInt(100) < 3 )
{
spawn_dog = true;
}
}
else if ( level.round_number > 25 && mixed_spawns < 3 )
{
if ( RandomInt(100) < 2 )
{
spawn_dog = true;
}
}
else if ( level.round_number > 20 && mixed_spawns < 2 )
{
if ( RandomInt(100) < 2 )
{
spawn_dog = true;
}
}
else if ( level.round_number > 15 && mixed_spawns < 1 )
{
if ( RandomInt(100) < 1 )
{
spawn_dog = true;
}
}

if ( spawn_dog )
{
keys = GetArrayKeys( level.zones );
for ( i=0; i<keys.size; i++ )
{
if ( level.zones[ keys[i] ].is_occupied )
{
akeys = GetArrayKeys( level.zones[ keys[i] ].adjacent_zones );
for ( k=0; k<akeys.size; k++ )
{
if ( level.zones[ akeys[k] ].is_active &&
!level.zones[ akeys[k] ].is_occupied &&
level.zones[ akeys[k] ].dog_locations.size > 0 )
{
maps\_zombiemode_dogs::special_dog_spawn( undefined, 1 );
level.zombie_total--;
wait_network_frame();
}
}
}
}
}
}

ai = spawn_zombie( spawn_point );
if( IsDefined( ai ) )
{
level.zombie_total--;
ai thread round_spawn_failsafe();
count++;
}
wait( level.zombie_vars["zombie_spawn_delay"] );
wait_network_frame();
}

if( level.round_number > 3 )
{
zombies = getaiarray( "axis" );
while( zombies.size > 0 )
{
if( zombies.size == 1 && zombies[0].has_legs == true )
{
var = randomintrange(1, 4);
zombies[0] set_run_anim( "sprint" + var );                       
zombies[0].run_combatanim = level.scr_anim[zombies[0].animname]["sprint" + var];
}
wait(0.5);
zombies = getaiarray("axis");
}

}

}
Last Edit: July 06, 2015, 04:25:35 am by jbird
broken avatar :(
×
broken avatar :(
Location: gbNewport
Date Registered: 2 November 2014
Last active: 4 years ago
Posts
1,265
Respect
Forum Rank
Zombie Colossus
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Embrace the Darkness
×
Tim Smith's Groups
Tim Smith's Contact & Social LinksTimSmithtimsmith90THEREALBaDBoY17My clan Website
thx , will find a use of that :)
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 1 January 2014
Last active: 5 years ago
Posts
397
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Signature
×
vinnyz500's Groups
vinnyz500's Contact & Social LinksXxMrPotatoxXpsn_hackedlobbies4uvinnyz500
buried time bomb mabey?  ::) (or a shit variation that will just restart the round :troll:)
broken avatar :(
×
broken avatar :(
Location: gbNewport
Date Registered: 2 November 2014
Last active: 4 years ago
Posts
1,265
Respect
Forum Rank
Zombie Colossus
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Embrace the Darkness
×
Tim Smith's Groups
Tim Smith's Contact & Social LinksTimSmithtimsmith90THEREALBaDBoY17My clan Website
:lol:
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 13 May 2014
Last active: 2 days ago
Posts
167
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
jbird's Groups
Updated the tutorial. Fixed a last stand bug that would cause mission fail to happen, and made it so the zombies health and the amont of zombies in a round doesnt increase after a round restart.

 
Loading ...