How to clamp Bone Vertex influence to an amount of 2(problems with udk skeletal mesh)

I’m trying to export a skeletal mesh from blender to udk to use with the mobile place able pawn of udk on ios. After trying very long i can’t get it to work as expected. In the udk editor the mesh deforms great(exactly as in blender)
When i replace jazz the rabbit(a tutorial character of udk) with my mesh, animtree and animset; and start the level with “start this level on pc” and" play this level in editor" everything works great as well.
But in “mobile previewer” and on the device my mesh distorts lot. Somebody said that the each bone shuld not be influence more than 2 vertices in udk mobile.
Is there a way to automatically clamp the already applied automatic bone weights to 2 bones per vertex.
in 3d Studio seams to be a option in the skin modifier (Bone Affect Limit)to clamp the influence, but I can’t find any information how I could clamp the values in blender. In the weight paint mode is a clean setting could this make sure that every vertex is not affected by more than 2 bones? if so what settings would this need?
Because I’m not sure if this is the reason for this problem at all, it would be nice if somebody who may be had success with bringing a blender made skeletal mesh to udk, could point out the most imported steps.

well, i have an script to achieve this. i think you have to increase to 3 or 4 at least for some characters. for example, clavicle zone is not going to be well deformed with only 2 influences. anyway, the script is there:

hope useful

thank very very much you i will try this script.

Sorry for asking but, how do i install the script? I have pasted it into the blender text editor and then presst text/run script, but i get an error
line 11 idetication error for v in
What does this mean. Any idear?

yes, sorry, the > symbol has changed because of html.

open it from blender text editor. it should work

Thank you, sorry for posting again but the download doesnt work.

i’ll fix in a moment