Modme Forums

Perk machines that requires Power from a Gun

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


ModmeBot:

Thread By: Yasser143
I would like to know if their is a way to make the perk machines (Not Including Pap) requires the power on and a shot of the wunderwaffe dg-2 on a trigger that turns on the perk machines ( Each Perk machine has its own trigger, each needs to get Shot once from the wunderwaffe).


ModmeBot:

Reply By: Ping998

Yasser143I would like to know if their is a way to make the perk machines (Not Including Pap) requires the power on and a shot of the wunderwaffe dg-2 on a trigger that turns on the perk machines ( Each Perk machine has its own trigger, each needs to get Shot once from the wunderwaffe).


You could use a trigger_damage and make it weapon specific (I don't know how to do that in BO3 but it was possible in WaW so I assume it still is).

Then you could link it to a door (using target/targetname) which would open up to a perk machine or something like that.

Hope this helps!


ModmeBot:

Reply By: natesmithzombies

Untested (not on a proper PC atm) but here is something to get you started. Let me know if it works out.

1) Add this to the bottom of your mapname.gsc:

function triggered_perks()
{
	trigs = GetEntArray( "triggered_perks", "targetname" ); 
	foreach( trig in trigs )
		trig thread damage_think(); 
	
	thread powered_perk_override(); 
}

function powered_perk_override()
{
	level flag::wait_till( "start_zombie_round_logic" );
	wait(0.1); 
	
	vending_triggers = GetEntArray( "zombie_vending", "targetname" );
	foreach ( trigger in vending_triggers )
	{
		powered_on = zm_perks::get_perk_machine_start_state(trigger.script_noteworthy);
		powered_perk = zm_power::add_powered_item( undefined, undefined, undefined, undefined, undefined, undefined, trigger );
		zm_power::remove_powered_item( powered_perk ); 
	}
}

function damage_think()
{
	level endon( "intermission" ); 
	
	while(1)
	{
		self waittill( "damage", amount, attacker, direction_vec, point, type, tagName, modelName, partName, weapon, dFlags, inflictor, chargeLevel );
		if( weapon == GetWeapon("tesla_gun") ) // change tesla_gun to whatever weapon you want
		{
			str_on = self.script_noteworthy + "_on";
			level notify( str_on ); 
			break; 
		}
	}
}



2) Add this to your function main of your mapname.gsc:

triggered_perks();



3) Insert a trigger damage with the following KVPS in your map:

targetname - triggered_perks

script_noteworthy - perk_specific*

*These are your options for the script_noteworthy:

<ul style="padding-left:40px;margin:0;">
<li style="width:100%;">juggernog</li><li style="width:100%;">widows_wine</li><li style="width:100%;">doubletap</li><li style="width:100%;">electric_cherry</li><li style="width:100%;">revive</li><li style="width:100%;">marathon</li><li style="width:100%;">sleight</li></ul>

4) Compile and report back after testing

5) If you get an error saying something about unrecognized function add this to your mapname.gsc at the very top:

#using scripts\zm\_zm_power;




ModmeBot:

Reply By: Yasser143

It works, but I dont want the power switch to also turn on the perks as well, only the weapon should be able to. But besides that it works.


ModmeBot:

Reply By: natesmithzombies

Yasser143

It works, but I dont want the power switch to also turn on the perks as well, only the weapon should be able to. But besides that it works.

I updated my original code to try and counter this. Reinstall and let me know if it works. I also had to add an additional step 5 in case the _zm_power.gsc is not already used in the mapaname.gsc. If you dont get the error let me know so I can remove that step if it is redundant


ModmeBot:

Reply By: Yasser143

natesmithzombies
Yasser143

It works, but I dont want the power switch to also turn on the perks as well, only the weapon should be able to. But besides that it works.

I updated my original code to try and counter this. Reinstall and let me know if it works. I also had to add an additional step 5 in case the _zm_power.gsc is not already used in the mapaname.gsc. If you dont get the error let me know so I can remove that step if it is redundant

Even with the addition support of step 5, im getting this error from the script,

Unresolved external 'zm_perks::get_perk_machine_start_state


ModmeBot:

Reply By: natesmithzombies

Yasser143
natesmithzombies
Yasser143

It works, but I dont want the power switch to also turn on the perks as well, only the weapon should be able to. But besides that it works.

I updated my original code to try and counter this. Reinstall and let me know if it works. I also had to add an additional step 5 in case the _zm_power.gsc is not already used in the mapaname.gsc. If you dont get the error let me know so I can remove that step if it is redundant

Even with the addition support of step 5, im getting this error from the script,

Unresolved external 'zm_perks::get_perk_machine_start_state

Interesting it appears that this must be missing in your mapname.gsc as well:

#using scripts\zm\_zm_perks;



insert that at the top of the script and see if it compiles. Sorry I am not on a proper computer to test myself atm


ModmeBot:

Reply By: Yasser143

Ya its still is the same as the last script, the dg2 turns on the perks, but the power switch also turns on the perks as well.


ModmeBot:

Reply By: natesmithzombies

Yasser143

Ya its still is the same as the last script, the dg2 turns on the perks, but the power switch also turns on the perks as well.

