Call of duty bo3: ZM Loose Change

From COD Modding & Mapping Wiki
Jump to navigation Jump to search

This tutorial will allow your perk machines to have the "loose change" capabilit, like in the stock game where player can prone in front of the machines and get points

In radiant

  • Locate your Perk Machine and add a trigger_multiple (drag from Entity browser) to the rough shape of the perk machine (bit of a guess since you cant see the machine in Radiant)
  • Once resized, add the following KVPs to the trigger_multiple
targetname == zmb_perks_bump_bottle
script_sound == audio_bump_trigger

In Scripts

  • open your main Level GSC (in usermaps/zm_yourmap/scripts/zm/zm_yourmap.gsc)
  • Locate the main() function (generally on the top) and insert this before the closing }
level thread spare_change();
  • Then scroll to bottom of the script and insert this 2 new functions
function spare_change( str_trigger = "audio_bump_trigger", str_sound = "zmb_perks_bump_bottle" )
{
	// Check under the machines for change
	a_t_audio = GetEntArray( str_trigger, "targetname" );
	foreach( t_audio_bump in a_t_audio )
	{
		if ( t_audio_bump.script_sound === str_sound )
		{
			t_audio_bump thread check_for_change();
		}
	}
}

function check_for_change()
{
	self endon( "death" );
	
	while( true )
	{
		self waittill( "trigger", player );

		if ( player GetStance() == "prone" )
		{
			player zm_score::add_to_player_score( 100 );
			zm_utility::play_sound_at_pos( "purchase", player.origin );
			break;
		}

		wait 0.1;
	}
}
Note: The value given to the player can be adjusted in the script, currently set to 100 points