I'd like to change the style of a cosmetic style of the Team Fortress 2 'Caped Crusader' cosmetic from 'Vigilante' to 'Team Playa'. In other words, change the color of Batman's cape from black to team color. However, I have no idea how to do it since it requires a change in the style. Can you help?
I thought this piece of code might do it but I was wrong:
PHP Code:
SetEntData(hat, FindSendPropInfo(entclass, "m_nSkin"), style);
I also found and tried this from SMLIB. No luck.
PHP Code:
/**
* Sets the entity's model index (must be precached)
*
* @param entity Entity index.
* @param index Model Index.
* @noreturn
*/
stock Entity_SetModelIndex(entity, index)
{
SetEntProp(entity, Prop_Data, "m_nModelIndex", index, 2);
}
Any ideas?
Update: I received this piece of code from Lugui on the AlliedModders Discord:
PHP Code:
int model = PrecacheModel("models/workshop/player/items/soldier/bak_caped_crusader/bak_caped_crusader.mdl", false);
for(int i = 0; i < 4; i++) {
SetEntProp(itemEnt, Prop_Send, "m_nModelIndexOverrides", model, 4, i);
}
Bad News: The code snippet provided by Lugui does not work with the Caped Crusader cosmetic. Most likely because this method only works when there is a different model used for the different style.
Good News: I tested the code snippet provided by Lugui and it does work when there is a different model used by the style, such as the Pest's Pads cosmetic for the Scout.
I'll leave this post as unsolved since I would still like to know how to change the style on the Caped Crusader with code.