you could just store the vertex positions that you have used something like //OUTSIDE OF FOR LOOP//float $vertexList[];//Inside FOR LOOP//$vertexList[size($vertexList)] = pPlane1.vtx[$randomNumber1]; Sucks that mel doesnt have push/pop or any array methods so this is a quick way to do a push. PS: I havent tested this, so…
Storing the names in an array is a good way of being able to repeat the same action with a for loop instead of copy-paste the same action for each reference. :)
In the loop you're placing trees, each time you place a tree you add it to the array. Next time you add a tree you're checking the array if it's already in there, if not place it. :)
K so the reason is you're first missing the open and close brackets for the for loop. Second the move command wants the object name at the end. Otherwise the script will just error out. Here's the fixed up code: for( $i=0; $i<$density; $i++ ) { string $tree[] = `polyCube -name ("treeA"+$i)`; int $randomNumber1 = `rand…