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

[Tutorial]Multiple End Game Switches

broken avatar :(
Created 9 years ago
by alaurenc9
0 Members and 1 Guest are viewing this topic.
3,130 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2012
Last active: 9 months ago
Posts
577
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
My preferred name is "xSanchez78".
Check me out here: www.steamcommunity.com/id/xSanchez78
×
alaurenc9's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
alaurenc9's Contact & Social LinksxSanchez78xSanchez78xSanchez78xSanchez78xSanchez78xSanchez78
Hey Guys.
I just recently thought of something interesting.
I thought could you make multiple end game switches?
Yes you can.
I have made a script.

First you make a new ".gsc" file.
Rename it to "end_switches.gsc".
Place this into it:
Code Snippet
Plaintext
//================================================================================================
// 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");
}
}



Call "maps\end_switches::main();" after "maps\_zombiemode::main();" in "mapname.gsc".
Go into "_zombiemode.gsc".
Search for the "end_game()" function.
Replace it with this:
Code Snippet
Plaintext
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 );
}



Go into Radiant.
Make a trigger_use.
Give it this KVP:
          targetname = end_game_switch

You can place as many of these around your map.
They will all have the same hintstring, cost, and all will need to be activated to end the game.
You can edit the price and hintstring in the "end_switches.gsc".
Thats all.
Enjoy.
Credit me, xSanchez78 for this.
Peace.
Last Edit: November 27, 2014, 02:17:47 pm by alaurenc9
broken avatar :(
×
broken avatar :(
Senpai
Location: us
Date Registered: 28 September 2013
Last active: 3 years ago
Posts
605
Respect
Forum Rank
Zombie Enslaver
Primary Group
Box Mappers Elite
My Groups
More
My Contact & Social Links
More
×
arceus's Groups
Box Mappers Elite
Box Mappers Elite
arceus's Contact & Social LinksarceusNT
good job  :poker:
Last Edit: November 10, 2014, 11:28:23 pm by arceus
broken avatar :(
×
broken avatar :(
[UGX] Developer
Location: nlLimburg, Netherlands
Date Registered: 28 October 2013
Last active: 5 months ago
Posts
764
Respect
Forum Rank
The Decider
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
[UGX] Developer
×
Lukkie1998's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Box Mappers Elite
Box Mappers Elite
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
UGX Chat Moderator Has the ability to mute, kick, or ban chat members for being abusive or breaking the rules of the forum.
UGX Site Moderator 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.
2015 Participant
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
This script has been so unuseful, that nobody even discovered that the script will throw a bad syntax error. Alauranc9, please fix this error within a reasonable time period, or this topic will be removed.

Lukkie1998
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 6 months ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Not to mention it takes your points even when you fail the 2nd if block.

 
Loading ...