Damn sorry to put this one on hold, but I will revisit this topic after I finish Brutus. I am on a limited time crunch and this one has to be tested on my home PC


ModmeBot:

Reply By: Yasser143

No Problem Nate, just let me know when u have time to finish up this script for me. Thx


ModmeBot:

Reply By: Yasser143

Nate do u have any time on hand to finish up the script?


ModmeBot:

Reply By: natesmithzombies

I have tested this and can assure you that it works:

Step 1) Paste this at the bottom of your mapname.gsc

function triggered_perks()
{
	zm_perks::register_perk_machine_power_override( "specialty_armorvest", &amp;wait_for_trigger ); 
	zm_perks::register_perk_machine_power_override( "specialty_quickrevive", &amp;wait_for_trigger ); 
	zm_perks::register_perk_machine_power_override( "specialty_fastreload", &amp;wait_for_trigger ); 
	zm_perks::register_perk_machine_power_override( "specialty_doubletap2", &amp;wait_for_trigger ); 
	zm_perks::register_perk_machine_power_override( "specialty_staminup", &amp;wait_for_trigger ); 
	zm_perks::register_perk_machine_power_override( "specialty_phdflopper", &amp;wait_for_trigger ); 
	zm_perks::register_perk_machine_power_override( "specialty_deadshot", &amp;wait_for_trigger ); 
	zm_perks::register_perk_machine_power_override( "specialty_additionalprimaryweapon", &amp;wait_for_trigger ); 
	zm_perks::register_perk_machine_power_override( "specialty_electriccherry", &amp;wait_for_trigger ); 
	zm_perks::register_perk_machine_power_override( "specialty_widowswine", &amp;wait_for_trigger ); 
}

function wait_for_trigger()
{
	if( isDefined( level.run_special_power_once ) ) // make the func run once and only once
		return;
	level.run_special_power_once = true; 
	
	trigs = GetEntArray( "triggered_perks", "targetname" ); 
	foreach( trig in trigs )
		trig thread activate_on_shoot(); 
}

function activate_on_shoot()
{
	while(1)
	{
		self waittill( "damage", amount, attacker, direction_vec, point, type, tagName, modelName, partName, weapon, dFlags, inflictor, chargeLevel );
		if( weapon == GetWeapon("tesla_gun") ) // change tesla_gun to whatever weapon you want
		{
			perk_machine_think( self.script_noteworthy, level._custom_perks[ self.script_noteworthy ] );
			break; 
		}
	}
}

function perk_machine_think( str_key, s_custom_perk )
{	
	str_endon = str_key + PERK_END_POWER_THREAD;
	level endon( str_endon );//Support endon for any perk machine
	
	str_on = s_custom_perk.alias + "_on";
	str_off = s_custom_perk.alias + "_off";
	str_notify = str_key + "_power_on";
	
	while ( true )
	{
		machine = getentarray( s_custom_perk.radiant_machine_name, "targetname");
		machine_triggers = GetEntArray( s_custom_perk.radiant_machine_name, "target" );
		
		for( i = 0; i &lt; machine.size; i++ )
			machine[i] SetModel(level.machine_assets[str_key].off_model);
		
		level thread zm_perks::do_initial_power_off_callback( machine, str_key );
		array::thread_all( machine_triggers, &amp;zm_perks::set_power_on, false );
	
		// level waittill( str_on );
	
		for( i = 0; i &lt; machine.size; i++ )
		{
			machine[i] SetModel(level.machine_assets[str_key].on_model);
			machine[i] vibrate((0,-100,0), 0.3, 0.4, 3);
			machine[i] playsound("zmb_perks_power_on");
			machine[i] thread zm_perks::perk_fx( s_custom_perk.machine_light_effect );
			machine[i] thread zm_perks::play_loop_on_machine();
		}
		level notify( str_notify );
		
		array::thread_all( machine_triggers, &amp;zm_perks::set_power_on, true );
		if( isdefined( level.machine_assets[ str_key ].power_on_callback ) )
		{
			array::thread_all( machine, level.machine_assets[ str_key ].power_on_callback );
		}
		
		level waittill( str_off );
			
		if( isdefined( level.machine_assets[ str_key ].power_off_callback ) )
		{
			array::thread_all( machine, level.machine_assets[ str_key ].power_off_callback );
		}
		array::thread_all( machine, &amp;zm_perks::turn_perk_off );
	}
}



Step 2) Add this to the top of your mapname.gsc:

#insert scripts\zm\_zm_perks.gsh;



Step 3) Add this to function main in mapname.gsc

level thread triggered_perks();



Sep 4) Add a trigger>damage for each perk you would like and give it the following KVPs:

targetname - triggered_perks

script_noteworthy - specialty_name*

* where specialty name is specialty_armorvest, specialty_quickrevive, etc.


ModmeBot:

Reply By: Yasser143

I get this error when I link it, 'zm_perks::register_perk_machine_power_override'


ModmeBot:

Reply By: natesmithzombies

Yasser143

I get this error when I link it, 'zm_perks::register_perk_machine_power_override'

Add these to the top of your mapname.gsc

#using scripts\zm\_zm_perks;
#insert scripts\zm\_zm_perks.gsh;