View Single Post
1xAero
Member
Join Date: Feb 2018
Location: Sakha, Russia
Old 06-15-2023 , 04:37   Re: AEROBOT.XYZ - Artificial Intelligence template for GoldSource engine
Reply With Quote #3

Quote:
Originally Posted by Syfon View Post
Does the bot see through the smoke?
Yes . Normally there is some checks need to be done inside trace between attacker and victim.

Code:
//Simply trace to target. NOTE: this is just trace example, to check for doors, boxes need to be done more.
stock bool: Function_MonsterDetection(Float: iOrigin[3], Float: fOrigin[3], bool: IGNORE_PLAYER = true)
{
	new TRACE = NULL;
	
	engfunc(EngFunc_TraceLine, iOrigin, fOrigin, (IGNORE_PLAYER ? IGNORE_MONSTERS : DONT_IGNORE_MONSTERS), NULL, TRACE);
    
	new Float: flFraction;
	get_tr2(TRACE, TR_flFraction, flFraction);
    
	/*Should add here view in cone, if you want to make pBot only target
	player on his view angles.*/
	if(flFraction == 1.0)
		return true;
		
	return false;
}
1xAero is offline