OnTriggerEnter help

Hi all! I have this script (below) and I need help to make it so that the enemy when coming into contact with a triggered collider, it switches to wandering and selects a new route, rather than still attacking. I’m not asking for code, I just need to know what to add or how to get the code. Thanks!

attach a box collider to ur enemy and hope that u got another collider on ur main gameobject
use

void OnTriggerEnter(Collider other) {

	if (other.gameObject.tag == "urmaingameobject")
	{
		
		Colexists=true;
		
		Debug.Log("Collission exists");
		
		other.gameObject.transform.position=new Vector3(10,0,0);
		
		
		//touched_object=other.gameObject.transform.position;
		
	}
}


  void OnTriggerExit(Collider other) {
	
  Colexists=false;
		//Debug.Log("Collission does not exist");

	
}