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

void OnTriggerEnter(Collider other) {

	if (other.gameObject.tag == "urmaingameobject")
		Debug.Log("Collission exists");
		other.gameObject.transform.position=new Vector3(10,0,0);

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