

Login Issues
Forgot password?Activate Issues
Account activation email not received? Wrong account activation email used?Other Problems?
Contact Support - Help Center Get help on the UGX Discord. Join it now!

![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
![]() | Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community. |
//================================================================================================
// Script Name : Multiple End Game Switches
// Author : xSanchez78
// Notes : call "maps\end_switches::main();" after "maps\_zombiemode::main();" in "mapname.gsc".
//
//================================================================================================
#include common_scripts\utility;
#include maps\_utility;
#include maps\_zombiemode_utility;
#include maps\_hud_util;
main()
{
level.game_was_beaten = false;
level.end_switch_cost = 30000;
end_switches = GetEntArray("end_game_switch", "targetname");
level.NumberOfSwitches = end_switches.size;
level.NumberOfSwitchesActive = 0;
array_thread(end_switches,::end_switches_init);
}
end_switches_init()
{
self sethintstring("Press &&1 to Actviate The End Game Switch [Cost: "+level.end_switch_cost+"]");
self setCursorHint("HINT_NOICON");
while(1)
{
self waittill( "trigger", player );
if(player.score >= level.end_switch_cost)
{
self playsound("cha_ching");
player maps\_zombiemode_score::minus_to_player_score( level.end_switch_cost );
current = level.NumberOfSwitchesActive;
level.NumberOfSwitchesActive = current + 1;
EndSwitchCheck();
self delete();
}
else if(player.score < level.end_switch_cost)
{
self playsound("deny");
}
}
}
EndSwitchCheck()
{
if(level.NumberOfSwitchesActive == level.NumberOfSwitches)
{
iprintlnbold ("All Switches Activated, Game Has Been Beaten");
level.game_was_beaten = true;
level notify( "end_game" );
}
else
{
iprintlnbold ("Need To Activate More End Game Switches");
}
}end_game()
{
level waittill ( "end_game" );
if( level.game_was_beaten == false )
{
thread game_over_state_died();
}
else if( level.game_was_beaten == true )
{
thread game_over_state_won();
}
}
game_over_state_died()
{
level.intermission = true;
update_leaderboards();
game_over = NewHudElem( self );
game_over.alignX = "center";
game_over.alignY = "middle";
game_over.horzAlign = "center";
game_over.vertAlign = "middle";
game_over.y -= 10;
game_over.foreground = true;
game_over.fontScale = 3;
game_over.alpha = 0;
game_over.color = ( 1.0, 1.0, 1.0 );
game_over SetText( &"ZOMBIE_GAME_OVER" );
game_over FadeOverTime( 1 );
game_over.alpha = 1;
survived = NewHudElem( self );
survived.alignX = "center";
survived.alignY = "middle";
survived.horzAlign = "center";
survived.vertAlign = "middle";
survived.y += 20;
survived.foreground = true;
survived.fontScale = 2;
survived.alpha = 0;
survived.color = ( 1.0, 1.0, 1.0 );
if( level.round_number < 2 )
{
survived SetText( &"ZOMBIE_SURVIVED_ROUND" );
}
else
{
survived SetText( &"ZOMBIE_SURVIVED_ROUNDS", level.round_number );
}
//TUEY had to change this since we are adding other musical elements
setmusicstate("end_of_game");
setbusstate("default");
survived FadeOverTime( 1 );
survived.alpha = 1;
wait( 1 );
//play_sound_at_pos( "end_of_game", ( 0, 0, 0 ) );
wait( 2 );
intermission();
wait( level.zombie_vars["zombie_intermission_time"] );
level notify( "stop_intermission" );
array_thread( get_players(), ::player_exit_level );
bbPrint( "zombie_epilogs: rounds %d", level.round_number );
wait( 1.5 );
if( is_coop() )
{
ExitLevel( false );
}
else
{
MissionFailed();
}
// Let's not exit the function
wait( 666 );
}
game_over_state_won()
{
level.intermission = true;
update_leaderboards();
game_over = NewHudElem( self );
game_over.alignX = "center";
game_over.alignY = "middle";
game_over.horzAlign = "center";
game_over.vertAlign = "middle";
game_over.y -= 10;
game_over.foreground = true;
game_over.fontScale = 3;
game_over.alpha = 0;
game_over.color = ( 1.0, 1.0, 1.0 );
game_over SetText( "YOU WON" );
game_over FadeOverTime( 1 );
game_over.alpha = 1;
survived = NewHudElem( self );
survived.alignX = "center";
survived.alignY = "middle";
survived.horzAlign = "center";
survived.vertAlign = "middle";
survived.y += 20;
survived.foreground = true;
survived.fontScale = 2;
survived.alpha = 0;
survived.color = ( 0.423, 0.004, 0 );
if( level.round_number < 2 )
{
survived SetText( "You Won After 1 Round" );
}
else
{
survived SetText( "You Won After ", level.round_number, " Rounds" );
}
//TUEY had to change this since we are adding other musical elements
setmusicstate("end_of_game");
setbusstate("default");
survived FadeOverTime( 1 );
survived.alpha = 1;
wait( 1 );
//play_sound_at_pos( "end_of_game", ( 0, 0, 0 ) );
wait( 2 );
intermission();
wait( level.zombie_vars["zombie_intermission_time"] );
level notify( "stop_intermission" );
array_thread( get_players(), ::player_exit_level );
bbPrint( "zombie_epilogs: rounds %d", level.round_number );
wait( 1.5 );
if( is_coop() )
{
ExitLevel( false );
}
else
{
MissionFailed();
}
// Let's not exit the function
wait( 666 );
}
![]() | |
![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
![]() Box Mappers Elite | |
![]() | Has released one or more maps to the UGX-Mods community. |
![]() | Has the ability to mute, kick, or ban chat members for being abusive or breaking the rules of the forum. |
![]() | Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms. |
![]() | |
![]() BO3 Modtools Alpha | This user has access to the Black Ops 3 Modtools Alpha |
![]() | |
![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
![]() | Has shown excellence and experience in the area of custom scripting in the UGX-Mods community. |
![]() BO3 Modtools Alpha | This user has access to the Black Ops 3 Modtools Alpha |