Hi friends, thank you for helping me. Here is what I have so far and it works, but can you look over this and help me make it better, less error prone?

This is the new line in the material's event
Code:
if(ent_getskin(me,5)!=NULL)  // If the entity's 5th skin is not NULL
	{
	BMAP* doot = ent_getskin(me,5);     ///get the bmap pointer of the entity's 5th skin
	_fx->SetTexture("clother",doot->d3dtex);  // force the texture sampler to be the bmap of the entitys 5th skin!
	}



This works correctly with models that do actually have a 5th texture! Very exciting!

But for models that dont have a 5th texture saved in their model file, their shader puts up seemingly random textures, which I assume the shader is putting up leftover images in memory.

Also, is it dangerous to declare a bitmap within a material's event function?