Yuval 29 Posted October 20, 2015 Okay, I made my gun 2 handguards - regular one and one with a rail on it. I wish my handguards to change by whether there's a bipod or flashlight on the gun or not. So I made 2 animations to hide the regular handguard: class Animations { class plastichandguard_hide_side { type="hide"; hideValue=0.3; minValue=0; maxValue=0.5; minPhase=0; maxPhase=0.5; source="hasAccessory"; selection="handguard"; }; class plastichandguard_hide_underbarrel { type="hide"; hideValue=0.3; minValue=0; maxValue=0.5; minPhase=0; maxPhase=0.5; source="hasBipod"; selection="handguard"; }; }; So this is the animations for the regular handguard. Now I need to make the exact opposite for the rail handguard. Does anyone know how can I do that? I've seen an addon, I think it was Trixie's snipers (not sure) where it was said a rail is automatically animated in when the gun has an optic or an accessory so I think it SHOULD be possible to do it right? I mean as far as I understand the rail handguard should be hidden by default and only unhidden when hasBipod or\and hasAccessory is activated, right? I don't know how to do it :/ Share this post Link to post Share on other sites
Jackal326 1182 Posted October 20, 2015 I did a similar thing for an MP5 Pack I worked on, where basically when you added an optic a rail appeared on the top of the receiver. Without an optic, the rail is hidden. Here is the code: class rail_hide { type="hide"; source="hasOptics"; selection="rail_lowprofile"; minValue = 0.000000; maxValue = 1.00000; hideValue = 0.0; unhideValue = 0.7; }; Obviously you'll need to change the source, and the selection name. The two key parts are hideValue and unhideValue. A hidevalue of 0.0 means that by default the selection is hidden until the source is triggered. 1 Share this post Link to post Share on other sites
da12thMonkey 1943 Posted October 20, 2015 class Animations { class railhandguard_unhide_side { type="hide"; hideValue=0.3; minValue=-1; maxValue=0; minPhase=-1; maxPhase=0; source="hasAccessory"; selection="rail"; }; class railhandguard_unhide_underbarrel { type="hide"; hideValue=0.3; minValue=-1; maxValue=0; minPhase=-1; maxPhase=0; source="hasBipod"; selection="rail"; }; }; Is the way we used to get something to be hidden at init in the past, before we had an unhide command. Think there's probably a way to do it with the new 'unhidevalue' parameter as well but haven't had need to try such a thing. Would probably be along the lines of this: Ed:- Jackal's confirmed this sort of method works. class Animations { class railhandguard_unhide_side { type="hide"; hideValue=0.3; unhideValue=0.7; minValue=0.5; maxValue=1; minPhase=0.5; maxPhase=1; source="hasAccessory"; selection="rail"; }; class railhandguard_unhide_underbarrel { type="hide"; hideValue=0.3; unhideValue=0.7; minValue=0.5; maxValue=1; minPhase=0.5; maxPhase=1; source="hasBipod"; selection="rail"; }; }; 1 Share this post Link to post Share on other sites
Yuval 29 Posted October 20, 2015 I did a similar thing for an MP5 Pack I worked on, where basically when you added an optic a rail appeared on the top of the receiver. Without an optic, the rail is hidden. Here is the code: class rail_hide { type="hide"; source="hasOptics"; selection="rail_lowprofile"; minValue = 0.000000; maxValue = 1.00000; hideValue = 0.0; unhideValue = 0.7; }; Obviously you'll need to change the source, and the selection name. The two key parts are hideValue and unhideValue. A hidevalue of 0.0 means that by default the selection is hidden until the source is triggered. class Animations { class railhandguard_unhide_side { type="hide"; hideValue=0.3; minValue=-1; maxValue=0; minPhase=-1; maxPhase=0; source="hasAccessory"; selection="rail"; }; class railhandguard_unhide_underbarrel { type="hide"; hideValue=0.3; minValue=-1; maxValue=0; minPhase=-1; maxPhase=0; source="hasBipod"; selection="rail"; }; }; Is the way we used to get something to be hidden at init in the past, before we had an unhide command. Think there's probably a way to do it with the new 'unhidevalue' parameter as well but haven't had need to try such a thing. Would probably be along the lines of this: Ed:- Jackal's confirmed this sort of method works. class Animations { class railhandguard_unhide_side { type="hide"; hideValue=0.3; unhideValue=0.7; minValue=0.5; maxValue=1; minPhase=0.5; maxPhase=1; source="hasAccessory"; selection="rail"; }; class railhandguard_unhide_underbarrel { type="hide"; hideValue=0.3; unhideValue=0.7; minValue=0.5; maxValue=1; minPhase=0.5; maxPhase=1; source="hasBipod"; selection="rail"; }; }; Thank you both, really! Very appreciated!!! Share this post Link to post Share on other sites
Yuval 29 Posted October 20, 2015 Okay, I've run the animations - and both of them are invisible. Don't really know why though :( Not matter if I put any accessory or if I put both or leave it empty - both handguards are invisible :( Share this post Link to post Share on other sites
da12thMonkey 1943 Posted October 20, 2015 Having a try with it, I'm beginning to think the animation will only work the way you intend it to when you have a bipod and an pointer slot item fitted to the weapon, since when you only have one of those slots filled, the other slot is still telling the weapon to stay in its original state. Don't think what you want to to with a slotA or slotB case will work. Share this post Link to post Share on other sites
Yuval 29 Posted October 20, 2015 Having a try with it, I'm beginning to think the animation will only work the way you intend it to when you have a bipod and an pointer slot item fitted to the weapon, since when you only have one of those slots filled, the other slot is still telling the weapon to stay in its original state. Don't think what you want to to with a slotA or slotB case will work. Yeah well I had a problem with my config (something that doesn't relate to the model). Now, only the rail handguard is showing but not the regular handguard at all. No matter how the setup is like - the handguard doesn't change and it's stuck on the rail one. I thought I'd share how the model.cfg looks like right now: Selections are: "handguard" & "handguardrail" (Skeleton is adjusted accordingly) class plastichandguard_hide_side { type="hide"; hideValue=0.3; minValue=0; maxValue=0.5; minPhase=0; maxPhase=0.5; source="hasAccessory"; selection="handguard"; }; class plastichandguard_hide_underbarrel { type="hide"; hideValue=0.3; minValue=0; maxValue=0.5; minPhase=0; maxPhase=0.5; source="hasBipod"; selection="handguard"; }; class railhandguard_unhide_side { type="hide"; hideValue=0.3; unhideValue=0.7; minValue=0.5; maxValue=1; minPhase=0.5; maxPhase=1; source="hasAccessory"; selection="handguardrail"; }; class railhandguard_unhide_underbarrel { type="hide"; hideValue=0.3; unhideValue=0.7; minValue=0.5; maxValue=1; minPhase=0.5; maxPhase=1; source="hasBipod"; selection="handguardrail"; }; Share this post Link to post Share on other sites
da12thMonkey 1943 Posted October 20, 2015 For a moment, don't bother trying to have the two simultaneous animation sources; just focus on trying to get the anim to work when you attach a side rail item. Delete or comment out the two hasbipod anims so you only have this: class plastichandguard_hide_side { type="hide"; hideValue=0.5; minValue=0; maxValue=1; minPhase=0; maxPhase=1; source="hasAccessory"; selection="handguard"; }; class railhandguard_unhide_side { type="hide"; hideValue=0; unhideValue=0.5; minValue=0; maxValue=1; minPhase=0; maxPhase=1; source="hasAccessory"; selection="handguardrail"; }; Then test to see whether the anim you want, works when adding and removing just a pointer slot attachment. If it works, then swap the two sources in the above from hasAccessory to hasBipod (no need to change the classnames of the anims really) and repeat the test, now seeing whether it works again when you attach/detach a bipod. If that also works, change the sources back to hasAccessory then make an additional hasBipod version of one of the above anims. e.g. add class railhandguard_unhide_underbarrel { type="hide"; hideValue=0; unhideValue=0.5; minValue=0; maxValue=1; minPhase=0; maxPhase=1; source="hasBipod"; selection="handguardrail"; }; And see whether the rail appears under the plastic handguard when you have a bipod attached but no pointer, then what happens when you add a pointer and bipod, then what happens when you take the bipod off and leave the pointer on. Then do the same with the opposite anim (i.e. railhandguard_hide_underbarrel). You kind of need to identify which part of the animation or mix of sources is causing the funny behaviour rather than trying to unfuck the whole thing written in one piece - that just makes troubleshooting too difficult. Share this post Link to post Share on other sites
Yuval 29 Posted October 20, 2015 For a moment, don't bother trying to have the two simultaneous animation sources; just focus on trying to get the anim to work when you attach a side rail item. Delete or comment out the two hasbipod anims so you only have this: class plastichandguard_hide_side { type="hide"; hideValue=0.5; minValue=0; maxValue=1; minPhase=0; maxPhase=1; source="hasAccessory"; selection="handguard"; }; class railhandguard_unhide_side { type="hide"; hideValue=0; unhideValue=0.5; minValue=0; maxValue=1; minPhase=0; maxPhase=1; source="hasAccessory"; selection="handguardrail"; }; Then test to see whether the anim you want, works when adding and removing just a pointer slot attachment. If it works, then swap the two sources in the above from hasAccessory to hasBipod (no need to change the classnames of the anims really) and repeat the test, now seeing whether it works again when you attach/detach a bipod. If that also works, change the sources back to hasAccessory then make an additional hasBipod version of one of the above anims. e.g. add class railhandguard_unhide_underbarrel { type="hide"; hideValue=0; unhideValue=0.5; minValue=0; maxValue=1; minPhase=0; maxPhase=1; source="hasBipod"; selection="handguardrail"; }; And see whether the rail appears under the plastic handguard when you have a bipod attached but no pointer, then what happens when you add a pointer and bipod, then what happens when you take the bipod off and leave the pointer on. Then do the same with the opposite anim (i.e. railhandguard_hide_underbarrel). You kind of need to identify which part of the animation or mix of sources is causing the funny behaviour rather than trying to unfuck the whole thing written in one piece - that just makes troubleshooting too difficult. I did that. The result was that the animation has only worked for the accessory (side \ pointer) attachment. and setting only a bipod made nothing to be shown. I don't exactly remember what happens when the 2 are combined together, never the less I decided to give up for the side attachment and make it affect only with a bipod attachment (I gotta keep going with my addon and this part really got me stuck for a few hours). if still there is a way to do it, I'd love to do - maybe we could here something from a dev perhaps? This doesn't seem to be something that will be possible indeed - but there might be a slight chance :D Share this post Link to post Share on other sites