How can I make an item choose between several different waypoints randomly and then make it execute something when it arrives to the waypoint?

The purpose of the game is to capture a golden ball which moves to different positions in the scene. I want to make about 8 waypoints over the scene which the ball can randomly choose one(with exception from the one it is placed on at that moment) and then go to a second waypoint, in 1 second lower down, wait there for 10 seconds and then take 1 sec to get up over the map and do the thing all over again. Preferably if it could take 3 seconds to move to next waypoint too so the whole operation takes 15 seconds. I have searched all day for an answer to this but cant find anything. Any explanation or link to something helpful would be great!

enumerate the waypoints, then use a random like Random.Range(0,8), get your random waypoint index, use that waypoint, getyourself a time dependant variable, float myTimeDependantVariable, that gets the time from the update Time.deltaTime, add states, countingto1, countingto10, countingto3, change states according to what you need. hope you get it, happy coding

Read the docs for each link provided and you should be able to puzzle it together. If you still are stuck, but have read the docs, please explain what confuses you and I’ll try to help a bit further.

Thanks for the answers! I have read through the documents and searched at some other places to find out how to lower the object for 10 seconds. However I cant seem to make the object move to next waypoint with this code but when I have the object not lowered it manages to move back and forth between the waypoints but not with the time of 3 seconds it just pops between the points. This is not the major concern so if I just could get some tip about how to make this code go to start again that would probably be just fine!

var waypoint : int;
var currentWaypoint : int;

var start : Transform;
var end;

waypoint = 1;
currentWaypoint = 1;

var waypoint1 : Transform;
var waypoint2 : Transform;
var waypoint3 : Transform;
var waypoint4 : Transform;

function Start(){

	currentWaypoint = Random.Range(1, 4);
		
	if(currentWaypoint != waypoint){
		
		if(currentWaypoint == 1){
						
			transform.position = Vector3.Lerp(start.position, waypoint1.position, 3);
			
			yield WaitForSeconds(1);
			
			transform.Translate(Vector3.up * -10, Space.Self);
			
			yield WaitForSeconds(10);
			
			transform.Translate(Vector3.up * 10, Space.Self);
			
			yield WaitForSeconds(1);
			
			waypoint = currentWaypoint;
			
		}
		
		else if(currentWaypoint == 2){
							
			transform.position = Vector3.Lerp(start.position, waypoint2.position, 3);
			
			yield WaitForSeconds(1);
			
			transform.Translate(Vector3.up * -10, Space.Self);
			
			yield WaitForSeconds(10);
			
			transform.Translate(Vector3.up * 10, Space.Self);
			
			yield WaitForSeconds(1);
			
			waypoint = currentWaypoint;
			
		}
		
		else if(currentWaypoint == 3){
							
			transform.position = Vector3.Lerp(start.position, waypoint3.position, 3);
			
			yield WaitForSeconds(1);
			
			transform.Translate(Vector3.up * -10, Space.Self);
			
			yield WaitForSeconds(10);
			
			transform.Translate(Vector3.up * 10, Space.Self);
			
			yield WaitForSeconds(1);
			
			waypoint = currentWaypoint;
			
		}
		
		else if(currentWaypoint == 4){
							
			transform.position = Vector3.Lerp(start.position, waypoint4.position, 3);
			
			yield WaitForSeconds(1);
			
			transform.Translate(Vector3.up * -10, Space.Self);
			
			yield WaitForSeconds(10);
			
			transform.Translate(Vector3.up * 10, Space.Self);
			
			yield WaitForSeconds(1);
			
			waypoint = currentWaypoint;
			
		}
	}
	
	else if(currentWaypoint == waypoint){
	
		currentWaypoint = Random.Range(1, 4);
	
	}
	
}