Here's what I do...
I have a regular household incandescent bulb in a metal hood with a ceramic socket. The wattage I select by how hot it makes the basking area....which for a young veiled I want in the low to mid 80's. I place this light at one side of the cage so that other areas of the cage can be cooler so the chameleon can select the temperature it wants to be at.
Chameleons need to be able to get warm in order to digest their food properly (which you said you know). If the food moves through them too slowly it might cause constipation/impaction. It also limits nutrient absorption.
I'm not a fan of infrared bulbs because I don't think the chameleons recognize them as a source of light and may not bask. Temperatures at night can drop down as low as the high 60's F...so usually no heat is needed at night.
I use a UVB tube light (usually the Repti-sun 5.0). Getting the chameleon into direct sunlight is better, but I live in a cold climate and can't usually. The light from the UVB tube or the sunlight should not pass through glass.
I mist the cage a couple of times a day and once the chameleon is big enough that the drops of water won't drown it, I use a dripper. I don't use cold water for either.
I gutload my crickets (and other insects) with a nutritional diet. For crickets I use a wide variety of greens (dandelion greens, kale, collards, endive, ROMAINE lettuce, etc.) and veggies (carrots, squash, sweet potato, white potato, sweet red pepper, celery leaves, zucchini, etc.). Insects should also be of appropriate size for the chameleon.
I dust the insects at most feedings with a phosphorous-free calcium powder before giving them to the chameleons. Most insects have a poor ratio of calcium to phos...so this helps to make up for it.
I also dust with a vitamin powder twice a month. I use one that has a beta carotene source of vitamin A. Beta carotene won't build up in the system but preformed vitamin A will. There is some controversy about chameleons needing preformed. Also, vitamin A is somewhat antagonistic to vitamin D3, so there needs to be a balance between the two.
Since my chameleons only get UVB from a tube light, I dust with D3/calcium lightly twice a month. UVB is needed to produce D3 which allows the chameleon to use the calcium in its diet.
Veileds are omnivores, so any plants used in the cage should be well-washed (both sides of the leaves) and non-toxic. You can give your veiled a "salad" using the greens and veggies (except for the white potato) listed in the gutload...along with a little fruit (apple, pear, melon, berries, etc.)
Keeping my veileds as above, they live long healthy lives, produce healthy babies that also live long healthy lives.
If you haven't been providing the right temperatures, UVB light, gutloaded insects that are supplemented, its possible/likely for your chameleon to develop MBD (metabolic bone disease).
Also...I use no substrate for arboreal chameleons. Some contain toxins and others can cause impaction...so I have found that its easier just not to use any.
Hope you can get him back on track quickly. Perhaps a visit to the vets will help?