Modme Forums
Menu:

Buyable ending restart the game

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: Pipi
Hello,
I've got two questions:
I am using the NSZ buyable ending (thanks for this) and I wish to restart the game instead of ending it with text saying something like "You didn't break the cycle". Is it possible?
Also, after an usual buyable ending is that possible to have a specific sound instead of the gameover one (I am not talking about changing the gameover sound but have another one just for the buyable ending), and some images we choosed instead of the default images during the gameover outro? To make a sort of custom cutscene with 2 or 3 images.
I know it is three questions, thanks for reading.


ModmeBot:

Reply By: Symbo
To restart the map, you can try this:

void Map_Restart([save persistent])

[OPTIONAL] [save persistent] if true then player info is retained
CATEGORY: 
CLIENT/SERVER: Server
SUMMARY: Restarts the map
EXAMPLE: Map_Restart( true )


ModmeBot:

Reply By: Pipi
Thanks! I used a part of NSZ script and did it. For a buyable ending that restarts the map:
I put this in main:

thread init2();
	thread main2();
then this at the bottom of my gsc:
function init2()
{
	// ============ CHANGE YOUR SETTINGS BELOW ================
	level.end_game_cost = 50000; 												// This line is how much it will cost to end your game
	level.message_to_end = "Press and Hold ^3&&1^7 to teleport to the House [Cost: "+level.end_game_cost+"]"; 	// This is the message a player will see to end the game
	level.failed_message = "You Do Not Have Enough Money";					// This the message a player will see if they dont have enough money
	level.end_game_message = "Maxiiiiis I have something for you my dear";			// This is the message the player will see at the end of the game 
	level.all_players_near_end = true; 											// Set this to false if all players do not need to be near the end game to end the game
	level.failed_all_players_message = "All Players Must Be Nearby to Escape";	// This is the message you will see if all players are not nearby the end game when activated
	// ============ CHANGE YOUR SETTINGS ABOVE ================
	main2(); 
}

function main2()
{
	false_ending = GetEnt( "false_ending", "targetname" ); 
	false_ending SetCursorHint( "HINT_NOICON" );
	false_ending UseTriggerRequireLookAt(); 
	cost = level.end_game_cost;

	while(1)
	{
		false_ending SetHintString( level.message_to_end ); 
		false_ending waittill( "trigger", player ); 
		if( isDefined(cost) && isDefined(player) && player.score >= cost )
		{
			if( level.all_players_near_end2 )
			{
				if( false_ending all_players_near_end2() )
				{
					//player zm_score::minus_to_player_score( cost );
					false_ending SetHintString(""); 
					PlaySoundAtPosition("shadowwinid", false_ending.origin );
					end_it_now2();
				}
				else
				{
					false_ending SetHintString( level.failed_all_players_message ); 
					wait(1); 
				}
			}
			else
			{
				//player zm_score::minus_to_player_score( cost );
				false_ending SetHintString("");
				PlaySoundAtPosition("shadowwinid", false_ending.origin );
				end_it_now2();
			}
		}
		else if( isDefined(cost) && isDefined(player) && player.score < cost )
		{
			false_ending SetHintString( "You Do Not Have Enough Money" ); 
			PlaySoundAtPosition("shadownomoneyid", false_ending.origin );
			wait(1); 
		}
	}
}

function all_players_near_end2()
{
	players = getplayers(); 
	foreach( player in players )
	{
		if( Distance(self.origin, player.origin) > 500 )
			return false; 
	}
	return true; 
}

function end_it_now2()
{

level flag::clear( "spawn_zombies" );
	zombies = zombie_utility::get_round_enemy_array();
		if ( isdefined( zombies ) )
		{
			array::run_all( zombies, &Kill );
		}
		thread better_print ("The Shadowman is a liar", 0, 0, 3, 3 );
		wait (5);
		thread better_print ("The cycle continues", 0, 0, 3, 3 );
		wait (5);
	Map_Restart( true );
}
function better_print( text, align_x, align_y, font_scale, fade_time )
{
    hud = NewHudElem();
    hud.foreground = true;
    hud.fontScale = font_scale;
    hud.sort = 1;
    hud.hidewheninmenu = false;
    hud.alignX = "center";
    hud.alignY = "middle";
    hud.horzAlign = "center";
    hud.vertAlign = "middle";
    hud.x = align_x;
    hud.y = hud.y - align_y;
    hud.alpha = 1;
    hud SetText( text );
    wait( 2 );
    hud fadeOverTime( fade_time );
    hud.alpha = 0;
    wait( fade_time );
    hud Destroy();
}