I need hide horse mane due clipping when attaching armor to his neck. So I learned how is done hair hiding at player.
I did this config.cpp on my horse:
class Horse_Base : AnimalBase { simulation="dayzanimal"; scope=0; model="Dayz_Horse\Models\horse\horse.p3d"; displayName="#DH_horse"; descriptionShort="Horse"; //aiAgentTemplate="Herbivores_CapreolusCapreolus"; aiAgentTemplate="Horse_Follow"; injuryLevels[]={1,0.5,0.2,0}; clothingType="horse1"; collidesWithCharacterOnDeath=1; attachments[]= { "HorseShoe", "HorseLegs", "HorseBack", "HorseSaddle", "HorseNeck", "HorseHead", "HorseMouth" }; hiddenSelections[]= { "Horse_Body", "Horse_Mane1", "Horse_Mane2", "Horse_Tail" }; simpleHiddenSelections[]= { "Horse_Mane1", "Horse_Mane2" };
My armor item using already vanilla code & config:
class Saddle_Armour : SaddleBase { scope=2; model="\dayz_horse\models\equipment\armour\armour_g.p3d"; headSelectionsToHide[]= { "Horse_Mane1", "Horse_Mane2" }; class ClothingTypes { horse1 = "\dayz_horse\models\equipment\armour\armour.p3d"; }; hiddenSelectionsTextures[]= { "\dayz_horse\models\equipment\armour\data\armour_co.paa" }; };
Then I did scripts:
override void EEItemAttached( EntityAI item, string slot_name ) { super.EEItemAttached(item, slot_name); ItemBase itemIB = ItemBase.Cast(item); HideHairSelections(itemIB,true); } override void EEItemDetached( EntityAI item, string slot_name ) { super.EEItemDetached(item, slot_name); ItemBase itemIB = ItemBase.Cast(item); HideHairSelections(itemIB,false); } TStringArray GetHorseManeTexture() { return m_HorseTextures; } void HideHairSelections(ItemBase item, bool state) { if (!item || !item.GetHeadHidingSelection()) return; string str int idx = 0; int i; int count; count = item.GetHeadHidingSelection().Count(); for (i = 0; i < count; i++) { str = item.GetHeadHidingSelection().Get(i); idx = GetHiddenSelectionIndex(str); //Print("Hidden selection " + str + " id " + idx); if (idx != -1) { this.SetSimpleHiddenSelectionState(idx,!state); // NEFUNGUJE TO PANOVE (DOES NOT WORK GUYS) <------------------------------------------ // kdyz je state false obnovit puvodni texturu if (state) { this.SetObjectTexture(idx, "dayz_horse/models/horse/data/transparent_ca.paa"); //workaround thx Nazzgy } else { this.SetObjectTexture(idx, this.GetHorseManeTexture().Get(idx)); } } } }
Please tell me what is wrong or at least check if that medtod works on animals.