### Index > 3D Forums > Maya Boards > Dynamics & Effects

Jun 01, 2012
Post id: 310135

So I've got a particle system with 6 instanced objects on my index. All that works fine. Ideally, I'd like to set a percentage per each indexed object as they're born randomly. For example:
Index_obj1=90%
Index_obj2=2%
Index_obj3=2%
Index_obj4=2%
Index_obj5=2%
Index_obj6=2%
My brain is not working this morning, so any help would be appreciated.

Jun 01, 2012
Post id: 310137

I figured it out. Here's what I did for my example:
What I did is created 3 objects, identified as 0-2 (in the instancer node, the number to the objects left is it's index ID). In the particle system, I created a dynamic Attribute > General > Particle > userScalar1PP. I then created a creation expression as seen bellow:

\$randInstFloat = rand(0,20);
int \$randInst = \$randInstFloat;
print (\$randInst + "\n");
if (\$randInst > 2)
{
nParticleShape1.userScalar1PP = 0 ;
}else if(\$randInst == 1)
{
nParticleShape1.userScalar1PP = 1 ;
}else if(\$randInst == 2)
{
nParticleShape1.userScalar1PP = 2 ;
}

Notes: rand creates float values, and the if = requires to hit an integer to match, so I converted the float to an integer. That said, the chances of hitting exactly 20 is very slim, though all other numbers are rounded down and have an equal chance of hitting. For this reason, I reordered the if statements so 1 and 2 created the uncommon objects and the rest created the common object.