Modme Forums

Shoot 3 targets with a packed gun to open a door

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


ModmeBot:

Thread By: modric
Need help finding a script for a shootable ee that opens a door but i want the targets to only trigger if the weapon used is pack a punched


ModmeBot:

Reply By: Sphynx
I made a script for you that checks how many triggers there are and if the weapon is upgraded:

The trigger names can be adjusted to whatever you like. If you want level. makes it so you can use the variables in other scripts too.


#using scripts\codescripts\struct;
#using scripts\shared\array_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\compass;
#using scripts\shared\exploder_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\laststand_shared;
#using scripts\shared\math_shared;
#using scripts\shared\scene_shared;
#using scripts\shared\util_shared;
#using scripts\shared\flagsys_shared;
#using scripts\shared\trigger_shared;
#insert scripts\shared\shared.gsh;
#insert scripts\shared\version.gsh;
#insert scripts\zm\_zm_utility.gsh;
#using scripts\zm\_zm_score;
#using scripts\zm\_load;
#using scripts\zm\_zm;
#using scripts\zm\_zm_audio;
#using scripts\zm\_zm_powerups;
#using scripts\zm\_zm_utility;
#using scripts\zm\_zm_weapons;
#using scripts\zm\_zm_zonemgr;
#using scripts\zm\_zm_perks;

function init (){
level.shottriggersteddy = 0;
level.neededtriggersteddy = 9;
thread inittriggers();
thread checkfinish();
}
function checkfinish () {
done = false;
while(done == false){
if(level.shottriggersteddy >= level.neededtriggersteddy){
done = true;
IPrintLNBold("All triggers were activated!");
//level util::set_lighting_state( 1 );
//do stuff here that happens once and not per player!
door_models = getEntArray( "soulbox_model" , "targetname");
door_clips = getentArray( "soulbox_clip" , "targetname");
foreach(clip in door_clips){ //For each clip in door_clips it will thread clipremove()
clip thread clipremove(); //Thread clipremove();
}

foreach(model in door_models){ //For each model in door_models it will thread doorremove()
model thread doorremove(); //Thread doorremove();
}
players = GetPlayers();
for (i = 0; i < players.size; i++)
{
players[i] playSound("sound_name_here");
//Do stuff here Like set another lightingstate, add points to players or add perk to players
//players[i] zm_perks::give_perk("specialty_widows_wine");
}
}
wait (.05);
}
}
function inittriggers(){
wait(40);
level.triggersteddy = getentarray( "trigger_teddybear" , "targetname");
foreach(trigger in level.triggersteddy){
trigger thread CheckTrigger();
}
}
function CheckTrigger (){
while(1)
{
self waittill("trigger", player);
self setcursorhint("HINT_NOICON");
weapon = player getCurrentWeapon();
if( zm_weapons::is_weapon_upgraded( weapon ) )
{
IPrintLNBold("Trigger shot!");
players = GetPlayers();
for (i = 0; i < players.size; i++)
{
players[i] playSound("ear_ring");
}
//Do stuff
level.shottriggersteddy++;
self Delete();
}
}
}
function doorremove () { //Wallbreak will delete the model
wallbreaktime = 1;
self moveto ((self.origin - (0,0,-400)), wallbreaktime);
wait wallbreaktime;
self Delete();
}
function clipremove () { //Wallbreak will delete the model
wallbreaktime = 1;
wait wallbreaktime;
self Delete();
}