I meant to reply to this earlier but I was sick. Here's some code from my project that turns the player's skin blue if he's cold. The effect is ramped in and out so that it's less abrupt. An important note is that in the vmt file, the blend factor is set to .01 and it is ramped up to 1. If you start it at 0 for some reason, the proxy won't work, I think because it optimizes to using a different shader without support for that proxy.
In the client code somewhere: class CStatusEffectSkinProxy : public CEntityMaterialProxy { public: CStatusEffectSkinProxy( void ); virtual ~CStatusEffectSkinProxy( void ); virtual bool Init( IMaterial *pMaterial, KeyValues* pKeyValues ); virtual void OnBind( C_BaseEntity *pC_BaseEntity ); virtual IMaterial * GetMaterial(); private: IMaterialVar* m_pDetail; IMaterialVar* m_pDetailScale; IMaterialVar* m_pDetailBlend; IMaterialVar* m_pDetailMode; }; CStatusEffectSkinProxy::CStatusEffectSkinProxy() { m_pDetail = NULL; m_pDetailScale = NULL; m_pDetailBlend = NULL; m_pDetailMode = NULL; } CStatusEffectSkinProxy::~CStatusEffectSkinProxy() { } bool CStatusEffectSkinProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues ) { bool bFoundDetail, bFoundScale, bFoundBlend, bFoundMode; m_pDetail = pMaterial->FindVar( "$detail", &bFoundDetail, false ); m_pDetailScale = pMaterial->FindVar( "$detailscale", &bFoundScale, false ); m_pDetailBlend = pMaterial->FindVar( "$detailblendfactor", &bFoundBlend, false ); m_pDetailMode = pMaterial->FindVar( "$detailblendmode", &bFoundMode, false ); return bFoundDetail && bFoundScale && bFoundBlend && bFoundMode; } void CStatusEffectSkinProxy::OnBind( C_BaseEntity *pEnt ) { float flEffectMagnitude; if (pEnt->IsPlayer() && ToCFPlayer(pEnt)) { C_CFPlayer* pPlayer = ToCFPlayer(pEnt); flEffectMagnitude = pPlayer->m_pStats->GetEffectFromBitmask(STATUSEFFECT_SLOWNESS); } else if (pEnt->IsNPC() && dynamic_cast<C_CFActor*>(pEnt)) { flEffectMagnitude = dynamic_cast<C_CFActor*>(pEnt)->m_flEffectMagnitude; } else return; if (m_pDetailBlend) { float flCurrent = m_pDetailBlend->GetFloatValue(); float flGoal = RemapValClamped(flEffectMagnitude, 0.0f, 1.0f, 0.3f, 1.0f ); if (flEffectMagnitude < 0.01) flGoal = 0.0f; m_pDetailBlend->SetFloatValue( Approach(flGoal, flCurrent, gpGlobals->frametime/10) ); } } IMaterial *CStatusEffectSkinProxy::GetMaterial() { if ( !m_pDetail ) return NULL; return m_pDetail->GetOwningMaterial(); } EXPOSE_INTERFACE( CStatusEffectSkinProxy, IMaterialProxy, "StatusLevel" IMATERIAL_PROXY_INTERFACE_VERSION ); In the .vmt file for the player model: VertexLitGeneric { "$basetexture" "models\player\male\NumeniMaleYellow" "$bumpmap" "models\player\male\NumeniMaleNormal" [ ... ] "$detail" "models\player\male\NumeniMaleFrostbite" "$detailscale" "1" "$detailblendfactor" "0.01" "$detailblendmode" "2" "Proxies" { "StatusLevel" { } } } -- Jorge "Vino" Rodriguez _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders