Modme Forums

Out of bounds timer

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


ModmeBot:

Thread By: ltschase
I want to have an out of bounds timer that gives players 10-20 seconds or so to get out of an area before it kills them. I got most of this working using a multiples trigger, but I don't know how to determine which player is within the trigger, and then kill that player if he does not get out prior to the timer running out.


ModmeBot:

Reply By: mathfag
I used this on chernobyl. Not based on time but deals damage depending on the script noteworthy. If it's "forest" it will deal damage depending on how far away you are from the nearest struct with targetname "struct_forest_radiation".



//////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////RADIATION//////////////////////////////////////////////
function autoexec radiation()
{
radiation = GetEntArray("trig_radiation","targetname");
damagemax = 20;

foreach(rad in radiation)
	rad thread radiation_trigs(damagemax);
}



function radiation_trigs(damagemax) //self = radiation trigger
{
forest_structs = struct::get_array("struct_forest_radiation","targetname");

radius = self.radius;
while(1)
	{
	self waittill("trigger", player);
	if(self.script_noteworthy == "low")
		{
		dist = Distance2D(self.origin,player.origin);
		new_dist = radius-dist;
		multi = new_dist/radius;
		if(isdefined(player.has_gas_mask) && player.has_gas_mask == 1)
			multi = multi/2;
		player DoDamage(damagemax*multi,self.origin);
		wait 1;
		}

	if(self.script_noteworthy == "high")
		{
		dist = Distance2D(self.origin,player.origin);
		new_dist = radius-dist;
		multi = 2*new_dist/radius;
		if(isdefined(player.has_gas_mask) && player.has_gas_mask == 1)
			multi = multi/2;
		player DoDamage(damagemax*multi,self.origin);
		wait 1;
		}

	else if(self.script_noteworthy == "forest")
		{
		closest = ArrayGetClosest(player.origin,forest_structs);
		dist = Distance2D(closest.origin,player.origin);
		damage = dist/10;
		if(isdefined(player.has_gas_mask) && player.has_gas_mask == 1)
			damage = damage/1.3;
		player DoDamage(damage,self.origin);
		//IPrintLnBold("damage");
		wait 0.5;
		}

	}

}

//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////