Modme Forums
Menu:

Shoot triggers with certain upgraded gun

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


ModmeBot:

Thread By: simplyzak09
Hi,
I'm trying to add a feature to a map I'm working on that if the player keeps and upgrades their starting weapon and shoots 3 perk bottles around the map then a door will open allowing them to access jug.
I have looked up example and such from other scripts and stuff to see how it is done and written up this, however in game it doesn't work nothing happens when the trigger is shot.
Link to code I was using to build off of:https://pastebin.com/iru9hwX8

function eeJug()
{
    level.itemsRequired = 3; //change to number of shootable objects
    level.itemsCollected = 0;
    level thread bottle1();
    level thread bottle2();
    level thread bottle3();
    //Add additional items here
	
}
 
function bottle1()
{
    trigs1 = GetEnt("ee_trig1", "targetname");
    objs1 = GetEnt("ee_obj1", "targetname");
    
    while(1)
    {
        trigs1 waittill( "damage", amount, attacker, direction_vec, point, type, tagName, modelName, partName, weapon, dFlags, inflictor, chargeLevel );
     if( weapon == GetWeapon("mc96_upgraded"))
		 {
			level.itemsCollected++;
        thread eeCheckDone2 ();
        break;
    }
    trigs1 Delete();
    objs1 Delete();
	
}
}
function bottle2()
{
    trigs2 = GetEnt("ee_trig2", "targetname");
    objs2 = GetEnt("ee_obj2", "targetname");
    
    while(1)
    {
        trigs2 waittill( "damage", amount, attacker, direction_vec, point, type, tagName, modelName, partName, weapon, dFlags, inflictor, chargeLevel );
     if( weapon == GetWeapon("mc96_upgraded"))
		 {
			level.itemsCollected++;
        thread eeCheckDone2 ();
        break;
    }
    trigs2 Delete();
    objs2 Delete();
	
}
} 
function bottle3()
{
    trigs3 = GetEnt("ee_trig3", "targetname");
    objs3 = GetEnt("ee_obj3", "targetname");
    
    while(1)
    {
        trigs3 waittill( "damage", amount, attacker, direction_vec, point, type, tagName, modelName, partName, weapon, dFlags, inflictor, chargeLevel );
     if( weapon == GetWeapon("mc96_upgraded"))
		 {
			level.itemsCollected++;
        thread eeCheckDone2 ();
        break;
    }
    trigs3 Delete();
    objs3 Delete();
	
}
}
function eeCheckDone2 ()
{
    while(1)
    {
        self waittill(level.shootablesCollected >= level.itemsRequired);
        if(level.itemsCollected == level.itemsRequired)
        {
            //self playlocalsound( level.zmb_laugh_alias ); Not working atm
            objsDoor = GetEnt("ee_jug1", "targetname");
            objsDoor Delete();
      }    
        break;
	}
}	


ModmeBot:

Reply By: xdferpc
to be shootable use trigger_damage
to be the jug a button uses trigger_use

function openedoor()
{
    level.shootable_door_count1 = 0;
    shoot = GetEntArray("shootable_trig", "targetname");
	
	foreach(shooters in shoot)
	{
	    pulsadores thread opendoor1();
	}
}
function opendoor1()
{
    
    self waittill("trigger",player);
	perk = getEnt(self.target,"targetname");
	
	self delete();
	perk Delete();
	self.target Delete();
	door1 = getEnt("door1","targetname");
	level.shootable_door_count1++;
	if(level.shootable_door_count1 == 3) // if you press all the triggers = 3 (You can change it)
	{
	    door1 delete(); //door open
		jug1 = getEnt("jug1","targetname"); 
		self waittill("trigger",player); //pulse the jug
	    wait (1);
	    jug1 delete();
		a_players = getPlayers(); 
		for ( i = 0; i < a_players.size; i++ )
		{
			
			a_players[ i ] zm_weapons::weapon_give( getWeapon( "mc96_upgraded" ), undefined, undefined, undefined, 1 ); //give weapon
	
		}
	    
	}
}


ModmeBot:

Reply By: simplyzak09

xdferpc
to be shootable use trigger_damage to be the jug a button uses trigger_use function openedoor() { level.shootable_door_count1 = 0; shoot = GetEntArray("shootable_trig", "targetname"); foreach(shooters in shoot) { pulsadores thread opendoor1(); } } function opendoor1() { self waittill("trigger",player); perk = getEnt(self.target,"targetname"); self delete(); perk Delete(); self.target Delete(); door1 = getEnt("door1","targetname"); level.shootable_door_count1++; if(level.shootable_door_count1 == 3) // if you press all the triggers = 3 (You can change it) { door1 delete(); //door open jug1 = getEnt("jug1","targetname"); self waittill("trigger",player); //pulse the jug wait (1); jug1 delete(); a_players = getPlayers(); for ( i = 0; i < a_players.size; i++ ) { a_players[ i ] zm_weapons::weapon_give( getWeapon( "mc96_upgraded" ), undefined, undefined, undefined, 1 ); //give weapon } } }

This doesn't work, the script keep throwing out an error about this line
pulsadores thread opendoor1();

the error:

^1
^1^
^1ERR(6E) scripts/zm/zm_refresher.gsc (98,0)  : Compiler Internal Error :  Uninitialized local variable &#39;pulsadores&#39;


ModmeBot:

Reply By: xdferpc
sorry men , I have got confused
put in that line:

shooters thread opendoor1();


ModmeBot:

Reply By: Symbo
You guys should stop using trigger when you need to shoot an object. With

entity SetCanDamage(1);
the entity itself can detect damage. It works better and it is more accurate.