I an amateur in maxscript, trying to write a script to make traffic cars using path constraint.
the script does 2 things. make all selected cars orientation “follow” the path, and randomize the car’s position by “percentage”. This is what I have :
arr = selection as array lastpos = 0 for i in (arr) do ( i.pos.controller.Path_Constraint.controller.follow = on i.pos.controller.Path_Constraint.controller.percent = lastpos + (random 0.5 3) lastpos = i.pos.controller.Path_Constraint.controller.percent )
But there is a problem. the cars are in 7 colors but there is hundreds copy of them. my script makes a lot of the same color cars in a row. I think it is because of the selection array order. So I am looking for a way to randomize the selection array before doing the job.
Please help. Thanks.