Modme Forums

Trigger accumulates damage

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


ModmeBot:

Thread By: Dan9977

how would you make a trigger_damage have to accumulate a certain amount of damage before it activates? I've been trying but can't get it to work.


ModmeBot:

Reply By: natesmithzombies

Something along the lines of this:

function init_trigger_damage()
{
	trig = GetEnt( "damage_health_trigger", "targetname" ); 
	trig.health = 500; 
	
	while( trig.health > 0 )
	{
		trig waittill( "damage", amount, attacker, direction_vec, point, type, tagName, modelName, partName, weapon, dFlags, inflictor, chargeLevel );
		trig.health-=amount; 
	}
	
	iprintlnbold( "Trigger has been killed" ); 
}


ModmeBot:

Reply By: Dan9977

natesmithzombies

Something along the lines of this:

function init_trigger_damage()
{
	trig = GetEnt( "damage_health_trigger", "targetname" ); 
	trig.health = 500; 
	
	while( trig.health > 0 )
	{
		trig waittill( "damage", amount, attacker, direction_vec, point, type, tagName, modelName, partName, weapon, dFlags, inflictor, chargeLevel );
		trig.health-=amount; 
	}
	
	iprintlnbold( "Trigger has been killed" ); 
}

It doesn't work. Every time I shoot the trigger IPrintLn says its health is 32000 minus the damage of whatever gun shot it, regardless of what trig.health is.


ModmeBot:

Reply By: natesmithzombies

Dan9977
natesmithzombies

Something along the lines of this:

function init_trigger_damage()
{
	trig = GetEnt( "damage_health_trigger", "targetname" ); 
	trig.health = 500; 
	
	while( trig.health > 0 )
	{
		trig waittill( "damage", amount, attacker, direction_vec, point, type, tagName, modelName, partName, weapon, dFlags, inflictor, chargeLevel );
		trig.health-=amount; 
	}
	
	iprintlnbold( "Trigger has been killed" ); 
}

It doesn't work. Every time I shoot the trigger IPrintLn says its health is 32000 minus the damage of whatever gun shot it, regardless of what trig.health is.

It could be that .health is reserved for the trigger. Try this and see if it makes a difference:

function init_trigger_damage()
{
	trig = GetEnt( "damage_health_trigger", "targetname" ); 
	trig.trig_health = 500; 
	
	while( trig.trig_health > 0 )
	{
		trig waittill( "damage", amount, attacker, direction_vec, point, type, tagName, modelName, partName, weapon, dFlags, inflictor, chargeLevel );
		trig.trig_health-=amount; 
	}
	
	iprintlnbold( "Trigger has been killed" ); 
}