Modme Forums

Cone shape instead of radius

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


ModmeBot:

Thread By: mathfag
Basically I'm making a boss who uses a flamethrower on you. I have most of it figured out but I'm having some problems with the damage of the flames because the boss deals damage in a radius instead of one direction.

This is what I have so far:

foreach( player in players )
{
	if( Distance2d(player.origin, self.origin) < 300 && self.boss_enemy == player )
	{
	player DoDamage( 40, player.origin, self ); 
	}
}


As you can see in this script, the fire will kill anyone withing a 300 unit radius but I need it to kill within 30 degrees of the front of the boss.
See image below.


sorry for bad artwork

PS does anyone know how to give the player the flames HUD effect like when the panzer sets you on fire?
PS2 does anyone have a cool flamethrower effect?


ModmeBot:

Reply By: natesmithzombies
I have been gone a while and haven't had the chance to answer some questions. Here is a copy and paste of the function I use to see if a boss is facing its target:

function is_facing( facee )
{
	orientation = self getPlayerAngles();
	forwardVec = anglesToForward( orientation );
	forwardVec2D = ( forwardVec[0], forwardVec[1], 0 );
	unitForwardVec2D = VectorNormalize( forwardVec2D );
	toFaceeVec = facee.origin+(0,0,62) - self.origin;
	toFaceeVec2D = ( toFaceeVec[0], toFaceeVec[1], 0 );
	unitToFaceeVec2D = VectorNormalize( toFaceeVec2D );
	
	dotProduct = VectorDot( unitForwardVec2D, unitToFaceeVec2D );
	return ( dotProduct > 0.95 ); 
}


ModmeBot:

Reply By: D-2-K
natesmithzombies
I have been gone a while and haven't had the chance to answer some questions. Here is a copy and paste of the function I use to see if a boss is facing its target: function is_facing( facee ) { orientation = self getPlayerAngles(); forwardVec = anglesToForward( orientation ); forwardVec2D = ( forwardVec[0], forwardVec[1], 0 ); unitForwardVec2D = VectorNormalize( forwardVec2D ); toFaceeVec = facee.origin+(0,0,62) - self.origin; toFaceeVec2D = ( toFaceeVec[0], toFaceeVec[1], 0 ); unitToFaceeVec2D = VectorNormalize( toFaceeVec2D ); dotProduct = VectorDot( unitForwardVec2D, unitToFaceeVec2D ); return ( dotProduct > 0.95 ); }

Great to see you Back Buddy :)